bundles / scipy 1.17.1 / scipy / interpolate / _interpolate / BPoly
class
scipy.interpolate._interpolate:BPoly
Signature
class BPoly ( c , x , extrapolate = None , axis = 0 ) Members
-
_construct_from_derivatives -
_evaluate -
_raise_degree -
antiderivative -
derivative -
extend -
from_derivatives -
from_power_basis -
integrate
Summary
Piecewise polynomial in the Bernstein basis.
Extended Summary
The polynomial between x[i] and 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) = binom(k, a) * t**a * (1 - t)**(k - a),with t = (x - x[i]) / (x[i+1] - x[i]) and binom is the binomial coefficient.
Parameters
c: ndarray, shape (k, m, ...)Polynomial coefficients, order
kandmintervalsx: ndarray, shape (m+1,)Polynomial breakpoints. Must be sorted in either increasing or decreasing order.
extrapolate: bool, optionalIf 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. Default is True.
axis: int, optionalInterpolation axis. Default is zero.
Attributes
x: ndarrayBreakpoints.
c: ndarrayCoefficients of the polynomials. They are reshaped to a 3-D array with the last dimension representing the trailing dimensions of the original coefficient array.
axis: intInterpolation axis.
Methods
__call__extendderivativeantiderivativeintegrateconstruct_fastfrom_power_basisfrom_derivatives
Notes
Properties of Bernstein polynomials are well documented in the literature, see for example [1] [2] [3].
Array API Standard Support
BPoly has experimental support for Python Array API Standard compatible backends in addition to NumPy. Please consider testing these features by setting an environment variable SCIPY_ARRAY_API=1 and providing CuPy, PyTorch, JAX, or Dask arrays as array arguments. The following combinations of backend and device (or other capability) are supported.
==================== ==================== ==================== Library CPU GPU ==================== ==================== ==================== NumPy ✅ n/a CuPy n/a ⛔ PyTorch ✅ ⛔ JAX ⚠️ no JIT ⛔ Dask ⛔ n/a ==================== ==================== ====================
See
dev-arrayapifor more information.
Examples
from scipy.interpolate import BPoly x = [0, 1] c = [[1], [2], [3]] bp = BPoly(c, x)✓
See also
- PPoly
piecewise polynomials in the power basis
Aliases
-
scipy.interpolate.BPoly