{ } Raw JSON

bundles / scipy 1.18.0 / scipy / special / _orthogonal / sh_jacobi

function

scipy.special._orthogonal:sh_jacobi

source: /scipy/special/_orthogonal.py:464

Signature

def sh_jacobi(n, p, q, monic = False)

Summary

Shifted Jacobi polynomial.

Extended Summary

Defined by

where is the nth Jacobi polynomial.

Parameters

n : int

Degree of the polynomial.

p : float

Parameter, must have .

q : float

Parameter, must be greater than 0.

monic : bool, optional

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

Returns

G : orthopoly1d

Shifted Jacobi polynomial.

Notes

For fixed , the polynomials are orthogonal over with weight function .

Examples

Evaluate the shifted Jacobi polynomial :math:`G_3^{(2, 1)}` at :math:`x = 0.5`:
import numpy as np
from scipy.special import binom, jacobi, sh_jacobi
✓
np.isclose(sh_jacobi(3, 2, 1)(0.5), -3/280)
✗
np.True_
The polynomial is related to the Jacobi polynomial :math:`P_n^{(p - q, q - 1)}`:
x = np.linspace(0, 1, 5)
n, p, q = 3, 2, 1
scale = 1 / binom(2*n + p - 1, n)
np.allclose(sh_jacobi(n, p, q)(x),
            scale * jacobi(n, p - q, q - 1)(2*x - 1))
✓
True
Plot :math:`G_3^{(p, 1)}` for several values of :math:`p`:
import matplotlib.pyplot as plt
x = np.linspace(0, 1, 400)
fig, ax = plt.subplots()
✓
for p in [1, 2, 3]:
    ax.plot(x, sh_jacobi(3, p, 1)(x), label=rf"$p={p}$")
ax.set_title(r"Shifted Jacobi polynomials $G_3^{(p, 1)}$")
ax.set_xlabel("x")
ax.legend(loc="best")
✗
<matplotlib.legend.Legend object at 0x7fa8e4f0ae40>
plt.show()
✓
fig-0bb13d43fc29fb21.png

Aliases

  • scipy.special.sh_jacobi