scipy.special.

jacobi#

scipy.special.jacobi(n, alpha, beta, monic=False)[source]#

Jacobi polynomial.

Defined to be the solution of

(1x2)d2dx2Pn(α,β)+(βα(α+β+2)x)ddxPn(α,β)+n(n+α+β+1)Pn(α,β)=0

for α,β>1; Pn(α,β) is a polynomial of degree n.

Parameters:
nint

Degree of the polynomial.

alphafloat

Parameter, must be greater than -1.

betafloat

Parameter, must be greater than -1.

monicbool, optional

If True, scale the leading coefficient to be 1. Default is False.

Returns:
Porthopoly1d

Jacobi polynomial.

Notes

For fixed α,β, the polynomials Pn(α,β) are orthogonal over [1,1] with weight function (1x)α(1+x)β.

References

[AS]

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

Examples

The Jacobi polynomials satisfy the recurrence relation:

Pn(α,β1)(x)Pn(α1,β)(x)=Pn1(α,β)(x)

This can be verified, for example, for α=β=2 and n=1 over the interval [1,1]:

>>> import numpy as np
>>> from scipy.special import jacobi
>>> x = np.arange(-1.0, 1.0, 0.01)
>>> np.allclose(jacobi(0, 2, 2)(x),
...             jacobi(1, 2, 1)(x) - jacobi(1, 1, 2)(x))
True

Plot of the Jacobi polynomial P5(α,0.5) for different values of α:

>>> import matplotlib.pyplot as plt
>>> x = np.arange(-1.0, 1.0, 0.01)
>>> fig, ax = plt.subplots()
>>> ax.set_ylim(-2.0, 2.0)
>>> ax.set_title(r'Jacobi polynomials $P_5^{(\alpha, -0.5)}$')
>>> for alpha in np.arange(0, 4, 1):
...     ax.plot(x, jacobi(5, alpha, -0.5)(x), label=rf'$\alpha={alpha}$')
>>> plt.legend(loc='best')
>>> plt.show()
../../_images/scipy-special-jacobi-1.png