NdPPoly(c, x, extrapolate=None)[source]¶
Piecewise tensor product polynomial
The value at point xp = (x’, y’, z’, ...) is evaluated by first computing the interval indices i such that:
x[i] <= x' < x[i+1] x[i] <= y' < x[i+1] ...
and then computing:
S = sum(c[k0-m0-1,...,kn-mn-1,i,...,i[n]] * (xp - x[i])**m0 * ... * (xp[n] - x[n][i[n]])**mn for m0 in range(k+1) ... for mn in range(k[n]+1))
k[j]is the degree of the polynomial in dimension j. This representation is the piecewise multivariate power basis.
c : ndarray, shape (k0, ..., kn, m0, ..., mn, ...)
Polynomial coefficients, with polynomial order kj and mj+1 intervals for each dimension j.
x : ndim-tuple of ndarrays, shapes (mj+1,)
Polynomial breakpoints for each dimension. These must be sorted in increasing order.
extrapolate : bool, optional
Whether to extrapolate to out-of-bounds points based on first and last intervals, or to return NaNs. Default: True.
- piecewise polynomials in 1D
High-order polynomials in the power basis can be numerically unstable.
x (tuple of ndarrays) Breakpoints. c (ndarray) Coefficients of the polynomials.
__call__(x[, nu, extrapolate])
Evaluate the piecewise polynomial or its derivative
construct_fast(c, x[, extrapolate])
Construct the piecewise polynomial without making checks.