Participer au site avec un Tip
Rechercher
 

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 :

Vous êtes un professionnel et vous avez besoin d'une formation ? Programmation Python
Les fondamentaux
Voir le programme détaillé
Module « scipy.interpolate »

Fonction krogh_interpolate - module scipy.interpolate

Signature de la fonction krogh_interpolate

def krogh_interpolate(xi, yi, x, der=0, axis=0) 

Description

help(scipy.interpolate.krogh_interpolate)

Convenience function for polynomial interpolation.

See `KroghInterpolator` for more details.

Parameters
----------
xi : array_like
    Interpolation points (known x-coordinates).
yi : array_like
    Known y-coordinates, of shape ``(xi.size, R)``. Interpreted as
    vectors of length R, or scalars if R=1.
x : array_like
    Point or points at which to evaluate the derivatives.
der : int or list or None, optional
    How many derivatives to evaluate, or None for all potentially
    nonzero derivatives (that is, a number equal to the number
    of points), or a list of derivatives to evaluate. This number
    includes the function value as the '0th' derivative.
axis : int, optional
    Axis in the `yi` array corresponding to the x-coordinate values.

Returns
-------
d : ndarray
    If the interpolator's values are R-D then the
    returned array will be the number of derivatives by N by R.
    If `x` is a scalar, the middle dimension will be dropped; if
    the `yi` are scalars then the last dimension will be dropped.

See Also
--------
KroghInterpolator : Krogh interpolator

Notes
-----
Construction of the interpolating polynomial is a relatively expensive
process. If you want to evaluate it repeatedly consider using the class
KroghInterpolator (which is what this function uses).

Examples
--------
We can interpolate 2D observed data using Krogh interpolation:

>>> import numpy as np
>>> import matplotlib.pyplot as plt
>>> from scipy.interpolate import krogh_interpolate
>>> x_observed = np.linspace(0.0, 10.0, 11)
>>> y_observed = np.sin(x_observed)
>>> x = np.linspace(min(x_observed), max(x_observed), num=100)
>>> y = krogh_interpolate(x_observed, y_observed, x)
>>> plt.plot(x_observed, y_observed, "o", label="observation")
>>> plt.plot(x, y, label="krogh interpolation")
>>> plt.legend()
>>> plt.show()


Vous êtes un professionnel et vous avez besoin d'une formation ? RAG (Retrieval-Augmented Generation)
et Fine Tuning d'un LLM
Voir le programme détaillé