MCPcopy Create free account
hub / github.com/numpy/numpy / legder

Function legder

numpy/polynomial/legendre.py:612–701  ·  view source on GitHub ↗

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

(c, m=1, scl=1, axis=0)

Source from the content-addressed store, hash-verified

610
611
612def legder(c, m=1, scl=1, axis=0):
613 """
614 Differentiate a Legendre series.
615
616 Returns the Legendre series coefficients `c` differentiated `m` times
617 along `axis`. At each iteration the result is multiplied by `scl` (the
618 scaling factor is for use in a linear change of variable). The argument
619 `c` is an array of coefficients from low to high degree along each
620 axis, e.g., [1,2,3] represents the series ``1*L_0 + 2*L_1 + 3*L_2``
621 while [[1,2],[1,2]] represents ``1*L_0(x)*L_0(y) + 1*L_1(x)*L_0(y) +
622 2*L_0(x)*L_1(y) + 2*L_1(x)*L_1(y)`` if axis=0 is ``x`` and axis=1 is
623 ``y``.
624
625 Parameters
626 ----------
627 c : array_like
628 Array of Legendre series coefficients. If c is multidimensional the
629 different axis correspond to different variables with the degree in
630 each axis given by the corresponding index.
631 m : int, optional
632 Number of derivatives taken, must be non-negative. (Default: 1)
633 scl : scalar, optional
634 Each differentiation is multiplied by `scl`. The end result is
635 multiplication by ``scl**m``. This is for use in a linear change of
636 variable. (Default: 1)
637 axis : int, optional
638 Axis over which the derivative is taken. (Default: 0).
639
640 .. versionadded:: 1.7.0
641
642 Returns
643 -------
644 der : ndarray
645 Legendre series of the derivative.
646
647 See Also
648 --------
649 legint
650
651 Notes
652 -----
653 In general, the result of differentiating a Legendre series does not
654 resemble the same operation on a power series. Thus the result of this
655 function may be "unintuitive," albeit correct; see Examples section
656 below.
657
658 Examples
659 --------
660 >>> from numpy.polynomial import legendre as L
661 >>> c = (1,2,3,4)
662 >>> L.legder(c)
663 array([ 6., 9., 20.])
664 >>> L.legder(c, 3)
665 array([60.])
666 >>> L.legder(c, scl=-1)
667 array([ -6., -9., -20.])
668 >>> L.legder(c, 2,-1)
669 array([ 9., 60.])

Callers 1

leggaussFunction · 0.85

Calls 2

normalize_axis_indexFunction · 0.90
astypeMethod · 0.80

Tested by

no test coverage detected