Vous êtes un professionnel et vous avez besoin d'une formation ?
Mise en oeuvre d'IHM
avec Qt et PySide6
Voir le programme détaillé
Module « scipy.interpolate »
Classe « FloaterHormannInterpolator »
Informations générales
Héritage
builtins.object
_BarycentricRational
FloaterHormannInterpolator
Définition
class FloaterHormannInterpolator(_BarycentricRational):
help(FloaterHormannInterpolator)
Floater-Hormann barycentric rational interpolation.
As described in [1]_, the method of Floater and Hormann computes weights for a
Barycentric rational interpolant with no poles on the real axis.
Parameters
----------
x : 1D array_like, shape (n,)
1-D array containing values of the independent variable. Values may be real or
complex but must be finite.
y : array_like, shape (n, ...)
Array containing values of the dependent variable. Infinite and NaN values
of `values` and corresponding values of `x` will be discarded.
d : int, optional
Blends ``n - d`` degree `d` polynomials together. For ``d = n - 1`` it is
equivalent to polynomial interpolation. Must satisfy ``0 <= d < n``,
defaults to 3.
Attributes
----------
weights : array
Weights of the barycentric approximation.
See Also
--------
AAA : Barycentric rational approximation of real and complex functions.
pade : Padé approximation.
Notes
-----
The Floater-Hormann interpolant is a rational function that interpolates the data
with approximation order :math:`O(h^{d+1})`. The rational function blends ``n - d``
polynomials of degree `d` together to produce a rational interpolant that contains
no poles on the real axis, unlike `AAA`. The interpolant is given
by
.. math::
r(x) = \frac{\sum_{i=0}^{n-d} \lambda_i(x) p_i(x)}
{\sum_{i=0}^{n-d} \lambda_i(x)},
where :math:`p_i(x)` is an interpolating polynomials of at most degree `d` through
the points :math:`(x_i,y_i),\dots,(x_{i+d},y_{i+d}), and :math:`\lambda_i(z)` are
blending functions defined by
.. math::
\lambda_i(x) = \frac{(-1)^i}{(x - x_i)\cdots(x - x_{i+d})}.
When ``d = n - 1`` this reduces to polynomial interpolation.
Due to its stability following barycentric representation of the above equation
is used instead for computation
.. math::
r(z) = \frac{\sum_{k=1}^m\ w_k f_k / (x - x_k)}{\sum_{k=1}^m w_k / (x - x_k)},
where the weights :math:`w_j` are computed as
.. math::
w_k &= (-1)^{k - d} \sum_{i \in J_k} \prod_{j = i, j \neq k}^{i + d}
1/|x_k - x_j|, \\
J_k &= \{ i \in I: k - d \leq i \leq k\},\\
I &= \{0, 1, \dots, n - d\}.
References
----------
.. [1] M.S. Floater and K. Hormann, "Barycentric rational interpolation with no
poles and high rates of approximation", Numer. Math. 107, 315 (2007).
:doi:`10.1007/s00211-007-0093-y`
Examples
--------
Here we compare the method against polynomial interpolation for an example where
the polynomial interpolation fails due to Runge's phenomenon.
>>> import numpy as np
>>> from scipy.interpolate import (FloaterHormannInterpolator,
... BarycentricInterpolator)
>>> def f(z):
... return 1/(1 + z**2)
>>> z = np.linspace(-5, 5, num=15)
>>> r = FloaterHormannInterpolator(z, f(z))
>>> p = BarycentricInterpolator(z, f(z))
>>> zz = np.linspace(-5, 5, num=1000)
>>> import matplotlib.pyplot as plt
>>> fig, ax = plt.subplots()
>>> ax.plot(zz, r(zz), label="Floater=Hormann")
>>> ax.plot(zz, p(zz), label="Polynomial")
>>> ax.legend()
>>> plt.show()
Constructeur(s)
Liste des opérateurs
Opérateurs hérités de la classe object
__eq__,
__ge__,
__gt__,
__le__,
__lt__,
__ne__
Liste des méthodes
Toutes les méthodes
Méthodes d'instance
Méthodes statiques
Méthodes dépréciées
Méthodes héritées de la classe _BarycentricRational
__call__, __init_subclass__, __subclasshook__, poles, residues, roots
Méthodes héritées de la classe object
__delattr__,
__dir__,
__format__,
__getattribute__,
__getstate__,
__hash__,
__reduce__,
__reduce_ex__,
__repr__,
__setattr__,
__sizeof__,
__str__
Vous êtes un professionnel et vous avez besoin d'une formation ?
Machine Learning
avec Scikit-Learn
Voir le programme détaillé
Améliorations / Corrections
Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.
Emplacement :
Description des améliorations :