numpy 1.22.4 Pypi GitHub Homepage
Other Docs
NotesParametersRaisesReturns
polyint(c, m=1, k=[], lbnd=0, scl=1, axis=0)

Returns the polynomial coefficients c integrated m times from :None:None:`lbnd` along :None:None:`axis`. At each iteration the resulting series is multiplied by :None:None:`scl` and an integration constant, k, is added. The scaling factor is for use in a linear change of variable. ("Buyer beware": note that, depending on what one is doing, one may want :None:None:`scl` to be the reciprocal of what one might expect; for more information, see the Notes section below.) The argument c is an array of coefficients, from low to high degree along each axis, e.g., [1,2,3] represents the polynomial 1 + 2*x + 3*x**2 while [[1,2],[1,2]] represents 1 + 1*x + 2*y + 2*x*y if axis=0 is x and axis=1 is y .

Notes

Note that the result of each integration is multiplied by :None:None:`scl`. Why is this important to note? Say one is making a linear change of variable $u = ax + b$ in an integral relative to x. Then $dx = du/a$ , so one will need to set :None:None:`scl` equal to $1/a$ - perhaps not what one would have first thought.

Parameters

c : array_like

1-D array of polynomial coefficients, ordered from low to high.

m : int, optional

Order of integration, must be positive. (Default: 1)

k : {[], list, scalar}, optional

Integration constant(s). The value of the first integral at zero is the first value in the list, the value of the second integral at zero is the second value, etc. If k == [] (the default), all constants are set to zero. If m == 1 , a single scalar can be given instead of a list.

lbnd : scalar, optional

The lower bound of the integral. (Default: 0)

scl : scalar, optional

Following each integration the result is multiplied by :None:None:`scl` before the integration constant is added. (Default: 1)

axis : int, optional

Axis over which the integral is taken. (Default: 0).

versionadded

Raises

ValueError

If m < 1 , len(k) > m , np.ndim(lbnd) != 0 , or np.ndim(scl) != 0 .

Returns

S : ndarray

Coefficient array of the integral.

Integrate a polynomial.

See Also

polyder

Examples

>>> from numpy.polynomial import polynomial as P
... c = (1,2,3)
... P.polyint(c) # should return array([0, 1, 1, 1]) array([0., 1., 1., 1.])
>>> P.polyint(c,3) # should return array([0, 0, 0, 1/6, 1/12, 1/20])
 array([ 0.        ,  0.        ,  0.        ,  0.16666667,  0.08333333, # may vary
         0.05      ])
>>> P.polyint(c,k=3) # should return array([3, 1, 1, 1])
array([3.,  1.,  1.,  1.])
>>> P.polyint(c,lbnd=-2) # should return array([6, 1, 1, 1])
array([6.,  1.,  1.,  1.])
>>> P.polyint(c,scl=-2) # should return array([0, -2, -2, -2])
array([ 0., -2., -2., -2.])
See :

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/polynomial/polynomial.py#545
type: <class 'function'>
Commit: