Numerical integration/Gauss-Legendre Quadrature: Difference between revisions

Small corrections.
(Problem description, task description, example, reference implementation in Common Lisp.)
 
(Small corrections.)
Line 1:
{{Task|Arithmetic operations}}
In a general Gaussian quadrature rule, an definite integral is first approximated over the interval <math>[-1,1]</math> by a polynomial approximable function <math>g(x)</math> and a weighting function <math>W(x)</math>:.
 
::<math>\int_{-1}^1 f(x) \, dx = \int_{-1}^1 W(x) g(x) \, dx</math>
 
In the case of Gauss-Legendre quadrature, the weighting function <math>W(x) = 1</math>,. so we can easily approximate an integral of <math>f(x)</math> by a sum of function values at specified points <math>x_i</math> multiplied by some weights <math>w_i</math>:
 
Then we can approximate an integral of <math>f(x)</math> by a sum of function values at specified points <math>x_i</math> multiplied by some weights <math>w_i</math>:
 
::<math>\int_{-1}^1 f(x)\,dx \approx \sum_{i=1}^n w_i f(x_i)</math>
Line 18 ⟶ 20:
There is also a recursive equation for their derivative:
 
::<math>P_{n}'(x) = \frac{n}{x^2-1} \left( x P_n(x) - P_{n-1}(x) \right)</math>
 
The roots of those polynomials are in general not analytically solvable, so they have to be approximated numerically, for example by Newton-Raphson iteration:
69

edits