This is a pre-release version (2.0.0.dev0+git20260907.41eeb59).Go to latest (1.18.0)
{ } Raw JSON

bundles / scipy 2.0.0.dev0+git20260907.41eeb59 / scipy / special / _multiufuncs / assoc_legendre_p

MultiUFunc

scipy.special._multiufuncs:assoc_legendre_p

source: build-install/usr/lib/python3.14/site-packages/scipy/special/_multiufuncs.py

Signature

def assoc_legendre_p(n, m, z, *, branch_cut = 2, norm = False, diff_n = 0)

Summary

Associated Legendre polynomial of the first kind.

Extended Summary

Defined as

where is the Legendre polynomial.

This definition includes the Condon-Shortley phase .

Parameters

n : array_like of ints

Degree of the associated Legendre polynomial. Must have n >= 0.

m : array_like of ints

Order of the associated Legendre polynomial.

z : array_like

Input value.

branch_cut : array_like of ints, optional

Selects branch cut. Must be 2 (default) or 3. 2: cut on the real axis |z| > 1 3: cut on the real axis -1 < z < 1

norm : bool, optional

If True, compute the normalized associated Legendre polynomial. Default is False.

diff_n : int, 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_n derivatives.

Notes

The normalized counterpart of an (unnormalized) associated Legendre polynomial has the additional factor

Examples

Evaluate :math:`P_2^1(z)` on :math:`[-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

Aliases

  • scipy.special.assoc_legendre_p

Referenced by