maths.free › Numerical Methods › Integration and interpolation › Gaussian quadrature
Gaussian quadrature
In numerical analysis, an n-point Gaussian quadrature rule, named after Carl Friedrich Gauss, is a quadrature rule constructed to yield an exact result for polynomials of degree 2n − 1 or less by a suitable choice of…
Gaussian quadrature
In numerical analysis, an n-point Gaussian quadrature rule, named after Carl Friedrich Gauss, is a quadrature rule constructed to yield an exact result for polynomials of degree 2n − 1 or less by a suitable choice of the nodes xi and weights wi for i = 1, ..., n.
The modern formulation using orthogonal polynomials was developed by Carl Gustav Jacobi in 1826. The most common domain of integration for such a rule is taken as [−1, 1], so the rule is stated as \[\int_{-1}^1 f(x)\,dx \approx \sum_{i=1}^n w_i f(x_i),\]
which is exact for polynomials of degree 2n − 1 or less. This exact rule is known as the Gauss-Legendre quadrature rule. The quadrature rule will only be an accurate approximation to the integral above if f (x) is well-approximated by a polynomial of degree 2n − 1 or less on [−1, 1].
The Gauss-Legendre quadrature rule is not typically used for integrable functions with endpoint singularities. Instead, if the integrand can be written as
\[f(x) = \left(1 - x\right)^\alpha \left(1 + x\right)^\beta g(x),\quad \alpha,\beta > -1,\]
where g(x) is well-approximated by a low-degree polynomial, then alternative nodes xi' and weights wi' will usually give more accurate quadrature rules. These are known as Gauss-Jacobi quadrature rules, i.e.,
\[\int_{-1}^1 f(x)\,dx = \int_{-1}^1 \left(1 - x\right)^\alpha \left(1 + x\right)^\beta g(x)\,dx \approx \sum_{i=1}^n w_i' g\left(x_i'\right).\]
Condensed: the full section is in Wikipedia.
Gauss-Legendre quadrature
For the simplest integration problem stated above, i.e., f(x) is well-approximated by polynomials on \([-1, 1]\), the associated orthogonal polynomials are Legendre polynomials, denoted by Pn(x). With the n-th polynomial normalized to give Pn(1) = 1, the i-th Gauss node, xi, is the i-th root of Pn and the weights are given by the formula \[w_i = \frac{2}{\left( 1 - x_i^2 \right) \left[P'_n(x_i)\right]^2}.\]
Some low-order quadrature rules are tabulated below (over interval [−1, 1], see the section below for other intervals).
Change of interval
An integral over [a, b] must be changed into an integral over [−1, 1] before applying the Gaussian quadrature rule. This change of interval can be done in the following way: \[\int_a^b f(x)\,dx = \int_{ -1}^1 f\left(\frac{b-a}{2}\xi + \frac{a+b}{2}\right)\,\frac{dx}{d\xi}d\xi\]
with \(\frac{dx}{d\xi} = \frac{b-a}{2}\)
Applying the \(n\) point Gaussian quadrature \((\xi, w)\) rule then results in the following approximation: \[\int_a^b f(x)\,dx \approx \frac{b-a}{2} \sum_{i=1}^n w_i f\left(\frac{b-a}{2}\xi_i + \frac{a+b}{2}\right).\]
Example of two-point Gauss quadrature rule
Use the two-point Gauss quadrature rule to approximate the distance in meters covered by a rocket from \(t = 8\mathrm{s}\) to \(t = 30\mathrm{s},\) as given by \[s = \int_{8}^{30}{\left( 2000\ln\left[ \frac{140000}{140000 - 2100t} \right] - 9.8t \right){dt}}\]
Change the limits so that one can use the weights and abscissae given in Table 1. Also, find the absolute relative true error. The true value is given as 11061.34 m.
Solution
First, changing the limits of integration from \(\left[ 8,30 \right]\) to \(\left[ - 1,1 \right]\) gives
\[\begin{aligned} \int_{8}^{30} {f(t) dt} &= \frac{30 - 8}{2} \int_{- 1}^{1}{f\left( \frac{30 - 8}{2}x + \frac{30 + 8}{2} \right){dx}} \\ &= 11\int_{- 1}^{1}{f\left( 11x + 19 \right){dx}} \end{aligned}\]
Next, get the weighting factors and function argument values from Table 1 for the two-point rule,
- \(c_1 = 1.000000000\)
- \(x_1 = - 0.577350269\)
- \(c_2 = 1.000000000\)
- \(x_2 = 0.577350269\)
Now we can use the Gauss quadrature formula \[\begin{aligned} 11\int_{-1}^{1}{f\left( 11x + 19 \right){dx}} & \approx 11\left[ c_1 f\left( 11 x_1 + 19 \right) + c_2 f\left( 11 x_2 + 19 \right) \right] \\ &= 11\left[ f\left( 11( - 0.5773503) + 19 \right) + f\left( 11(0.5773503) + 19 \right) \right] \\ &= 11\left[ f(12.64915) + f(25.35085) \right] \\ &= 11\left[ (296.8317) + (708.4811) \right] \\ &= 11058.44 \end{aligned}\] since \[\begin{aligned} f(12.64915) & = 2000\ln\left[ \frac{140000}{140000 - 2100(12.64915)} \right] - 9.8(12.64915) \\ &= 296.8317 \end{aligned}\] \[\begin{aligned} f(25.35085) & = 2000\ln\left[ \frac{140000}{140000 - 2100(25.35085)} \right] - 9.8(25.35085) \\ &= 708.4811 \end{aligned}\]
Condensed: the full section is in Wikipedia.
Other forms
The integration problem can be expressed in a slightly more general way by introducing a positive weight function ω into the integrand, and allowing an interval other than [−1, 1]. That is, the problem is to calculate \[\int_a^b \omega(x)\,f(x)\,dx\] for some choices of a, b, and ω. For a = −1, b = 1, and ω(x) = 1, the problem is the same as that considered above. Other choices lead to other integration rules. Some of these are tabulated below. Equation numbers are given for Abramowitz and Stegun (A & S).
Fundamental theorem
Let pn be a nontrivial polynomial of degree n such that \[\int_a^b \omega(x) \, x^k p_n(x) \, dx = 0, \quad \text{for all } k = 0, 1, \ldots, n - 1.\]
Note that this will be true for all the orthogonal polynomials above, because each pn is constructed to be orthogonal to the other polynomials pj for j<n, and x is in the span of that set.
If we pick the n nodes xi to be the zeros of pn, \(p_n\propto\prod_{i=1}^n (x-x_i)\), then there exist n weights wi which make the Gaussian quadrature computed integral exact for all polynomials h(x) of degree 2n − 1 or less. Furthermore, all these nodes xi will lie in the open interval (a, b).
To prove the first part of this claim, let h(x) be any polynomial of degree 2n − 1 or less. Divide it by the orthogonal polynomial pn to get \[h(x) = p_n(x) \, q(x) + r(x).\] where q(x) is the quotient, of degree n − 1 or less (because the sum of its degree and that of the divisor pn must equal that of the dividend), and r(x) is the remainder, also of degree n − 1 or less (because the degree of the remainder is always less than that of the divisor). Since pn is by assumption orthogonal to all monomials of degree less than n, it must be orthogonal to the quotient q(x). Therefore \[\int_a^b \omega(x)\,h(x)\,dx = \int_a^b \omega(x)\,\big( \, p_n(x) q(x) + r(x) \, \big)\,dx = \int_a^b \omega(x)\,r(x)\,dx.\]
Since the remainder r(x) is of degree n − 1 or less, we can interpolate it exactly using n interpolation points with Lagrange polynomials li(x), where \[l_i(x) = \prod _{j \ne i} \frac{x-x_j}{x_i-x_j}.\]
We have \[r(x) = \sum_{i=1}^n l_i(x) \, r(x_i).\]
Then its integral will equal \[\int_a^b \omega(x)\,r(x)\,dx = \int_a^b \omega(x) \, \sum_{i=1}^n l_i(x) \, r(x_i) \, dx = \sum_{i=1}^n \, r(x_i) \, \int_a^b \omega(x) \, l_i(x) \, dx = \sum_{i=1}^n \, r(x_i) \, w_i,\]
Condensed: the full section is in Wikipedia.
Computation of Gaussian quadrature rules
There are many algorithms for computing the nodes xi and weights wi of Gaussian quadrature rules. The most popular are the Golub-Welsch algorithm requiring O(n) operations, Newton's method for solving \(p_n(x) = 0\) using the three-term recurrence for evaluation requiring O(n) operations, and asymptotic formulas for large n requiring O(n) operations.
Error estimates
The error of a Gaussian quadrature rule can be stated as follows. For an integrand which has 2n continuous derivatives, \[\int_a^b \omega(x)\,f(x)\,dx - \sum_{i=1}^n w_i\,f(x_i) = \frac{f^{(2n)}(\xi)}{(2n)!} \, (p_n, p_n)\] for some ξ in (a, b), where pn is the monic (i.e. the leading coefficient is 1) orthogonal polynomial of degree n and where \[(f,g) = \int_a^b \omega(x) f(x) g(x) \, dx.\]
In the important special case of ω(x) = 1, we have the error estimate \[\frac{\left(b - a\right)^{2n+1} \left(n!\right)^4}{(2n + 1)\left[\left(2n\right)!\right]^3} f^{(2n)} (\xi), \qquad a < \xi < b.\]
Stoer and Bulirsch remark that this error estimate is inconvenient in practice, since it may be difficult to estimate the order 2n derivative, and furthermore the actual error may be much less than a bound established by the derivative. Another approach is to use two Gaussian quadrature rules of different orders, and to estimate the error as the difference between the two results. For this purpose, Gauss-Kronrod quadrature rules can be useful.
Gauss-Kronrod rules
If the interval [a, b] is subdivided, the Gauss evaluation points of the new subintervals never coincide with the previous evaluation points (except at zero for odd numbers), and thus the integrand must be evaluated at every point. Gauss-Kronrod rules are extensions of Gauss quadrature rules generated by adding n + 1 points to an n-point rule in such a way that the resulting rule is of order 2n + 1. This allows for computing higher-order estimates while re-using the function values of a lower-order estimate. The difference between a Gauss quadrature rule and its Kronrod extension is often used as an estimate of the approximation error.
Gauss-Lobatto rules
In some applications, it is desirable to have quadrature rules that have the high accuracy of Gauss formulas, but that also include the end points of the interval among the evaluation points. Such rules are known as Gauss-Lobatto, or simply Lobatto quadrature, named after Dutch mathematician Rehuel Lobatto. Because for an n point rule, one can no longer freely choose the locations of all quadrature points (2 of the points are fixed at the end points), one needs to expect that the rule is less accurate than regular Gaussian quadrature. Indeed, an n point Gauss-Lobatto rule is only accurate for polynomials up to degree 2n − 3.
Lobatto quadrature of function f(x) on interval [−1, 1]: \[\int_{-1}^1 {f(x) \, dx} = \frac {2} {n(n-1)}[f(1) + f(-1)] + \sum_{i = 2}^{n-1} {w_i f(x_i)} + R_n.\]
Abscissas: xi is the \((i - 1)\)st zero of \(P'_{n-1}(x)\), here \(P_m(x)\) denotes the standard Legendre polynomial of m-th degree and the dash denotes the derivative.
Weights: \[w_i = \frac{2}{n(n - 1)\left[P_{n-1}\left(x_i\right)\right]^2}, \qquad x_i \ne \pm 1.\]
Remainder: \[R_n = \frac{-n\left(n - 1\right)^3 2^{2n-1} \left[\left(n - 2\right)!\right]^4}{(2n-1) \left[\left(2n - 2\right)!\right]^3} f^{(2n-2)}(\xi), \qquad -1 < \xi < 1.\]
Some of the weights are:
An adaptive variant of this algorithm with 2 interior nodes is found in GNU Octave and MATLAB as quadl and integrate.
Teraz ty Żaden kalkulator nie ustali tego, ale jego kawałki są komputentne. Spróbuj jeden poniżej, lub wpisz własny.
Darmowe konto dodaje notatki na każdej lekcji, zapis tego, co zakończyłeś, rozwiązane problemy w jednym miejscu, a także korepetytor, którego możesz zapytać o tę stronę. Matematyka sama jest otwarta dla wszystkich, zapisana lub nie.
Podpisz ZalogowanieSymbole używane tutaj
Dotknij dowolny symbol pełnej definicji, obrazu i co oznacza każda litera.
Pytania, które ludzie zadają
Why not just solve exactly?
Most equations have no closed-form solution at all, and many that do are unusable in practice. A numerical method delivers as many correct digits as you need, and a good one tells you how many that is.
Why can Newton's method fail?
If it starts where the tangent is nearly flat it shoots far away; near a repeated root it slows to a crawl; and with several roots it may land on the wrong one. A bracketing method like bisection is slower but cannot fail.
Części tej strony są dostosowane z Wikipedia (CC BY-SA 4.0). Tu są zgłośliwe i ponownie wyjaśnione; błędy są nasze.
Więcej w Numerical Methods
Root finding: bisection and Newton's methodNumerical integration: trapezoid and SimpsonInterpolation and Taylor approximationFloating point and error