scipy.special.assoc_legendre_p#
- scipy.special.assoc_legendre_p(n, m, z, *, branch_cut=2, norm=False, diff_n=0) = <scipy.special._multiufuncs.MultiUFunc object>[source]#
Associated Legendre polynomial of the first kind.
Defined as
\[P_n^m(z) = (-1)^m (1 - z^2)^{m/2} \frac{d^m}{dz^m} P_n(z)\]where \(P_n\) is the Legendre polynomial.
This definition includes the Condon-Shortley phase \((-1)^m\).
- Parameters:
- narray_like of ints
Degree of the associated Legendre polynomial. Must have
n >= 0.- marray_like of ints
Order of the associated Legendre polynomial.
- zarray_like
Input value.
- branch_cutarray_like of ints, optional
Selects branch cut. Must be 2 (default) or 3. 2: cut on the real axis
|z| > 13: cut on the real axis-1 < z < 1- normbool, optional
If
True, compute the normalized associated Legendre polynomial. Default isFalse.- diff_nint, optional
A non-negative integer. Compute and return all derivatives up to order
diff_n. Default is 0.
- Returns:
- ndarray or tuple of ndarray
Associated Legendre polynomial with
diff_nderivatives.
Notes
The normalized counterpart of an (unnormalized) associated Legendre polynomial has the additional factor
\[\sqrt{\frac{(2 n + 1) (n - m)!}{2 (n + m)!}}\]Examples
Evaluate \(P_2^1(z)\) on \([-1, 1]\):
>>> import numpy as np >>> from scipy.special import assoc_legendre_p >>> z = np.linspace(-1, 1, 11) >>> expected = -3 * z * np.sqrt(1 - z**2) >>> np.allclose(assoc_legendre_p(2, 1, z), expected) True
Compute the normalized associated Legendre polynomial:
>>> scale = np.sqrt(5/12) >>> np.allclose(assoc_legendre_p(2, 1, z, norm=True), scale * expected) True