Calculator · Engineering Mathematics
Gaussian Quadrature Calculator
Approximate a definite integral with an m-point Gauss-Legendre rule mapped from [-1, 1] onto [a, b]. With nodes and weights both chosen optimally, m evaluations integrate any polynomial of degree up to 2m − 1 exactly.
Problem definition
Operators + − * / ^, parentheses, pi and e, and sin, cos, tan, asin, acos, atan, exp, sqrt, abs, ln, log, log10. Write 2*x, not 2x.
Order m (number of points)
Results
| Integral estimate Q | 2.00000011 |
|---|---|
| Interval [a, b] | [0, 3.142] |
| Order m (points) | 5 |
| Function evaluations | 5 |
| Exact for polynomials of degree | ≤ 9 |
Integrand and nodes
Nodes and weights
| i | xᵢ | f(xᵢ) | reference weight on [-1, 1] | weight wᵢ | wᵢ·f(xᵢ) |
|---|---|---|---|---|---|
| 0 | 0.1474 | 0.1468 | 0.2369 | 0.3722 | 0.05465 |
| 1 | 0.725 | 0.6631 | 0.4786 | 0.7518 | 0.4985 |
| 2 | 1.571 | 1 | 0.5689 | 0.8936 | 0.8936 |
| 3 | 2.417 | 0.6631 | 0.4786 | 0.7518 | 0.4985 |
| 4 | 2.994 | 0.1468 | 0.2369 | 0.3722 | 0.05465 |
Continue
f(x), the interval and the order continue into the Lab with the Gauss-Legendre sweep enabled and ending at that order. No reference integral is carried over.
Assumptions & validity
- · The interval is finite and f is finite at every node; a non-finite node value is a reported failure.
- · The degree-of-exactness statement applies to POLYNOMIALS only. For any other integrand it is an accuracy heuristic, not a guarantee.
- · Nodes are strictly interior, so a finite integrand with an awkward endpoint is still evaluated — but this is not an improper-integral solver and makes no claim about singular integrands.
- · Convergence with increasing m is fast for analytic integrands and can be slow when f has a singularity near the interval in the complex plane.
- · a > b returns the correct negative integral; a = b returns exactly zero without evaluating f.
- · Orders 2 to 8 only, from tabulated nodes and weights.
Technical reference
Affine map: x(t) = ((b − a) t + (a + b)) / 2, t ∈ [-1, 1]
∫ₐᵇ f(x) dx = ((b − a)/2) ∫₋₁¹ f(x(t)) dt
Gₘ = Σᵢ₌₁ᵐ wᵢ f(xᵢ), with wᵢ = ((b − a)/2) ŵᵢ
Degree of exactness: Gₘ = I for every polynomial of degree ≤ 2m − 1 (mathematically exact; reproduced here up to floating-point arithmetic)
- m
- number of Gauss points (the order)
- tᵢ, ŵᵢ
- reference nodes and weights on [-1, 1]
- xᵢ, wᵢ
- nodes and weights mapped onto [a, b]
- Gₘ
- the m-point Gauss-Legendre estimate
Gauss rules choose the node POSITIONS as well as the weights, which is why m evaluations buy degree 2m − 1 exactness, against degree 1 for the trapezoidal rule and 3 for Simpson at comparable cost.
The reference nodes are the roots of the degree-m Legendre polynomial. This tool uses explicit tabulated values for orders 2 to 8 rather than generating them at run time.
No node lies on an endpoint, so an integrand that is merely awkward at a or b is still sampled. That property does not make the rule suitable for genuinely singular or improper integrals.
Accuracy for non-polynomial integrands depends on how well f is approximated by polynomials on the interval; an analytic f converges extremely fast with m, while a kinked f barely improves.
Because there is no subdivision, refinement here means raising m, not shrinking a step. Beyond order 8 the right move is usually to split the interval instead.
The mapped weights sum to b − a mathematically — the rule integrating a constant correctly — up to floating-point rounding in the implementation, which makes the weight column a useful sanity check on the node table.