bundles / scipy 2.0.0.dev0+git20260907.41eeb59 / scipy / special / _multiufuncs / legendre_p
MultiUFunc
scipy.special._multiufuncs:legendre_p
source: build-install/usr/lib/python3.14/site-packages/scipy/special/_multiufuncs.py
Signature
def legendre_p(n, z, *, diff_n = 0)Summary
Legendre polynomial of the first kind.
Parameters
n: array_like of intsDegree of the Legendre polynomial. Must have
n >= 0.z: array_likeInput value.
diff_n: int, optionalA non-negative integer. Compute and return all derivatives up to order
diff_n. Default is 0.
Returns
p: ndarray or tuple of ndarrayLegendre polynomial with
diff_nderivatives.
Examples
Evaluate the Legendre polynomial :math:`P_3` at :math:`z = 0.5`:import numpy as np from scipy.special import legendre_p np.allclose(legendre_p(3, 0.5), -0.4375)✓
TrueCompute the value and first derivative with respect to ``z``:
p, dp = legendre_p(3, 0.5, diff_n=1) np.allclose([p, dp], [-0.4375, 0.375])✓
True
See also
Aliases
scipy.special.legendre_p