scipy.interpolate.CubicHermiteSpline¶

class
scipy.interpolate.
CubicHermiteSpline
(x, y, dydx, axis=0, extrapolate=None)[source]¶ Piecewisecubic interpolator matching values and first derivatives.
The result is represented as a
PPoly
instance. Parameters
 xarray_like, shape (n,)
1d array containing values of the independent variable. Values must be real, finite and in strictly increasing order.
 yarray_like
Array containing values of the dependent variable. It can have arbitrary number of dimensions, but the length along
axis
(see below) must match the length ofx
. Values must be finite. dydxarray_like
Array containing derivatives of the dependent variable. It can have arbitrary number of dimensions, but the length along
axis
(see below) must match the length ofx
. Values must be finite. axisint, optional
Axis along which y is assumed to be varying. Meaning that for
x[i]
the corresponding values arenp.take(y, i, axis=axis)
. Default is 0. extrapolate{bool, ‘periodic’, None}, optional
If bool, determines whether to extrapolate to outofbounds points based on first and last intervals, or to return NaNs. If ‘periodic’, periodic extrapolation is used. If None (default), it is set to True.
Notes
If you want to create a higherorder spline matching higherorder derivatives, use
BPoly.from_derivatives
.References
 R12d9dcd141dc1
Cubic Hermite spline on Wikipedia.
 Attributes
 xndarray, shape (n,)
Breakpoints. The same
x
which was passed to the constructor. cndarray, shape (4, n1, …)
Coefficients of the polynomials on each segment. The trailing dimensions match the dimensions of y, excluding
axis
. For example, if y is 1d, thenc[k, i]
is a coefficient for(xx[i])**(3k)
on the segment betweenx[i]
andx[i+1]
. axisint
Interpolation axis. The same axis which was passed to the constructor.
Methods
__call__
(self, x[, nu, extrapolate])Evaluate the piecewise polynomial or its derivative.
derivative
(self[, nu])Construct a new piecewise polynomial representing the derivative.
antiderivative
(self[, nu])Construct a new piecewise polynomial representing the antiderivative.
integrate
(self, a, b[, extrapolate])Compute a definite integral over a piecewise polynomial.
roots
(self[, discontinuity, extrapolate])Find real roots of the the piecewise polynomial.