The functions described in this section compute the Levin u-transform of series and attempt to estimate the error from the “truncation error” in the extrapolation, the difference between the final two approximations. Using this method avoids the need to compute an intermediate table of derivatives because the error is estimated from the behavior of the extrapolated value itself. Consequently this algorithm is an O(N) process and only requires O(N) terms of storage. If the series converges sufficiently fast then this procedure can be acceptable. It is appropriate to use this method when there is a need to compute many extrapolations of series with similar convergence properties at high-speed. For example, when numerically integrating a function defined by a parameterized series where the parameter varies only slightly. A reliable error estimate should be computed first using the full algorithm described above in order to verify the consistency of the results.
This function allocates a workspace for a Levin u-transform of n terms, without error estimation. The size of the workspace is O(3n).
This function frees the memory associated with the workspace w.
This function takes the terms of a series in array of size
array_size and computes the extrapolated limit of the series using
a Levin u-transform. Additional working space must be provided in
w. The extrapolated sum is stored in sum_accel. The actual
term-by-term sum is returned in
w->sum_plain. The algorithm
terminates when the difference between two successive extrapolations
reaches a minimum or is sufficiently small. The difference between these
two values is used as estimate of the error and is stored in
abserr_trunc. To improve the reliability of the algorithm the
extrapolated values are replaced by moving averages when calculating the
truncation error, smoothing out any fluctuations.