| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
29.3 Examples
The following code calculates an estimate of \zeta(2) = \pi^2 / 6 using the series, After N terms the error in the sum is O(1/N), making direct summation of the series converge slowly.
|
The output below shows that the Levin u-transform is able to obtain an estimate of the sum to 1 part in 10^10 using the first eleven terms of the series. The error estimate returned by the function is also accurate, giving the correct number of significant digits.
$ ./a.outterm-by-term sum = 1.5961632439130233 using 20 terms term-by-term sum = 1.5759958390005426 using 13 terms exact value = 1.6449340668482264 accelerated sum = 1.6449340668166479 using 13 terms estimated error = 0.0000000000508580 actual error = -0.0000000000315785 |
Note that a direct summation of this series would require 10^10 terms to achieve the same precision as the accelerated sum does in 13 terms.
