3.5.1.11. scipy.interpolate.PPoly¶
-
class
scipy.interpolate.PPoly(c, x, extrapolate=None, axis=0)[source]¶ Piecewise polynomial in terms of coefficients and breakpoints
The polynomial in the ith interval is
x[i] <= xp < x[i+1]:S = sum(c[m, i] * (xp - x[i])**(k-m) for m in range(k+1))
where
kis the degree of the polynomial. This representation is the local power basis.Parameters: c : ndarray, shape (k, m, ...)
Polynomial coefficients, order k and m intervals
x : ndarray, shape (m+1,)
Polynomial breakpoints. These must be sorted in increasing order.
extrapolate : bool, optional
Whether to extrapolate to ouf-of-bounds points based on first and last intervals, or to return NaNs. Default: True.
axis : int, optional
Interpolation axis. Default is zero.
See also
BPoly- piecewise polynomials in the Bernstein basis
Notes
High-order polynomials in the power basis can be numerically unstable. Precision problems can start to appear for orders larger than 20-30.
Attributes
x (ndarray) Breakpoints. c (ndarray) Coefficients of the polynomials. They are reshaped to a 3-dimensional array with the last dimension representing the trailing dimensions of the original coefficient array. axis (int) Interpolation axis. 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. roots([discontinuity, extrapolate])Find real roots of the piecewise polynomial. extend(c, x[, right])Add additional breakpoints and coefficients to the polynomial. from_spline(tck[, extrapolate])Construct a piecewise polynomial from a spline from_bernstein_basis(bp[, extrapolate])Construct a piecewise polynomial in the power basis from a polynomial in Bernstein basis. construct_fast(c, x[, extrapolate, axis])Construct the piecewise polynomial without making checks. -
__init__(c, x, extrapolate=None, axis=0)¶
Methods
__init__(c, x[, extrapolate, axis])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[, right])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. Attributes
axiscextrapolatex