Gaussian Quadrature Calculator
Numerically evaluate definite integrals with Gauss quadrature: Legendre, Chebyshev, Laguerre, or Hermite. Enter f(x) and the order to get the integral plus nodes and weights.
Input
Enter the integrand f(x), a quadrature rule, and the order to numerically evaluate the integral by Gaussian quadrature.
e.g. exp(-x^2), sin(x)/x, 2x+1. Supports functions like sin, cos, tan, exp, log, ln, sqrt, abs, the constants pi and e, and implicit multiplication.
Quadrature rule
Gauss-Legendre (interval [a, b])
Computes ∫ₐᵇ f(x) dx (weight function w(x)=1).
An integer from 1 to 64. Larger values give higher accuracy.
Result
Integral value (approx.)
0.7468241268
Rule
Gauss-Legendre (interval [a, b])
Order n
5
Nodes and weights
| i | Node xᵢ | Weight wᵢ |
|---|---|---|
| 1 | 0.046910077 | 0.2369268851 |
| 2 | 0.2307653449 | 0.4786286705 |
| 3 | 0.5 | 0.5688888889 |
| 4 | 0.7692346551 | 0.4786286705 |
| 5 | 0.953089923 | 0.2369268851 |
How it works
- Gaussian quadrature approximates an integral by evaluating the integrand at the roots (nodes) of an order-n orthogonal polynomial and summing the values weighted by the corresponding weights. An n-point rule integrates polynomials up to degree 2n-1 exactly.
- The Legendre rule uses weight function w(x)=1 and maps any interval [a,b] onto [-1,1] to compute ∫ f(x) dx.
- The Chebyshev rule uses weight function w(x)=1/√(1-x²) on [-1,1] and computes ∫ f(x)/√(1-x²) dx; its nodes and weights have closed-form expressions.
- The Laguerre rule uses weight w(x)=e^(-x) on [0,∞) to compute ∫ e^(-x) f(x) dx, and the Hermite rule uses weight w(x)=e^(-x²) on (-∞,∞) to compute ∫ e^(-x²) f(x) dx.
- Nodes and weights are obtained as the eigenvalues and eigenvectors of the tridiagonal matrix built from the three-term recurrence coefficients (independent implementation). f(x) is parsed by a built-in expression parser supporting functions such as sin, cos, exp, log, sqrt, the constants π and e, and implicit multiplication (e.g. 2x).
- Results are numerical approximations. Errors may appear depending on the integrand and the chosen order.
Reviews
Tell us what you think of this calculator.
Write a review
- Home
Gaussian Quadrature Calculator