gftool.hermpade.pader

gftool.hermpade.pader(an, num_deg: int, den_deg: int, rcond: float = 1e-14) gftool.basis.RatPol[source]

Robust version of Padé approximant to polynomial an.

Implements more or less [gonnet2013]. The degrees num_deg and den_deg are automatically reduced to obtain a robust solution.

Parameters
an(L,) array_like

Taylor series coefficients representing polynomial of order L-1

num_deg, den_degint

The order of the return approximating numerator/denominator polynomial. The sum must be at most L: L >= n + m + 1. Depending on rcond the degrees can be reduced.

rcondfloat, optional

Cut-off ratio for small singular values. For the purposes of rank determination, singular values are treated as zero if they are smaller than rcond times the largest singular value. (default: 1e-14) The default is appropriate for round error due to machine precision.

Returns
RatPol

The rational polynomial with numerator RatPol.numer, and denominator RatPol.denom.

See also

pade

References

gonnet2013

1.Gonnet, P., Güttel, S. & Trefethen, L. N. Robust Padé Approximation via SVD. SIAM Rev. 55, 101–117 (2013). https://doi.org/10.1137/110853236

Examples

The robust version can avoid over fitting for high-order Padé approximants. Choosing an appropriate rcond, is however a delicate task in practice. We consider an example with random noise on the Taylor coefficients an:

>>> from scipy.special import binom
>>> deg = 50
>>> an = binom(1/3, np.arange(2*deg + 1))  # Taylor of (1+x)**(1/3)
>>> an += np.random.default_rng().normal(scale=1e-9, size=2*deg + 1)
>>> x = np.linspace(-1, 3, num=500)
>>> fx = np.emath.power(1+x, 1/3)
>>> pade = gt.hermpade.pade(an, num_deg=deg, den_deg=deg)
>>> pader = gt.hermpade.pader(an, num_deg=deg, den_deg=deg, rcond=1e-8)
>>> import matplotlib.pyplot as plt
>>> __ = plt.plot(x, abs(pade.eval(x) - fx), label='standard Padé')
>>> __ = plt.plot(x, abs(pader.eval(x) - fx), label='robust Padé')
>>> plt.yscale('log')
>>> __ = plt.legend()
>>> plt.show()

(png, pdf)

../_images/gftool-hermpade-pader-1.png