Gauss-Hermite Quadrature Calculator
Enter an integrand f(x) and order n to numerically evaluate ∫[-∞,∞] f(x)e^(-x²)dx by Gauss-Hermite quadrature, using the roots of the Hermite polynomial as nodes with standard weights.
Input
Enter the integrand f(x) and the order n to evaluate ∫[-∞,∞] f(x)e^(-x²)dx by Gauss-Hermite quadrature. The weight e^(-x²) is built into the rule, so do not include e^(-x²) in f(x).
e.g. cos(x), x^2, 1/(1+x^2). The weight e^(-x²) is applied automatically. See the notes for available functions and constants.
Number of nodes (1-128)
Result
Integral ∫ f(x) e^(-x²) dx
1.380388447
Interval (-∞, ∞), weight function e^(-x²)
Order n
16
Nodes
16
Nodes, weights, and function values
Roots x_i of the Hermite polynomial H_n, weights w_i, and function values f(x_i).
| # | Node x_i | Weight w_i | f(x_i) |
|---|---|---|---|
| 1 | -0.27348105 | 0.50792948 | 0.96283655 |
| 2 | -0.82295145 | 0.28064746 | 0.6800603 |
| 3 | -1.38025854 | 0.08381004 | 0.18938698 |
| 4 | -1.95178799 | 0.01288031 | -0.37184121 |
| 5 | -2.54620216 | 0.00093228 | -0.82792956 |
| 6 | -3.17699916 | 2.711860e-5 | -0.99937326 |
| 7 | -3.8694479 | 2.320981e-7 | -0.74660296 |
| 8 | -4.68873894 | 2.654807e-10 | -0.02364784 |
| 9 | 4.68873894 | 2.654807e-10 | -0.02364784 |
| 10 | 3.8694479 | 2.320981e-7 | -0.74660296 |
| 11 | 3.17699916 | 2.711860e-5 | -0.99937326 |
| 12 | 2.54620216 | 0.00093228 | -0.82792956 |
| 13 | 1.95178799 | 0.01288031 | -0.37184121 |
| 14 | 1.38025854 | 0.08381004 | 0.18938698 |
| 15 | 0.82295145 | 0.28064746 | 0.6800603 |
| 16 | 0.27348105 | 0.50792948 | 0.96283655 |
How it works
- Gauss-Hermite quadrature approximates the weighted infinite-interval integral ∫[-∞,∞] f(x)e^(-x²)dx by the finite sum Σ w_i f(x_i). The weight function e^(-x²) is built into the rule, so do not include e^(-x²) in your f(x) (e.g. to evaluate ∫ cos(x)e^(-x²)dx, enter f(x)=cos(x)).
- The nodes x_i are the n roots of the (physicists') Hermite polynomial H_n(x) of degree n. H_n is evaluated via the recurrence H_{k+1}(x)=2x H_k(x)-2k H_{k-1}(x) (with H_0=1, H_1=2x) and its roots are found by Newton's method. Since H_n is even or odd, the nodes are symmetric about the origin.
- Each weight is computed as w_i = 2^(n-1) n! √π / ( n² H_{n-1}(x_i)² ). To avoid n! overflow for large n, this tool evaluates the weights in the logarithmic domain.
- The rule integrates polynomials of degree up to 2n-1 exactly (algebraic degree 2n-1). For smooth integrands with at most exponential growth, increasing the order n improves accuracy.
- f(x) supports power ^, the four arithmetic operations, the functions sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, exp, log (=ln), log10, sqrt, cbrt, abs, and the constants pi and e. Only x may be used as a variable. Expressions are parsed by a custom recursive-descent parser, never eval.
- Order n must be an integer from 1 to 128. Note this differs from the probabilists' variant, which uses the weight e^(-x²/2).
Reviews
Tell us what you think of this calculator.
Write a review
- Home
Gauss-Hermite Quadrature Calculator