- class scipy.interpolate.BPoly(c, x, extrapolate=None)¶
Piecewise polynomial in terms of coefficients and breakpoints
The polynomial in the i-th interval x[i] <= xp < x[i+1] is written in the Bernstein polynomial basis:
S = sum(c[a, i] * b(a, k; x) for a in range(k+1))
where k is the degree of the polynomial, and:
b(a, k; x) = comb(k, a) * t**k * (1 - t)**(k - a)
with t = (x - x[i]) / (x[i+1] - x[i]).
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.
- piecewise polynomials in the power basis
Properties of Bernstein polynomials are well documented in the literature. Here’s a non-exhaustive list:
[R32] http://en.wikipedia.org/wiki/Bernstein_polynomial [R33] Kenneth I. Joy, Bernstein polynomials, http://www.idav.ucdavis.edu/education/CAGDNotes/Bernstein-Polynomials.pdf [R34] E. H. Doha, A. H. Bhrawy, and M. A. Saker, Boundary Value Problems, vol 2011, article ID 829546, doi:10.1155/2011/829543
>>> x = [0, 1] >>> c = [, , ] >>> bp = BPoly(c, x)
This creates a 2nd order polynomial
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.
__call__(x[, nu, extrapolate]) Evaluate the piecewise polynomial or its derivative extend(c, x[, right]) Add additional breakpoints and coefficients to the polynomial. derivative([nu]) Construct a new piecewise polynomial representing the derivative. construct_fast(c, x[, extrapolate]) Construct the piecewise polynomial without making checks. from_power_basis(pp[, extrapolate]) Construct a piecewise polynomial in Bernstein basis from_derivatives(xi, yi[, orders, ...]) Construct a piecewise polynomial in the Bernstein basis,