What this calculator does
This tool computes the nodes (abscissas) \(x_i\) and weights \(w_i\) of the n-point Gauss-Lobatto quadrature rule on the reference interval \([-1, 1]\) with weight function \(w(x) = 1\). Unlike standard Gauss-Legendre quadrature, the Gauss-Lobatto rule always forces the two endpoints \(x = -1\) and \(x = +1\) to be quadrature nodes, which is valuable when boundary values matter (for example in spectral element methods). This is pure numerical analysis and applies identically everywhere; it is not region-specific.
How to use it
Pick the number of points \(n\) (between 2 and 100) and optionally a display precision. The calculator returns a table of \(n\) rows, each giving the node \(x_i\) and its weight \(w_i\). The nodes are symmetric about 0 and the weights are symmetric too, so \(x_i\) and \(-x_i\) share the same weight. As a built-in sanity check, the sum of all weights equals 2, the length of the interval.
The formula explained
The rule approximates the integral as the sum \(w_1 f(x_1) + \ldots + w_n f(x_n)\) and is exact for polynomials up to degree \(2n-3\). The interior nodes \(x_2, \ldots, x_{n-1}\) are the \(n-2\) zeros of \(P'_{n-1}(x)\), the derivative of the Legendre polynomial of degree \(n-1\). $$\int_{-1}^{1} f(x)\,dx \approx \sum_{i=1}^{n} w_i\, f(x_i)$$ $$\text{where}\quad \left\{ \begin{aligned} x_1 &= -1,\quad x_{n} = 1 \\ x_i &: P_{n-1}^{\prime}(x_i) = 0 \quad(\text{interior}) \\ w_{1} &= w_{n} = \frac{2}{n\,(n-1)} \\ w_i &= \frac{2}{n\,(n-1)\,\left[P_{n-1}(x_i)\right]^{2}} \end{aligned} \right.$$ The endpoints take weight \(2 / (n(n-1))\), while each interior node \(x_i\) takes weight \(2 / (n(n-1)[P_{n-1}(x_i)]^2)\). The calculator finds the interior roots by Newton iteration starting from Chebyshev-Gauss-Lobatto guesses \(\cos(\pi j / (n-1))\), giving full double precision (about 15-16 significant digits).
Worked example (n = 4)
The interior nodes solve \(P'_3(x) = (15x^2 - 3)/2 = 0\), so \(x = \pm 1/\sqrt{5} = \pm 0.4472135955\). The endpoint weight is \(2/(4\cdot 3) = 1/6 = 0.1666666667\). For the interior nodes \(P_3(1/\sqrt{5}) = -0.4472135955\), whose square is \(0.2\), giving weight \(2/(4\cdot 3\cdot 0.2) = 5/6 = 0.8333333333\). The sum \(1/6 + 5/6 + 5/6 + 1/6 = 2\), confirming the rule.
FAQ
How does this differ from Gauss-Legendre? Gauss-Legendre places all nodes strictly inside \((-1, 1)\) and is exact to degree \(2n-1\). Gauss-Lobatto fixes both endpoints as nodes and is exact to degree \(2n-3\), trading two degrees of precision for boundary inclusion.
How do I use these on a general interval [a, b]? Map each node with \(x \to (b-a)/2 \cdot x + (a+b)/2\) and multiply every weight by \((b-a)/2\). This page only outputs the \([-1, 1]\) values.
Why must the weights sum to 2? Integrating \(f(x) = 1\) over \([-1, 1]\) gives 2, and the rule is exact for constants, so the weights must add up to the interval length.