A package to facilitate the calculation of epsilon () table structures, derived from Wynn's recursive epsilon algorithm. The components of the epsilon table are commonly used within the calculation of sequence transformations.
Suppose we are presented with a series, , with component terms , and partial sums ,
Wynn's epsilon algorithm computes the following recursive scheme: ,
where
The resulting table of values is known as the epsilon table.
Epsilon table values with an even -th index, i.e. , are commonly used to compute rational sequence transformations and extrapolations, such as Shank's Transforms, and Pade Approximants.
The first 5 terms of the Taylor series expansion for are . The epsilon table can be generated in the manner below:
using SymPy
using Wynn
# or, if not registered with package repository
# using .Wynn
@syms x
# first 5 terms of the Taylor series expansion of exp(x)
s = [1, x, x^2/2, x^3/6, x^4/24]
etable = EpsilonTable(s).etable
Retrieving the epsilon table value corresponding to is done by
etable[i, j]
Alternatively, the same term can be calculated without generating the entire epsilon table using the epsilon
function which is much more efficient.
epsilon(s, (i, j))
Suppose we wanted to approximate (around ) using a rational Pade Approximant . The pade approximant is known to correspond to the epsilon table value . Computing the R[2/2] Pade approximant is thus equivalent to ,
R = etable[0,4]
which yields
(First 5 terms of Taylor series)
It can be seen that as x moves away from 0, the Pade approximant is more accurate than the corresponding Taylor series.