y
=
f(x)
- Parameters:
- x : ndarray, shape (npoints, )
A 1-D array of monotonically increasing real values. x cannot
include duplicate values (otherwise f is overspecified)
- y : ndarray, shape (…, npoints, …)
An N-D array of real values. y’s length along the interpolation
axis must be equal to the length of x. Use the axis
parameter to select the interpolation axis.
- axis : int, optional
Axis in the y array corresponding to the x-coordinate values. Defaults
to axis=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.
See Out-of-bounds behavior.
- Attributes:
- axis
- c
- extrapolate
- x
Methods
__call__(x[, nu, extrapolate])
| Evaluate the piecewise polynomial or its derivative. |
derivative([nu])
| Construct a new piecewise polynomial representing the derivative. |
antiderivative([nu])
| Construct a new piecewise polynomial representing the antiderivative. |
integrate(a, b[, extrapolate])
| Compute a definite integral over a piecewise polynomial. |
solve([y, discontinuity, extrapolate])
| Find real solutions of the equation pp(x) == y. |
roots([discontinuity, extrapolate])
| Find real roots of the piecewise polynomial. |
Notes
The interpolator preserves monotonicity in the interpolation data and does
not overshoot if the data is not smooth.
The first derivatives are guaranteed to be continuous, but the second
derivatives may jump at xk.
Determines the derivatives at the points xk, fk′,
by using PCHIP algorithm [1].
Let hk=xk+1−xk, and dk=(yk+1−yk)/hk
are the slopes at internal points xk.
If the signs of dk and dk−1 are different or either of
them equals zero, then fk′=0. Otherwise, it is given by the
weighted harmonic mean
fk′w1+w2=dk−1w1+dkw2 where w1=2hk+hk−1 and w2=hk+2hk−1.
The end slopes are set using a one-sided scheme [2].
References