package scipy

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type tag = [
  1. | `NdPPoly
]
type t = [ `NdPPoly | `Object ] Obj.t
val of_pyobject : Py.Object.t -> t
val to_pyobject : [> tag ] Obj.t -> Py.Object.t
val create : ?extrapolate:bool -> c:[> `Ndarray ] Np.Obj.t -> x:Py.Object.t -> unit -> t

Piecewise tensor product polynomial

The value at point ``xp = (x', y', z', ...)`` is evaluated by first computing the interval indices `i` such that::

x0i[0] <= x' < x0i[0]+1 x1i[1] <= y' < x1i[1]+1 ...

and then computing::

S = sum(ck0-m0-1,...,kn-mn-1,i[0],...,i[n] * (xp0 - x0i[0])**m0 * ... * (xpn - xni[n])**mn for m0 in range(k0+1) ... for mn in range(kn+1))

where ``kj`` is the degree of the polynomial in dimension j. This representation is the piecewise multivariate power basis.

Parameters ---------- 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.

Attributes ---------- x : tuple of ndarrays Breakpoints. c : ndarray Coefficients of the polynomials.

Methods ------- __call__ construct_fast

See also -------- PPoly : piecewise polynomials in 1D

Notes ----- High-order polynomials in the power basis can be numerically unstable.

val antiderivative : nu:Py.Object.t -> [> tag ] Obj.t -> Py.Object.t

Construct a new piecewise polynomial representing the antiderivative.

Antiderivative is also the indefinite integral of the function, and derivative is its inverse operation.

Parameters ---------- nu : ndim-tuple of int Order of derivatives to evaluate for each dimension. If negative, the derivative is returned.

Returns ------- pp : PPoly Piecewise polynomial of order k2 = k + n representing the antiderivative of this polynomial.

Notes ----- The antiderivative returned by this function is continuous and continuously differentiable to order n-1, up to floating point rounding error.

val construct_fast : ?extrapolate:Py.Object.t -> c:Py.Object.t -> x:Py.Object.t -> [> tag ] Obj.t -> Py.Object.t

Construct the piecewise polynomial without making checks.

Takes the same parameters as the constructor. Input arguments ``c`` and ``x`` must be arrays of the correct shape and type. The ``c`` array can only be of dtypes float and complex, and ``x`` array must have dtype float.

val derivative : nu:Py.Object.t -> [> tag ] Obj.t -> Py.Object.t

Construct a new piecewise polynomial representing the derivative.

Parameters ---------- nu : ndim-tuple of int Order of derivatives to evaluate for each dimension. If negative, the antiderivative is returned.

Returns ------- pp : NdPPoly Piecewise polynomial of orders (k0 - nu0, ..., kn - nun) representing the derivative of this polynomial.

Notes ----- Derivatives are evaluated piecewise for each polynomial segment, even if the polynomial is not differentiable at the breakpoints. The polynomial intervals in each dimension are considered half-open, ``a, b)``, except for the last interval which is closed ``[a, b]``.

val integrate : ?extrapolate:bool -> ranges:Py.Object.t -> [> tag ] Obj.t -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

Compute a definite integral over a piecewise polynomial.

Parameters ---------- ranges : ndim-tuple of 2-tuples float Sequence of lower and upper bounds for each dimension, ``(a[0], b[0]), ..., (a[ndim-1], b[ndim-1])`` extrapolate : bool, optional Whether to extrapolate to out-of-bounds points based on first and last intervals, or to return NaNs.

Returns ------- ig : array_like Definite integral of the piecewise polynomial over a[0], b[0] x ... x a[ndim-1], b[ndim-1]

val integrate_1d : ?extrapolate:bool -> a:Py.Object.t -> b:Py.Object.t -> axis:int -> [> tag ] Obj.t -> Py.Object.t

Compute NdPPoly representation for one dimensional definite integral

The result is a piecewise polynomial representing the integral:

.. math::

p(y, z, ...) = \int_a^b dx\, p(x, y, z, ...)

where the dimension integrated over is specified with the `axis` parameter.

Parameters ---------- a, b : float Lower and upper bound for integration. axis : int Dimension over which to compute the 1-D integrals extrapolate : bool, optional Whether to extrapolate to out-of-bounds points based on first and last intervals, or to return NaNs.

Returns ------- ig : NdPPoly or array-like Definite integral of the piecewise polynomial over a, b. If the polynomial was 1D, an array is returned, otherwise, an NdPPoly object.

val x : t -> Py.Object.t

Attribute x: get value or raise Not_found if None.

val x_opt : t -> Py.Object.t option

Attribute x: get value as an option.

val c : t -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t

Attribute c: get value or raise Not_found if None.

val c_opt : t -> [ `ArrayLike | `Ndarray | `Object ] Np.Obj.t option

Attribute c: get value as an option.

val to_string : t -> string

Print the object to a human-readable representation.

val show : t -> string

Print the object to a human-readable representation.

val pp : Stdlib.Format.formatter -> t -> unit

Pretty-print the object to a formatter.