keisoku

Gauss-Jacobi Quadrature Calculator

Enter an integrand f(x), the order n, and the weight exponents α and β to evaluate ∫₋₁¹ f(x)(1−x)^α(1+x)^β dx by Gauss-Jacobi quadrature. Nodes and weights are computed with the Golub-Welsch method (eigendecomposition of a tridiagonal matrix).

Input

Enter the integrand f(x), the order n, and the weight exponents α and β to evaluate ∫₋₁¹ f(x)(1−x)^α(1+x)^β dx by Gauss-Jacobi quadrature.

e.g. cos(x), 1/(2-x), x^2 + 1. See the method for available functions, constants and operators. The weight (1−x)^α(1+x)^β is applied automatically.

Number of nodes (1–256)

Exponent of the weight (1−x)^α (α > −1)

Exponent of the weight (1+x)^β (β > −1)

Result

Integral ∫ f(x)(1−x)^α(1+x)^β dx

1.3824596874

Weight (1−x)^(α=0.5) (1+x)^(β=0.5) on [−1, 1]

Order n

8

Number of nodes

8

Zeroth moment μ₀

1.57079633

Nodes, weights and function values

Shows the nodes x_i on [−1, 1], the quadrature weights w_i (which include (1−x)^α(1+x)^β), and the function values f(x_i).

#Node x_iWeight w_if(x_i)
1-0.939692620.040832950.59003622
2-0.766044440.14422560.72065865
3-0.50.261799390.87758256
4-0.173648180.338540230.984961
50.173648180.338540230.984961
60.50.261799390.87758256
70.766044440.14422560.72065865
80.939692620.040832950.59003622

How it works

  • Gauss-Jacobi quadrature approximates the weighted definite integral ∫₋₁¹ f(x)(1−x)^α(1+x)^β dx over [−1, 1] as Σ w_i f(x_i) using n nodes x_i and weights w_i. The weight is integrable only when α > −1 and β > −1.
  • The nodes x_i are the zeros of the Jacobi polynomial P_n^{(α,β)}(x) and the w_i are the corresponding quadrature weights. This tool builds the symmetric tridiagonal Jacobi matrix from the three-term recurrence coefficients and applies the Golub-Welsch method: the eigenvalues give the nodes, and the squared first components of the eigenvectors give the weights. The eigendecomposition uses implicit-shift QL iteration.
  • An n-point rule is exact for any polynomial f(x) of degree up to 2n−1. For integrals whose weight introduces endpoint singularities through α and β, this rule is far more accurate than equally spaced formulas.
  • Special cases: α=β=0 reduces to Gauss-Legendre, α=β=−1/2 to Chebyshev-Gauss (first kind), and α=β=1/2 to Chebyshev-Gauss (second kind).
  • The integrand f(x) is evaluated safely by a recursive-descent parser (no eval). It supports functions such as sin, cos, tan, exp, log, ln, sqrt, abs, the constants pi and e, the four arithmetic operators, exponentiation ^, and implicit multiplication (e.g. 2x, 3(x+1)). The only variable is x.

Reviews

Tell us what you think of this calculator.

Write a review

  1. Home
  2. Gauss-Jacobi Quadrature Calculator