keisoku

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_iWeight w_if(x_i)
1-0.273481050.507929480.96283655
2-0.822951450.280647460.6800603
3-1.380258540.083810040.18938698
4-1.951787990.01288031-0.37184121
5-2.546202160.00093228-0.82792956
6-3.176999162.711860e-5-0.99937326
7-3.86944792.320981e-7-0.74660296
8-4.688738942.654807e-10-0.02364784
94.688738942.654807e-10-0.02364784
103.86944792.320981e-7-0.74660296
113.176999162.711860e-5-0.99937326
122.546202160.00093228-0.82792956
131.951787990.01288031-0.37184121
141.380258540.083810040.18938698
150.822951450.280647460.6800603
160.273481050.507929480.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

  1. Home
  2. Gauss-Hermite Quadrature Calculator