Skip to main content

roots_gengegenbauer

Function roots_gengegenbauer 

Source
pub fn roots_gengegenbauer(n: usize, p: f64, q: f64) -> (Vec<f64>, Vec<f64>)
Expand description

Gauss-Jacobi quadrature for the generalized Gegenbauer polynomials

Corresponds to scipy.special.roots_sh_jacobi, which, despite its name, isn’t roots_sh_jacobi (see eval_gengegenbauer).

The nodes are the roots of $G_n^{(p,q)}$, and the rule is exact for polynomials of degree $2n - 1$ with the weight function $(1 - x)^{p-q} x^{q-1}$ on $[0, 1]$ (A&S 22.2.2).

For small $q$, the nodes and weights have relative errors up to about $2^{-54} / q$, from the rounding of $q - 1$ (also in SciPy).

§Panics

  • if n is zero
  • if $p - q \le -1$ or $q \le 0$, or if $q - 1$ rounds to $-1$ (for $q < 2^{-54}$)

§See also