numpy 1.22.4 Pypi GitHub Homepage
Other Docs
ParametersBackRef
polyint(p, m=1, k=None)
note

This forms part of the old polynomial API. Since version 1.4, the new polynomial API defined in :None:None:`numpy.polynomial` is preferred. A summary of the differences can be found in the :None:doc:`transition guide </reference/routines.polynomials>`.

The returned order m antiderivative :None:None:`P` of polynomial p satisfies $\frac{d^m}{dx^m}P(x) = p(x)$ and is defined up to :None:None:`m - 1` integration constants k. The constants determine the low-order polynomial part

$$\frac{k_{m-1}}{0!} x^0 + \ldots + \frac{k_0}{(m-1)!}x^{m-1}$$

of :None:None:`P` so that $P^{(j)}(0) = k_{m-j-1}$ .

Parameters

p : array_like or poly1d

Polynomial to integrate. A sequence is interpreted as polynomial coefficients, see poly1d .

m : int, optional

Order of the antiderivative. (Default: 1)

k : list of `m` scalars or scalar, optional

Integration constants. They are given in the order of integration: those corresponding to highest-order terms come first.

If None (default), all constants are assumed to be zero. If :None:None:`m = 1`, a single scalar can be given instead of a list.

Return an antiderivative (indefinite integral) of a polynomial.

See Also

poly1d.integ

equivalent method

polyder

derivative of a polynomial

Examples

The defining property of the antiderivative:

>>> p = np.poly1d([1,1,1])
... P = np.polyint(p)
... P poly1d([ 0.33333333, 0.5 , 1. , 0. ]) # may vary
>>> np.polyder(P) == p
True

The integration constants default to zero, but can be specified:

>>> P = np.polyint(p, 3)
... P(0) 0.0
>>> np.polyder(P)(0)
0.0
>>> np.polyder(P, 2)(0)
0.0
>>> P = np.polyint(p, 3, k=[6,5,3])
... P poly1d([ 0.01666667, 0.04166667, 0.16666667, 3. , 5. , 3. ]) # may vary

Note that 3 = 6 / 2!, and that the constants are given in the order of integrations. Constant of the highest-order polynomial term comes first:

>>> np.polyder(P, 2)(0)
6.0
>>> np.polyder(P, 1)(0)
5.0
>>> P(0)
3.0
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

numpy.polymul numpy.polyder numpy.polydiv numpy.polyadd numpy.polynomial.polynomial.polyder numpy.lib.polynomial.poly1d.integ

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /numpy/lib/polynomial.py#267
type: <class 'function'>
Commit: