5.1.3.3. numdifftools.extrapolation.dea3

dea3(v_0, v_1, v_2, symmetric=False)[source]

Extrapolates a slowly convergent sequence using Shanks transformations.

Parameters:
v_0, v_1, v_2array-like

Three consecutive values of a convergent sequence to extrapolate.

symmetricbool, optional

If True, returns a sequence with symmetric error estimates. Defaults to False.

Returns:
resultarray-like

The extrapolated value(s).

abserrarray-like

The estimated absolute error(s).

See also

Dea

Notes

DEA3 uses nonlinear Shanks transformations based on three values to extrapolate to a better estimate of the sequence’s limit. It is a vectorized translation of the DQELG function from the QUADPACK Fortran library. for LIMEXP=3, see [Rc8bfc08f7c28-2] and [Rc8bfc08f7c28-3].

References

Examples

# integrate sin(x) from 0 to pi/2

>>> import numpy as np
>>> import numdifftools as nd
>>> Ei= np.zeros(3)
>>> linfun = lambda i : np.linspace(0, np.pi/2., 2**(i+5)+1)
>>> for k in np.arange(3):
...    x = linfun(k)
...    Ei[k] = trapz(np.sin(x),x)
>>> [En, err] = nd.dea3(Ei[0], Ei[1], Ei[2])
>>> truErr = np.abs(En-1.)
>>> bool(np.all(truErr < err))
True
>>> np.allclose(En, 1)
True
>>> bool(np.all(np.abs(Ei-1)<1e-3))
True