scipy.special.eval_laguerre#

scipy.special.eval_laguerre(n, x, out=None) = <wrapped_ufunc 'eval_laguerre'>#

Evaluate Laguerre polynomial at a point.

The Laguerre polynomials can be defined via the confluent hypergeometric function \({}_1F_1\) as

\[L_n(x) = {}_1F_1(-n, 1, x).\]

See 22.5.16 and 22.5.54 in [AS] (or equivalently [DLMF1] and [DLMF2]) for details. When \(n\) is an integer the result is a polynomial of degree \(n\).

Parameters:
narray_like

Degree of the polynomial. If not an integer the result is determined via the relation to the confluent hypergeometric function.

xarray_like

Points at which to evaluate the Laguerre polynomial

outndarray, optional

Optional output array for the function values

Returns:
Lscalar or ndarray

Values of the Laguerre polynomial

See also

roots_laguerre

roots and quadrature weights of Laguerre polynomials

laguerre

Laguerre polynomial object

numpy.polynomial.laguerre.Laguerre

Laguerre series

eval_genlaguerre

evaluate generalized Laguerre polynomials

Notes

Array API Standard Support

eval_laguerre has support for Python Array API Standard compatible backends in addition to NumPy. The following combinations of backend and device (or other capability) are supported.

Library

CPU

GPU

NumPy

✅

n/a

CuPy

n/a

⛔

PyTorch

✅

✅

JAX

✅

⛔

Dask

✅

n/a

For the NumPy backend, this function supports all NumPy ufunc keyword arguments. Other backends may support out, but typically none of the other ufunc kwargs. out is typically supported for CuPy and PyTorch, but not currently in cases where SciPy relies on a generic Array API implementation or, for PyTorch on CPU, falls back to the NumPy backend. out is never supported for JAX because JAX arrays are immutable.

With PyTorch, noninteger values of the degree n are cast to integers before evaluation.

See Array API coverage for more information.

References

[AS]

Milton Abramowitz and Irene A. Stegun, eds. Handbook of Mathematical Functions with Formulas, Graphs, and Mathematical Tables. New York: Dover, 1972.

[DLMF1]

NIST Digital Library of Mathematical Functions, https://dlmf.nist.gov/18.1#I1.ix7.p1

[DLMF2]

NIST Digital Library of Mathematical Functions, https://dlmf.nist.gov/18.5.E12

Examples

>>> import numpy as np
>>> from scipy.special import eval_laguerre
>>> import matplotlib.pyplot as plt

Evaluate the order 3 polynomial at a few values of x.

>>> eval_laguerre(3, [0, 0.25, 0.5])
array([ 1.        ,  0.34114583, -0.14583333])

Plot the polynomials of order 0 through 4.

>>> x = np.linspace(0.0, 8.0, 800)
>>> fig, ax = plt.subplots(1, 1, constrained_layout=True)
>>> for n in range(5):
...     y = eval_laguerre(n, x)
...     ax.plot(x, y, label=f'{n = }')
>>> ax.grid()
>>> ax.set_title("Laguerre Polynomials")
>>> ax.set_xlabel("$x$")
>>> ax.set_ylabel("$L_n(x)$")
>>> ax.legend(loc='upper left', bbox_to_anchor=(1, 1), shadow=True)
>>> plt.show()
../../_images/scipy-special-eval_laguerre-1.png