numpy.polynomial.polynomial.polyint(c, m=1, k=[], lbnd=0, scl=1, axis=0)
[source]
Integrate a polynomial.
Returns the polynomial coefficients c
integrated m
times from lbnd
along axis
. At each iteration the resulting series is multiplied by 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 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
.
Parameters: |
|
---|---|
Returns: |
|
Raises: |
|
See also
Note that the result of each integration is multiplied by scl
. Why is this important to note? Say one is making a linear change of variable in an integral relative to x
. Then , so one will need to set scl
equal to - perhaps not what one would have first thought.
>>> 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.])
© 2005–2019 NumPy Developers
Licensed under the 3-clause BSD License.
https://docs.scipy.org/doc/numpy-1.17.0/reference/generated/numpy.polynomial.polynomial.polyint.html