keisoku

Gaussian Quadrature Nodes & Weights (Numerical Integration)

Compute the nodes and weights of Gaussian quadrature rules (Legendre, Chebyshev, Laguerre, Hermite) for any order, and numerically integrate any f(x) with Gauss–Legendre.

Input

Choose a Gaussian quadrature rule and order to compute the nodes x_i and weights w_i.

Quadrature rule

Interval [-1, 1], weight w(x) = 1

Integer from 1 to 64

Optionally approximate a definite integral of your function using Gauss–Legendre at the chosen order.

e.g. exp(-x^2), sin(x), x^2 + 1. Variable is x; pi, e and sin, cos, exp, log, sqrt, etc. are available.

Result

Selected rule

Gauss–Legendre

5-point rule

Nodes n

5

Domain

[-1, 1]

Weight function

1

Nodes and weights

iNode x_iWeight w_i
1-0.90617984590.2369268851
2-0.53846931010.4786286705
300.5688888889
40.53846931010.4786286705
50.90617984590.2369268851

Definite integral approximation

∫ f(x) dx over [-1, 1] (Gauss–Legendre)

1.4936639207

Approximated with the Gauss–Legendre rule at the chosen order n.

How it works

  • Gaussian quadrature approximates an integral by a weighted sum of function values at the nodes, Σ w_i f(x_i). An n-point rule integrates polynomials up to degree 2n-1 exactly.
  • The nodes x_i are the roots of the orthogonal polynomial associated with each weight function. This tool finds the Legendre, Laguerre and Hermite roots via recurrence relations and Newton's method, while the Chebyshev nodes use closed-form expressions.
  • Gauss–Legendre uses interval [-1, 1] with weight 1; Chebyshev (1st kind) weight 1/√(1-x²); Chebyshev (2nd kind) weight √(1-x²); Laguerre on [0, ∞) with weight e^(-x); Hermite on (-∞, ∞) with weight e^(-x²).
  • Weights are derived from the derivative of the orthogonal polynomial at each root. As a sanity check, the weight sums equal 2, π, π/2, 1 and √π respectively.
  • Definite integrals are always approximated with Gauss–Legendre regardless of the selected rule, mapping [a, b] to the standard interval via x = (b-a)/2·t + (a+b)/2.
  • The integrand is parsed by a custom recursive-descent parser (no eval). It supports + - * / ^, parentheses, unary minus, implicit multiplication, the variable x, constants pi and e, and functions sin cos tan asin acos atan sinh cosh tanh exp log ln log10 sqrt cbrt abs.
  • All computation is double precision, so results carry tiny rounding errors. Values are rounded to 10 decimal places for display.

Reviews

Tell us what you think of this calculator.

Write a review

  1. Home
  2. Gaussian Quadrature Nodes & Weights (Numerical Integration)