Anonymous user
Sum of a series: Difference between revisions
no edit summary
(Logo) |
No edit summary |
||
Line 1:
{{task}}Display the sum of a finite series for a given range.
For this task, use S(x) = 1/x^2, from 1 to 1000. (This approximates the Riemann zeta function. The Basel problem solved this: zeta(2) =
=={{header|Ada}}==
Line 32:
int main()
{
double sum = 0;
++x )
{
}
}
}
Line 50:
double f(double x)
{
}
</pre>
Line 163:
map { $sum += 1 / ( $_ * $_ ) } (1..1000);
print "$sum\n";
</pre>
=={{header|Pop11}}==
<pre>
lvars s = 0, j;
for j from 1 to 1000 do
s + 1.0/(j*j) -> s;
endfor;
s =>
</pre>
|