SciPy

scipy.interpolate.PiecewisePolynomial

class scipy.interpolate.PiecewisePolynomial(xi, yi, orders=None, direction=None, axis=0)[source]

Piecewise polynomial curve specified by points and derivatives

This class represents a curve that is a piecewise polynomial. It passes through a list of points and has specified derivatives at each point. The degree of the polynomial may vary from segment to segment, as may the number of derivatives available. The degree should not exceed about thirty.

Appending points to the end of the curve is efficient.

Parameters:

xi : array_like

A sorted 1-d array of x-coordinates.

yi : array_like or list of array_likes

yi[i][j] is the j-th derivative known at xi[i] (for axis=0).

orders : list of int, or int, optional

A list of polynomial orders, or a single universal order.

direction : {None, 1, -1}, optional

Indicates whether the xi are increasing or decreasing:

+1 : increasing values

-1 : decreasing values

None : direction will be deduced from the first two elements of xi

axis : int, optional

Axis in the yi array corresponding to the x-coordinate values.

Notes

If orders is None, or orders[i] is None, then the degree of the polynomial segment is exactly the degree required to match all i available derivatives at both endpoints. If orders[i] is not None, then some derivatives will be ignored. The code will try to use an equal number of derivatives from each end; if the total number of derivatives needed is odd, it will prefer the rightmost endpoint. If not enough derivatives are available, an exception is raised.

Methods

__call__(x) Evaluate the interpolant
append(xi, yi[, order]) Append a single point with derivatives to the PiecewisePolynomial
derivative(x[, der]) Evaluate one derivative of the polynomial at the point x
derivatives(x[, der]) Evaluate many derivatives of the polynomial at the point x
extend(xi, yi[, orders]) Extend the PiecewisePolynomial by a list of points