numpy.polynomial.legendre.legder#
- polynomial.legendre.legder(c, m=1, scl=1, axis=0)[source]#
Differentiate a Legendre series.
Returns the Legendre series coefficients c differentiated m times along axis. At each iteration the result is multiplied by scl (the scaling factor is for use in a linear change of variable). The argument c is an array of coefficients from low to high degree along each axis, e.g., [1,2,3] represents the series
1*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
Number of derivatives taken, must be non-negative. (Default: 1)
- sclscalar, optional
Each differentiation is multiplied by scl. The end result is multiplication by
scl**m
. This is for use in a linear change of variable. (Default: 1)- axisint, optional
Axis over which the derivative is taken. (Default: 0).
- Returns:
- derndarray
Legendre series of the derivative.
See also
Notes
In general, the result of differentiating a Legendre series does not resemble the same operation on a power series. Thus the result of this function may be “unintuitive,” albeit correct; see Examples section below.
Examples
>>> from numpy.polynomial import legendre as L >>> c = (1,2,3,4) >>> L.legder(c) array([ 6., 9., 20.]) >>> L.legder(c, 3) array([60.]) >>> L.legder(c, scl=-1) array([ -6., -9., -20.]) >>> L.legder(c, 2,-1) array([ 9., 60.])