numpy.polynomial.legendre.legint¶

numpy.polynomial.legendre.
legint
(c, m=1, k=[], lbnd=0, scl=1, axis=0)[source]¶ Integrate a Legendre series.
Returns the Legendre series 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 series
L_0 + 2*L_1 + 3*L_2
while [[1,2],[1,2]] represents1*L_0(x)*L_0(y) + 1*L_1(x)*L_0(y) + 2*L_0(x)*L_1(y) + 2*L_1(x)*L_1(y)
if axis=0 isx
and axis=1 isy
. Parameters
 carray_like
Array of Legendre series coefficients. If c is multidimensional the different axis correspond to different variables with the degree in each axis given by the corresponding index.
 mint, optional
Order of integration, must be positive. (Default: 1)
 k{[], list, scalar}, optional
Integration constant(s). The value of the first integral at
lbnd
is the first value in the list, the value of the second integral atlbnd
is the second value, etc. Ifk == []
(the default), all constants are set to zero. Ifm == 1
, a single scalar can be given instead of a list. lbndscalar, optional
The lower bound of the integral. (Default: 0)
 sclscalar, optional
Following each integration the result is multiplied by scl before the integration constant is added. (Default: 1)
 axisint, optional
Axis over which the integral is taken. (Default: 0).
New in version 1.7.0.
 Returns
 Sndarray
Legendre series coefficient array of the integral.
 Raises
 ValueError
If
m < 0
,len(k) > m
,np.ndim(lbnd) != 0
, ornp.ndim(scl) != 0
.
See also
Notes
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.
Also note that, in general, the result of integrating a Cseries needs to be “reprojected” onto the Cseries basis set. Thus, typically, the result of this function is “unintuitive,” albeit correct; see Examples section below.
Examples
>>> from numpy.polynomial import legendre as L >>> c = (1,2,3) >>> L.legint(c) array([ 0.33333333, 0.4 , 0.66666667, 0.6 ]) # may vary >>> L.legint(c, 3) array([ 1.66666667e02, 1.78571429e02, 4.76190476e02, # may vary 1.73472348e18, 1.90476190e02, 9.52380952e03]) >>> L.legint(c, k=3) array([ 3.33333333, 0.4 , 0.66666667, 0.6 ]) # may vary >>> L.legint(c, lbnd=2) array([ 7.33333333, 0.4 , 0.66666667, 0.6 ]) # may vary >>> L.legint(c, scl=2) array([ 0.66666667, 0.8 , 1.33333333, 1.2 ]) # may vary