Английская Википедия:Gaussian quadrature
Шаблон:Short description Шаблон:Redirect Шаблон:More footnotes
In numerical analysis, an Шаблон:Mvar-point Gaussian quadrature rule, named after Carl Friedrich Gauss,[1] is a quadrature rule constructed to yield an exact result for polynomials of degree Шаблон:Math or less by a suitable choice of the nodes Шаблон:Mvar and weights Шаблон:Mvar for Шаблон:Math.
The modern formulation using orthogonal polynomials was developed by Carl Gustav Jacobi in 1826.[2] The most common domain of integration for such a rule is taken as Шаблон:Math, so the rule is stated as <math display="block">\int_{-1}^1 f(x)\,dx \approx \sum_{i=1}^n w_i f(x_i),</math>
which is exact for polynomials of degree Шаблон:Math 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 Шаблон:Math is well-approximated by a polynomial of degree Шаблон:Math or less on Шаблон:Math.
The Gauss–Legendre quadrature rule is not typically used for integrable functions with endpoint singularities. Instead, if the integrand can be written as
<math display="block">f(x) = \left(1 - x\right)^\alpha \left(1 + x\right)^\beta g(x),\quad \alpha,\beta > -1,</math>
where Шаблон:Math is well-approximated by a low-degree polynomial, then alternative nodes Шаблон:Mvar and weights Шаблон:Mvar will usually give more accurate quadrature rules. These are known as Gauss–Jacobi quadrature rules, i.e.,
<math display="block">\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).</math>
Common weights include <math display="inline">\frac{1}{\sqrt{1 - x^2}}</math> (Chebyshev–Gauss) and <math display="inline">\sqrt{1 - x^2}</math>. One may also want to integrate over semi-infinite (Gauss–Laguerre quadrature) and infinite intervals (Gauss–Hermite quadrature).
It can be shown (see Press et al., or Stoer and Bulirsch) that the quadrature nodes Шаблон:Mvar are the roots of a polynomial belonging to a class of orthogonal polynomials (the class orthogonal with respect to a weighted inner-product). This is a key observation for computing Gauss quadrature nodes and weights.
Gauss–Legendre quadrature
For the simplest integration problem stated above, i.e., Шаблон:Math is well-approximated by polynomials on <math>[-1, 1]</math>, the associated orthogonal polynomials are Legendre polynomials, denoted by Шаблон:Math. With the Шаблон:Mvar-th polynomial normalized to give Шаблон:Math, the Шаблон:Mvar-th Gauss node, Шаблон:Mvar, is the Шаблон:Mvar-th root of Шаблон:Mvar and the weights are given by the formula[3] <math display="block"> w_i = \frac{2}{\left( 1 - x_i^2 \right) \left[P'_n(x_i)\right]^2}.</math>
Some low-order quadrature rules are tabulated below (over interval Шаблон:Math, see the section below for other intervals).
Number of points, Шаблон:Mvar | Points, Шаблон:Mvar | Weights, Шаблон:Mvar | ||
---|---|---|---|---|
1 | 0 | 2 | ||
2 | <math>\pm\frac{1}{\sqrt{3}}</math> | ±0.57735... | 1 | |
3 | 0 | <math>\frac{8}{9}</math> | 0.888889... | |
<math>\pm\sqrt{\frac{3}{5}}</math> | ±0.774597... | <math>\frac{5}{9}</math> | 0.555556... | |
4 | <math>\pm\sqrt{\frac{3}{7} - \frac{2}{7}\sqrt{\frac{6}{5}}}</math> | ±0.339981... | <math>\frac{18 + \sqrt{30}}{36}</math> | 0.652145... |
<math>\pm\sqrt{\frac{3}{7} + \frac{2}{7}\sqrt{\frac{6}{5}}}</math> | ±0.861136... | <math>\frac{18 - \sqrt{30}}{36}</math> | 0.347855... | |
5 | 0 | <math>\frac{128}{225}</math> | 0.568889... | |
<math>\pm\frac{1}{3}\sqrt{5 - 2\sqrt{\frac{10}{7}}}</math> | ±0.538469... | <math>\frac{322 + 13\sqrt{70}}{900}</math> | 0.478629... | |
<math>\pm\frac{1}{3}\sqrt{5 + 2\sqrt{\frac{10}{7}}}</math> | ±0.90618... | <math>\frac{322 - 13\sqrt{70}}{900}</math> | 0.236927... |
Change of interval
An integral over Шаблон:Math must be changed into an integral over Шаблон:Math before applying the Gaussian quadrature rule. This change of interval can be done in the following way: <math display="block">\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</math>
with <math>\frac{dx}{d\xi} = \frac{b-a}{2}</math>
Applying the <math>n</math> point Gaussian quadrature <math>(\xi, w)</math> rule then results in the following approximation: <math display="block">\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).</math>
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 <math>t = 8\mathrm{s} </math> to <math>t = 30\mathrm{s},</math> as given by <math display="block">x = \int_{8}^{30}{\left( 2000\ln\left[ \frac{140000}{140000 - 2100t} \right] - 9.8t \right){dt}}</math>
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 <math>\left[ 8,30 \right]</math> to <math>\left[ - 1,1 \right]</math> gives
<math display="block"> \begin{align} \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{align} </math>
Next, get the weighting factors and function argument values from Table 1 for the two-point rule,
- <math>c_1 = 1.000000000 </math>
- <math>x_1 = - 0.577350269 </math>
- <math>c_2 = 1.000000000 </math>
- <math>x_2 = 0.577350269 </math>
Now we can use the Gauss quadrature formula <math display="block"> \begin{align} 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{align}</math> since <math display="block"> \begin{align} f(12.64915) & = 2000\ln\left[ \frac{140000}{140000 - 2100(12.64915)} \right] - 9.8(12.64915) \\ &= 296.8317 \end{align}</math> <math display="block"> \begin{align} f(25.35085) & = 2000\ln\left[ \frac{140000}{140000 - 2100(25.35085)} \right] - 9.8(25.35085) \\ &= 708.4811 \end{align}</math>
Given that the true value is 11061.34 m, the absolute relative true error, <math>\left| \varepsilon_{t} \right|</math> is <math display="block"> \left| \varepsilon_{t} \right| = \left| \frac{11061.34 - 11058.44}{11061.34} \right| \times 100\% = 0.0262\% </math>
Other forms
The integration problem can be expressed in a slightly more general way by introducing a positive weight function Шаблон:Mvar into the integrand, and allowing an interval other than Шаблон:Math. That is, the problem is to calculate <math display="block"> \int_a^b \omega(x)\,f(x)\,dx </math> for some choices of Шаблон:Mvar, Шаблон:Mvar, and Шаблон:Mvar. For Шаблон:Math, Шаблон:Math, and Шаблон:Math, 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).
Interval | Шаблон:Math | Orthogonal polynomials | A & S | For more information, see ... |
---|---|---|---|---|
Шаблон:Closed-closed | Шаблон:Math | Legendre polynomials | 25.4.29 | Шаблон:Section link |
Шаблон:Open-open | <math>\left(1 - x\right)^\alpha \left(1 + x\right)^\beta,\quad \alpha, \beta > -1</math> | Jacobi polynomials | 25.4.33 (Шаблон:Math) | Gauss–Jacobi quadrature |
Шаблон:Open-open | <math>\frac{1}{\sqrt{1 - x^2}}</math> | Chebyshev polynomials (first kind) | 25.4.38 | Chebyshev–Gauss quadrature |
Шаблон:Closed-closed | <math>\sqrt{1 - x^2}</math> | Chebyshev polynomials (second kind) | 25.4.40 | Chebyshev–Gauss quadrature |
Шаблон:Closed-open | <math> e^{-x}\, </math> | Laguerre polynomials | 25.4.45 | Gauss–Laguerre quadrature |
Шаблон:Closed-open | <math> x^\alpha e^{-x},\quad \alpha>-1 </math> | Generalized Laguerre polynomials | Gauss–Laguerre quadrature | |
Шаблон:Open-open | <math> e^{-x^2} </math> | Hermite polynomials | 25.4.46 | Gauss–Hermite quadrature |
Fundamental theorem
Let Шаблон:Mvar be a nontrivial polynomial of degree Шаблон:Mvar such that <math display="block">\int_a^b \omega(x) \, x^k p_n(x) \, dx = 0, \quad \text{for all } k = 0, 1, \ldots, n - 1.</math>
Note that this will be true for all the orthogonal polynomials above, because each Шаблон:Mvar is constructed to be orthogonal to the other polynomials Шаблон:Mvar for Шаблон:Math, and Шаблон:Math is in the span of that set.
If we pick the Шаблон:Mvar nodes Шаблон:Mvar to be the zeros of Шаблон:Mvar, then there exist Шаблон:Mvar weights Шаблон:Mvar which make the Gaussian quadrature computed integral exact for all polynomials Шаблон:Math of degree Шаблон:Math or less. Furthermore, all these nodes Шаблон:Mvar will lie in the open interval Шаблон:Math.[4]
To prove the first part of this claim, let Шаблон:Math be any polynomial of degree Шаблон:Math or less. Divide it by the orthogonal polynomial Шаблон:Mvar to get <math display="block"> h(x) = p_n(x) \, q(x) + r(x). </math> where Шаблон:Math is the quotient, of degree Шаблон:Math or less (because the sum of its degree and that of the divisor Шаблон:Mvar must equal that of the dividend), and Шаблон:Math is the remainder, also of degree Шаблон:Math or less (because the degree of the remainder is always less than that of the divisor). Since Шаблон:Mvar is by assumption orthogonal to all monomials of degree less than Шаблон:Mvar, it must be orthogonal to the quotient Шаблон:Math. Therefore <math display="block"> \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. </math>
Since the remainder Шаблон:Math is of degree Шаблон:Math or less, we can interpolate it exactly using Шаблон:Mvar interpolation points with Lagrange polynomials Шаблон:Math, where <math display="block"> l_i(x) = \prod _{j \ne i} \frac{x-x_j}{x_i-x_j}. </math>
We have <math display="block"> r(x) = \sum_{i=1}^n l_i(x) \, r(x_i). </math>
Then its integral will equal <math display="block"> \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, </math>
where Шаблон:Math, the weight associated with the node Шаблон:Math, is defined to equal the weighted integral of Шаблон:Math (see below for other formulas for the weights). But all the Шаблон:Mvar are roots of Шаблон:Mvar, so the division formula above tells us that <math display="block"> h(x_i) = p_n(x_i) \, q(x_i) + r(x_i) = r(x_i), </math> for all Шаблон:Mvar. Thus we finally have <math display="block"> \int_a^b \omega(x)\,h(x)\,dx = \int_a^b \omega(x) \, r(x) \, dx = \sum_{i=1}^n w_i \, r(x_i) = \sum_{i=1}^n w_i \, h(x_i). </math>
This proves that for any polynomial Шаблон:Math of degree Шаблон:Math or less, its integral is given exactly by the Gaussian quadrature sum.
To prove the second part of the claim, consider the factored form of the polynomial Шаблон:Math. Any complex conjugate roots will yield a quadratic factor that is either strictly positive or strictly negative over the entire real line. Any factors for roots outside the interval from Шаблон:Mvar to Шаблон:Mvar will not change sign over that interval. Finally, for factors corresponding to roots Шаблон:Mvar inside the interval from Шаблон:Mvar to Шаблон:Mvar that are of odd multiplicity, multiply Шаблон:Math by one more factor to make a new polynomial <math display="block"> p_n(x) \, \prod_i (x - x_i). </math>
This polynomial cannot change sign over the interval from Шаблон:Mvar to Шаблон:Mvar because all its roots there are now of even multiplicity. So the integral <math display="block"> \int_a^b p_n(x) \, \left( \prod_i (x - x_i) \right) \, \omega(x) \, dx \ne 0, </math> since the weight function Шаблон:Math is always non-negative. But Шаблон:Math is orthogonal to all polynomials of degree Шаблон:Math or less, so the degree of the product <math display="block"> \prod_i (x - x_i) </math> must be at least Шаблон:Mvar. Therefore Шаблон:Math has Шаблон:Mvar distinct roots, all real, in the interval from Шаблон:Mvar to Шаблон:Mvar.
General formula for the weights
The weights can be expressed as
Шаблон:NumBlk{a_{n-1}} \frac{\int_{a}^{b} \omega(x) p_{n-1}(x)^2 dx}{p'_{n}(x_{i}) p_{n-1}(x_{i})}</math>|Шаблон:EquationRef}}
where <math>a_{k}</math> is the coefficient of <math>x^{k}</math> in <math>p_{k}(x)</math>. To prove this, note that using Lagrange interpolation one can express Шаблон:Math in terms of <math>r(x_{i})</math> as <math display="block">r(x) = \sum_{i=1}^{n} r(x_{i}) \prod_{\begin{smallmatrix} 1 \leq j \leq n \\ j \neq i \end{smallmatrix}}\frac{x-x_{j}}{x_{i}-x_{j}}</math> because Шаблон:Math has degree less than Шаблон:Mvar and is thus fixed by the values it attains at Шаблон:Mvar different points. Multiplying both sides by Шаблон:Math and integrating from Шаблон:Mvar to Шаблон:Mvar yields <math display="block">\int_{a}^{b}\omega(x)r(x)dx = \sum_{i=1}^{n} r(x_{i}) \int_{a}^{b}\omega(x)\prod_{\begin{smallmatrix} 1 \leq j \leq n \\ j \neq i \end{smallmatrix}} \frac{x-x_{j}}{x_{i}-x_{j}}dx</math>
The weights Шаблон:Mvar are thus given by <math display="block">w_{i} = \int_{a}^{b}\omega(x)\prod_{\begin{smallmatrix}1\leq j\leq n\\j\neq i\end{smallmatrix}}\frac{x-x_{j}}{x_{i}-x_{j}}dx</math>
This integral expression for <math>w_{i}</math> can be expressed in terms of the orthogonal polynomials <math>p_{n}(x)</math> and <math>p_{n-1}(x)</math> as follows.
We can write <math display="block"> \prod_{\begin{smallmatrix} 1 \leq j \leq n \\ j \neq i \end{smallmatrix}} \left(x-x_{j}\right) = \frac{\prod_{1\leq j\leq n} \left(x - x_{j}\right)}{x-x_{i}} = \frac{p_{n}(x)}{a_{n}\left(x-x_{i}\right)}</math>
where <math>a_{n}</math> is the coefficient of <math>x^n</math> in <math>p_{n}(x)</math>. Taking the limit of Шаблон:Mvar to <math>x_{i}</math> yields using L'Hôpital's rule <math display="block"> \prod_{\begin{smallmatrix} 1 \leq j \leq n \\ j \neq i \end{smallmatrix}} \left(x_{i}-x_{j}\right) = \frac{p'_{n}(x_{i})}{a_{n}}</math>
We can thus write the integral expression for the weights as
Шаблон:NumBlkdx</math>|Шаблон:EquationRef}}
In the integrand, writing <math display="block">\frac{1}{x-x_i} = \frac{1 - \left(\frac{x}{x_i}\right)^{k}}{x - x_i} + \left(\frac{x}{x_i}\right)^{k} \frac{1}{x - x_i}</math>
yields <math display="block">\int_a^b\omega(x)\frac{x^kp_n(x)}{x-x_i}dx = x_i^k \int_{a}^{b}\omega(x)\frac{p_n(x)}{x-x_i}dx</math>
provided <math>k \leq n</math>, because <math display="block">\frac{1-\left(\frac{x}{x_{i}}\right)^{k}}{x-x_{i}}</math> is a polynomial of degree Шаблон:Math which is then orthogonal to <math>p_{n}(x)</math>. So, if Шаблон:Math is a polynomial of at most nth degree we have <math display="block">\int_{a}^{b}\omega(x)\frac{p_{n}(x)}{x-x_{i}} dx = \frac{1}{q(x_{i})} \int_{a}^{b} \omega(x)\frac{q(x) p_n(x)}{x-x_{i}}dx </math>
We can evaluate the integral on the right hand side for <math>q(x) = p_{n-1}(x)</math> as follows. Because <math>\frac{p_{n}(x)}{x-x_{i}}</math> is a polynomial of degree Шаблон:Math, we have <math display="block">\frac{p_{n}(x)}{x-x_{i}} = a_{n}x^{n-1} + s(x)</math> where Шаблон:Math is a polynomial of degree <math>n - 2</math>. Since Шаблон:Math is orthogonal to <math>p_{n-1}(x)</math> we have <math display="block">\int_{a}^{b}\omega(x)\frac{p_{n}(x)}{x-x_{i}}dx=\frac{a_{n}}{p_{n-1}(x_{i})} \int_{a}^{b}\omega(x)p_{n-1}(x)x^{n-1}dx </math>
We can then write <math display="block">x^{n-1} = \left(x^{n-1} - \frac{p_{n-1}(x)}{a_{n-1}}\right) + \frac{p_{n-1}(x)}{a_{n-1}}</math>
The term in the brackets is a polynomial of degree <math>n - 2</math>, which is therefore orthogonal to <math>p_{n-1}(x)</math>. The integral can thus be written as <math display="block">\int_{a}^{b}\omega(x)\frac{p_{n}(x)}{x-x_{i}}dx = \frac{a_{n}}{a_{n-1} p_{n-1}(x_{i})} \int_{a}^{b}\omega(x) p_{n-1}(x)^{2} dx </math>
According to equation (Шаблон:EquationNote), the weights are obtained by dividing this by <math>p'_{n}(x_{i})</math> and that yields the expression in equation (Шаблон:EquationNote).
<math>w_{i}</math> can also be expressed in terms of the orthogonal polynomials <math>p_{n}(x)</math> and now <math>p_{n+1}(x)</math>. In the 3-term recurrence relation <math>p_{n+1}(x_{i}) = (a) p_{n}(x_{i}) + (b) p_{n-1}(x_{i})</math> the term with <math>p_{n}(x_{i})</math> vanishes, so <math>p_{n-1}(x_{i})</math> in Eq. (1) can be replaced by <math display="inline">\frac{1}{b} p_{n+1} \left(x_i\right)</math>.
Proof that the weights are positive
Consider the following polynomial of degree <math>2n - 2</math> <math display="block">f(x) = \prod_{\begin{smallmatrix} 1 \leq j \leq n \\ j \neq i \end{smallmatrix}}\frac{\left(x - x_j\right)^2}{\left(x_i - x_j\right)^2}</math> where, as above, the Шаблон:Mvar are the roots of the polynomial <math>p_{n}(x)</math>. Clearly <math>f(x_j) = \delta_{ij}</math>. Since the degree of <math>f(x)</math> is less than <math>2n - 1</math>, the Gaussian quadrature formula involving the weights and nodes obtained from <math>p_{n}(x)</math> applies. Since <math>f(x_{j}) = 0</math> for Шаблон:Mvar not equal to Шаблон:Mvar, we have <math display="block">\int_{a}^{b}\omega(x)f(x)dx=\sum_{j=1}^{n}w_{j}f(x_{j}) = \sum_{j=1}^{n} \delta_{ij} w_j = w_{i} > 0.</math>
Since both <math>\omega(x)</math> and <math>f(x)</math> are non-negative functions, it follows that <math>w_{i} > 0</math>.
Computation of Gaussian quadrature rules
There are many algorithms for computing the nodes Шаблон:Mvar and weights Шаблон:Mvar of Gaussian quadrature rules. The most popular are the Golub-Welsch algorithm requiring Шаблон:Math operations, Newton's method for solving <math>p_n(x) = 0</math> using the three-term recurrence for evaluation requiring Шаблон:Math operations, and asymptotic formulas for large n requiring Шаблон:Math operations.
Recurrence relation
Orthogonal polynomials <math>p_r</math> with <math>(p_r, p_s) = 0</math> for <math>r \ne s</math> for a scalar product <math>(\cdot , \cdot)</math>, degree <math>(p_r) = r</math> and leading coefficient one (i.e. monic orthogonal polynomials) satisfy the recurrence relation <math display="block">p_{r+1}(x) = (x - a_{r,r}) p_r(x) - a_{r,r-1} p_{r-1}(x) \cdots - a_{r,0}p_0(x)</math>
and scalar product defined <math display="block">(f(x),g(x))=\int_a^b\omega(x)f(x)g(x)dx</math>
for <math>r = 0, 1, \ldots, n - 1</math> where Шаблон:Mvar is the maximal degree which can be taken to be infinity, and where <math display="inline">a_{r,s} = \frac{\left(xp_r, p_s\right)}{\left(p_s, p_s\right)}</math>. First of all, the polynomials defined by the recurrence relation starting with <math>p_0(x) = 1</math> have leading coefficient one and correct degree. Given the starting point by <math>p_0</math>, the orthogonality of <math>p_r</math> can be shown by induction. For <math>r = s = 0</math> one has <math display="block">(p_1,p_0) = (x-a_{0,0}) (p_0,p_0) = (xp_0,p_0) - a_{0,0}(p_0,p_0) = (xp_0,p_0) - (xp_0,p_0) = 0.</math>
Now if <math>p_0, p_1, \ldots, p_r</math> are orthogonal, then also <math>p_{r+1}</math>, because in <math display="block">(p_{r+1}, p_s) = (xp_r, p_s) - a_{r,r}(p_r, p_s) - a_{r,r-1}(p_{r-1}, p_s)\cdots - a_{r,0}(p_0, p_s)</math> all scalar products vanish except for the first one and the one where <math>p_s</math> meets the same orthogonal polynomial. Therefore, <math display="block">(p_{r+1},p_s) = (xp_r,p_s) - a_{r,s}(p_s,p_s) = (xp_r,p_s)-(xp_r,p_s) = 0.</math>
However, if the scalar product satisfies <math>(xf, g) = (f,xg)</math> (which is the case for Gaussian quadrature), the recurrence relation reduces to a three-term recurrence relation: For <math>s < r - 1, xp_s</math> is a polynomial of degree less than or equal to Шаблон:Math. On the other hand, <math>p_r</math> is orthogonal to every polynomial of degree less than or equal to Шаблон:Math. Therefore, one has <math>(xp_r, p_s) = (p_r, xp_s) = 0</math> and <math>a_{r,s} = 0</math> for Шаблон:Math. The recurrence relation then simplifies to <math display="block">p_{r+1}(x) = (x-a_{r,r}) p_r(x) - a_{r,r-1} p_{r-1}(x)</math>
or <math display="block">p_{r+1}(x) = (x-a_r) p_r(x) - b_r p_{r-1}(x)</math>
(with the convention <math>p_{-1}(x) \equiv 0</math>) where <math display="block">a_r := \frac{(xp_r,p_r)}{(p_r,p_r)}, \qquad b_r := \frac{(xp_r,p_{r-1})}{(p_{r-1},p_{r-1})} = \frac{(p_r,p_r)}{(p_{r-1},p_{r-1})}</math>
(the last because of <math>(xp_r, p_{r-1}) = (p_r, xp_{r-1}) = (p_r, p_r)</math>, since <math>xp_{r-1}</math> differs from <math>p_r</math> by a degree less than Шаблон:Mvar).
The Golub-Welsch algorithm
The three-term recurrence relation can be written in matrix form <math>J\tilde{P} = x\tilde{P} - p_n(x) \mathbf{e}_n</math> where <math>\tilde{P} = \begin{bmatrix} p_0(x) & p_1(x) & \cdots & p_{n-1}(x) \end{bmatrix}^\mathsf{T}</math>, <math>\mathbf{e}_n</math> is the <math>n</math>th standard basis vector, i.e., <math>\mathbf{e}_n = \begin{bmatrix} 0 & \cdots & 0 & 1 \end{bmatrix}^\mathsf{T}</math>, and Шаблон:Mvar is the following tridiagonal matrix, called the Jacobi matrix: <math display="block">\mathbf{J} = \begin{bmatrix}
a_0 & 1 & 0 & \cdots & 0 \\ b_1 & a_1 & 1 & \ddots & \vdots \\ 0 & b_2 & \ddots & \ddots & 0 \\ \vdots & \ddots & \ddots & a_{n-2} & 1 \\ 0 & \cdots & 0 & b_{n-1} & a_{n-1}
\end{bmatrix}.</math>
The zeros <math>x_j</math> of the polynomials up to degree Шаблон:Mvar, which are used as nodes for the Gaussian quadrature can be found by computing the eigenvalues of this matrix. This procedure is known as Golub–Welsch algorithm.
For computing the weights and nodes, it is preferable to consider the symmetric tridiagonal matrix <math>\mathcal{J}</math> with elements <math display="block">\begin{align}
\mathcal{J}_{k,i} = J_{k,i} &= a_{k-1} & k &= 1,2,\ldots,n \\[2.1ex] \mathcal{J}_{k-1,i} = \mathcal{J}_{k,k-1} = \sqrt{J_{k,k-1}J_{k-1,k}} &= \sqrt{b_{k-1}} & k &= \hphantom{1,\,}2,\ldots,n.
\end{align}</math>
That is,
<math display="block">\mathcal{J} = \begin{bmatrix}
a_0 & \sqrt{b_1} & 0 & \cdots & 0 \\
\sqrt{b_1} & a_1 & \sqrt{b_2} & \ddots & \vdots \\
0 & \sqrt{b_2} & \ddots & \ddots & 0 \\ \vdots & \ddots & \ddots & a_{n-2} & \sqrt{b_{n-1}} \\ 0 & \cdots & 0 & \sqrt{b_{n-1}} & a_{n-1}
\end{bmatrix}.</math>
Шаблон:Math and <math>\mathcal{J}</math> are similar matrices and therefore have the same eigenvalues (the nodes). The weights can be computed from the corresponding eigenvectors: If <math>\phi^{(j)}</math> is a normalized eigenvector (i.e., an eigenvector with euclidean norm equal to one) associated with the eigenvalue Шаблон:Mvar, the corresponding weight can be computed from the first component of this eigenvector, namely: <math display="block">w_j = \mu_0 \left(\phi_1^{(j)}\right)^2</math>
where <math>\mu_0</math> is the integral of the weight function <math display="block">\mu_0 = \int_a^b \omega(x) dx.</math>
See, for instance, Шаблон:Harv for further details.
Error estimates
The error of a Gaussian quadrature rule can be stated as follows.[5] For an integrand which has Шаблон:Math continuous derivatives, <math display="block"> \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) </math> for some Шаблон:Mvar in Шаблон:Math, where Шаблон:Mvar is the monic (i.e. the leading coefficient is Шаблон:Math) orthogonal polynomial of degree Шаблон:Mvar and where <math display="block"> (f,g) = \int_a^b \omega(x) f(x) g(x) \, dx.</math>
In the important special case of Шаблон:Math, we have the error estimate[6] <math display="block"> \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.</math>
Stoer and Bulirsch remark that this error estimate is inconvenient in practice, since it may be difficult to estimate the order Шаблон:Math 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 Шаблон:Math 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 Шаблон:Math points to an Шаблон:Mvar-point rule in such a way that the resulting rule is of order Шаблон:Math. 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
Also known as Lobatto quadrature,[7] named after Dutch mathematician Rehuel Lobatto. It is similar to Gaussian quadrature with the following differences:
- The integration points include the end points of the integration interval.
- It is accurate for polynomials up to degree Шаблон:Math, where Шаблон:Mvar is the number of integration points.[8]
Lobatto quadrature of function Шаблон:Math on interval Шаблон:Math: <math display="block">\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.</math>
Abscissas: Шаблон:Mvar is the <math>(i - 1)</math>st zero of <math>P'_{n-1}(x)</math>, here <math>P_m(x)</math>denotes the standard Legendre polynomial of Шаблон:Mvar-th degree and the dash denotes the derivative.
Weights: <math display="block">w_i = \frac{2}{n(n - 1)\left[P_{n-1}\left(x_i\right)\right]^2}, \qquad x_i \ne \pm 1.</math>
Remainder: <math display="block">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.</math>
Some of the weights are:
Number of points, n | Points, Шаблон:Mvar | Weights, Шаблон:Mvar |
---|---|---|
<math>3</math> | <math>0</math> | <math>\frac{4}{3}</math> |
<math>\pm 1</math> | <math>\frac{1}{3}</math> | |
<math>4</math> | <math>\pm \sqrt{\frac{1}{5}}</math> | <math>\frac{5}{6}</math> |
<math>\pm 1</math> | <math>\frac{1}{6}</math> | |
<math>5</math> | <math>0</math> | <math>\frac{32}{45}</math> |
<math>\pm\sqrt{\frac{3}{7}}</math> | <math>\frac{49}{90}</math> | |
<math>\pm 1</math> | <math>\frac{1}{10}</math> | |
<math>6</math> | <math>\pm\sqrt{\frac{1}{3}-\frac{2\sqrt{7}}{21}}</math> | <math>\frac{14+\sqrt{7}}{30}</math> |
<math>\pm\sqrt{\frac{1}{3} + \frac{2\sqrt{7}}{21}}</math> | <math>\frac{14 - \sqrt{7}}{30}</math> | |
<math>\pm 1</math> | <math>\frac{1}{15}</math> | |
<math>7</math> | <math>0</math> | <math>\frac{256}{525}</math> |
<math>\pm\sqrt{\frac{5}{11}-\frac{2}{11}\sqrt{\frac{5}{3}}}</math> | <math>\frac{124 + 7\sqrt{15}}{350}</math> | |
<math>\pm\sqrt{\frac{5}{11} + \frac{2}{11}\sqrt{\frac{5}{3}}}</math> | <math>\frac{124 - 7\sqrt{15}}{350}</math> | |
<math>\pm 1</math> | <math>\frac{1}{21}</math> |
An adaptive variant of this algorithm with 2 interior nodes[9] is found in GNU Octave and MATLAB as quadl
and integrate
.[10][11]
References
Citations
Bibliography
Шаблон:Refbegin Шаблон:Sfn whitelist
- Шаблон:AS ref
- Шаблон:Cite journal
- Шаблон:Cite news
- Шаблон:Cite web
- Шаблон:Cite journal
- Шаблон:Cite book datiert 1814, auch in Werke, Band 3, 1876, S. 163–196. English Translation by Wikisource.
- Шаблон:Cite news
- Шаблон:Cite news
- Шаблон:Cite book
- Шаблон:Citation
- Шаблон:Cite journal
- Шаблон:Cite journal
- Шаблон:Cite journal
- Шаблон:Cite book
- Шаблон:Cite journal
- Шаблон:Citation
- Шаблон:Cite journal
- Шаблон:Cite web
- Шаблон:Cite news
- Шаблон:Citation
- Шаблон:Cite book
- Шаблон:Cite journal
- Шаблон:Cite journal
- Шаблон:Citation
- Шаблон:Dlmf
- Шаблон:Cite journal
External links
- Шаблон:Springer
- ALGLIB contains a collection of algorithms for numerical integration (in C# / C++ / Delphi / Visual Basic / etc.)
- GNU Scientific Library — includes C version of QUADPACK algorithms (see also GNU Scientific Library)
- From Lobatto Quadrature to the Euler constant e
- Gaussian Quadrature Rule of Integration – Notes, PPT, Matlab, Mathematica, Maple, Mathcad at Holistic Numerical Methods Institute
- Шаблон:MathWorld
- Gaussian Quadrature by Chris Maes and Anton Antonov, Wolfram Demonstrations Project.
- Tabulated weights and abscissae with Mathematica source code, high precision (16 and 256 decimal places) Legendre-Gaussian quadrature weights and abscissas, for n=2 through n=64, with Mathematica source code.
- Mathematica source code distributed under the GNU LGPL for abscissas and weights generation for arbitrary weighting functions W(x), integration domains and precisions.
- Gaussian Quadrature in Boost.Math, for arbitrary precision and approximation order
- Gauss–Kronrod Quadrature in Boost.Math
- Nodes and Weights of Gaussian quadrature