fn
legendre_polynomial_p
→Tensorlegendre_polynomial_p(x: Tensor, n: int)Legendre polynomial .
The Legendre polynomials are orthogonal on with uniform weight, and serve as the angular eigenfunctions of the Laplacian on the sphere (spherical harmonics with ) and as a basis for Gauss-Legendre quadrature.
Parameters
xTensorArgument tensor; any floating-point dtype. Customarily
evaluated on .
nintNon-negative polynomial degree.
Returns
Tensor element-wise, same shape and dtype as x.
Notes
Bonnet recurrence:
On , with boundary values
, . Raises
ValueError for n < 0.
Examples
>>> import lucid
>>> from lucid.special import legendre_polynomial_p
>>> legendre_polynomial_p(lucid.tensor([-1.0, 0.0, 0.5, 1.0]), n=3)
Tensor([-1.0000, 0.0000, -0.4375, 1.0000])