scipy.interpolate.CubicHermiteSpline#
- class CubicHermiteSpline(x, y, dydx, axis=0, extrapolate=None)[source]#
Piecewise-cubic interpolator matching values and first derivatives.
The result is represented as a PPoly instance.
Parameters#
- xarray_like, shape (n,)
1-D 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 out-of-bounds 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.
Attributes#
- xndarray, shape (n,)
Breakpoints. The same
xwhich was passed to the constructor.- cndarray, shape (4, n-1, …)
Coefficients of the polynomials on each segment. The trailing dimensions match the dimensions of y, excluding
axis. For example, if y is 1-D, thenc[k, i]is a coefficient for(x-x[i])**(3-k)on the segment betweenx[i]andx[i+1].- axisint
Interpolation axis. The same axis which was passed to the constructor.
Methods#
__call__ derivative antiderivative integrate roots
See Also#
Akima1DInterpolator : Akima 1D interpolator. PchipInterpolator : PCHIP 1-D monotonic cubic interpolator. CubicSpline : Cubic spline data interpolator. PPoly : Piecewise polynomial in terms of coefficients and breakpoints
Notes#
If you want to create a higher-order spline matching higher-order derivatives, use BPoly.from_derivatives.
References#
Methods
__init__(x, y, dydx[, axis, extrapolate])antiderivative([nu])Construct a new piecewise polynomial representing the antiderivative.
construct_fast(c, x[, extrapolate, axis])Construct the piecewise polynomial without making checks.
derivative([nu])Construct a new piecewise polynomial representing the derivative.
extend(c, x)Add additional breakpoints and coefficients to the polynomial.
from_bernstein_basis(bp[, extrapolate])Construct a piecewise polynomial in the power basis from a polynomial in Bernstein basis.
from_spline(tck[, extrapolate])Construct a piecewise polynomial from a spline
integrate(a, b[, extrapolate])Compute a definite integral over a piecewise polynomial.
roots([discontinuity, extrapolate])Find real roots of the piecewise polynomial.
solve([y, discontinuity, extrapolate])Find real solutions of the equation
pp(x) == y.Attributes
cxextrapolateaxis