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

Function legint

numpy/polynomial/legendre.py:704–829  ·  view source on GitHub ↗

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 chang

(c, m=1, k=[], lbnd=0, scl=1, axis=0)

Source from the content-addressed store, hash-verified

702
703
704def legint(c, m=1, k=[], lbnd=0, scl=1, axis=0):
705 """
706 Integrate a Legendre series.
707
708 Returns the Legendre series coefficients `c` integrated `m` times from
709 `lbnd` along `axis`. At each iteration the resulting series is
710 **multiplied** by `scl` and an integration constant, `k`, is added.
711 The scaling factor is for use in a linear change of variable. ("Buyer
712 beware": note that, depending on what one is doing, one may want `scl`
713 to be the reciprocal of what one might expect; for more information,
714 see the Notes section below.) The argument `c` is an array of
715 coefficients from low to high degree along each axis, e.g., [1,2,3]
716 represents the series ``L_0 + 2*L_1 + 3*L_2`` while [[1,2],[1,2]]
717 represents ``1*L_0(x)*L_0(y) + 1*L_1(x)*L_0(y) + 2*L_0(x)*L_1(y) +
718 2*L_1(x)*L_1(y)`` if axis=0 is ``x`` and axis=1 is ``y``.
719
720 Parameters
721 ----------
722 c : array_like
723 Array of Legendre series coefficients. If c is multidimensional the
724 different axis correspond to different variables with the degree in
725 each axis given by the corresponding index.
726 m : int, optional
727 Order of integration, must be positive. (Default: 1)
728 k : {[], list, scalar}, optional
729 Integration constant(s). The value of the first integral at
730 ``lbnd`` is the first value in the list, the value of the second
731 integral at ``lbnd`` is the second value, etc. If ``k == []`` (the
732 default), all constants are set to zero. If ``m == 1``, a single
733 scalar can be given instead of a list.
734 lbnd : scalar, optional
735 The lower bound of the integral. (Default: 0)
736 scl : scalar, optional
737 Following each integration the result is *multiplied* by `scl`
738 before the integration constant is added. (Default: 1)
739 axis : int, optional
740 Axis over which the integral is taken. (Default: 0).
741
742 .. versionadded:: 1.7.0
743
744 Returns
745 -------
746 S : ndarray
747 Legendre series coefficient array of the integral.
748
749 Raises
750 ------
751 ValueError
752 If ``m < 0``, ``len(k) > m``, ``np.ndim(lbnd) != 0``, or
753 ``np.ndim(scl) != 0``.
754
755 See Also
756 --------
757 legder
758
759 Notes
760 -----
761 Note that the result of each integration is *multiplied* by `scl`.

Callers

nothing calls this directly

Calls 5

normalize_axis_indexFunction · 0.90
legvalFunction · 0.85
astypeMethod · 0.80
ndimMethod · 0.80
allMethod · 0.45

Tested by

no test coverage detected