Exercise: Gauss-Legendre on a general interval
Changing variables from [1,1.5] to [-1,1] and applying Gauss-Legendre with n=2 and n=3.
Transform and sum
ExampleIntegral of e^{-x²}
Compute with Gauss-Legendre using and .
Transform [1,1.5] into [-1,1]:
The integral becomes:
With two nodes, ±0.577350 and weights 1:
With three nodes, 0 and ±0.774597, weights 0.888889 and 0.555556:
The correct transformation includes the factor 1/4; without it, the result is four times too large.