« Python pour le calcul scientifique/Interpolation, extrapolation et lissage » : différence entre les versions
Contenu supprimé Contenu ajouté
→Interpolation : PCHIP |
→Interpolation à une dimension : Akima |
||
Ligne 34 :
* <code>"cubic"</code> : " par une ''{{lang|en|spline}}'' d'ordre 3.
La classe <code>interpolate.BarycentricInterpolator
<source lang="python">
f = interpolate.BarycentricInterpolator(xp, yp)
Ligne 44 :
</source>
La classe <code>interpolate.KroghInterpolator
<source lang="python">
f = interpolate.KroghInterpolator(xp, yp)
Ligne 61 :
</source>
On peut avoir une interpolation par un polynôme cubique par parties PCHIP ''({{lang|en|piecewise cubic hermite interpolating polynomial}})'' avec la classe <code>interpolate.PchipInterpolator
<source lang="python">
f = interpolate.PchipInterpolator(xp, yp) # renvoie NaN en cas d'extrapolation
Ligne 74 :
y = interpolate.pchip_interpolate(xi, yi, x)
y_n = interpolate.pchip_interpolate(xi, yi, x, n)
</source>
La classe <code>interpolate.Akima1DInterpolator</code> définit une fonction d'interpolation selon la méthode Akima : elle construit des sous-''{{lang|en|splines}}'' à partir de polynômes cubiques par partie :
<source lang="python">
f = interpolate.Akima1DInterpolator(xp, yp)
y = f.__call__(x)
f_n = f.derivative(n) # construit la fonction dérivée n-ième
F_n = f.antiderivative(n) # construit la n-ième primitive
racines = f.roots() # racines du polynôme
y_n = interpolate.krogh_interpolate(x, n) # dérivée n-ième
</source>
|