Sei sulla pagina 1di 7

Gaussian quadrature

Gaussian integration redirects here. For the integral of


a Gaussian function, see Gaussian integral.
In numerical analysis, a quadrature rule is an approxi-

f (x) dx =
1

(x)g(x) dx

Common weighting functions include (x)


=

x2
2
1/ 1 x (ChebyshevGauss) and (x) = e
(GaussHermite).

-2

Gauss 2

It can be shown (see Press, et al., or Stoer and Bulirsch)


that the evaluation points x are just the roots of a polynomial belonging to a class of orthogonal polynomials.

-4
-6

wi g(xi ).

i=1

Trap

-8

-10
-1

1 GaussLegendre quadrature

Comparison between 2-point Gaussian and trapezoidal quadrature. The blue line is the polynomial y(x) = 7x3 8x2 3x+3
, whose integral in [1, 1] is 2/3. The trapezoidal rule returns
the integral of the orange dashed line, equal to y(1) + y(1) =
10 . The 2-point Gaussian quadrature
rule returns the
integral
of the black dashed curve, equal to y( 1/3) + y( 1/3) =
2/3 . Such a result is exact since the green region has the same
area of the red regions.

legendre polynomials
1

Pn (x)

0.5

mation of the denite integral of a function, usually stated


as a weighted sum of function values at specied points
-0.5
P(x)
P(x)
within the domain of integration. (See numerical integraP(x)
P(x)
tion for more on quadrature rules.) An n-point Gaussian
P(x)
-1
P(x)
quadrature rule, named after Carl Friedrich Gauss, is
-1
-0.5
0
0.5
1
a quadrature rule constructed to yield an exact result for
x
polynomials of degree 2n 1 or less by a suitable choice
of the points x and weights w for i = 1, ..., n. The do- Graphs of Legendre polynomials (up to n = 5)
main of integration for such a rule is conventionally taken
as [1, 1], so the rule is stated as
For the simplest integration problem stated above, i.e.
with (x) = 1 , the associated polynomials are Legendre
Pn(x), and the method is usually known as
polynomials,
1
n

GaussLegendre
quadrature. With the n-th polynomial
f (x) dx =
wi f (xi ).
1
normalized
to
give
Pn(1) = 1, the i-th Gauss node, x, is
i=1
the i-th root of P ; its weight is given by (Abramowitz &
Gaussian quadrature as above will only produce accurate Stegun 1972, p. 887)
results if the function f(x) is well approximated by a polynomial function within the range [1, 1]. The method is
not, for example, suitable for functions with singularities.
2
However, if the integrated function can be written as wi =
2 ) [P (x )]2 .
(1

x
f (x) = (x)g(x) , where g(x) is approximately polyn i
i
nomial and (x) is known, then alternative weights wi
and points xi that depend on the weighting function (x) Some low-order rules for solving the integration problem
may give better results, where
are listed below.
1

3 OTHER FORMS

Change of interval

(x) h(x) dx =
(x) r(x) dx.
An integral over [a, b] must be changed into an integral
a
a
over [1, 1] before applying the Gaussian quadrature rule.
This change of interval can be done in the following way: Because of the choice of nodes xi, the corresponding relation

ba
f (x) dx =
2

f
1

ba
a+b
x+
2
2

)
dx.

Applying the Gaussian quadrature rule then results in the


following approximation:

f (x) dx =
a

ba
wi f
2 i=1
n

a+b
ba
xi +
2
2

i=1

wi h(xi ) =

wi r(xi )

i=1

holds also. The exactness of the computed integral for


h(x) then follows from corresponding exactness for polynomials of degree only n or less (as is r(x) ).

.
3.1.1 General formula for the weights
The weights can be expressed as

Other forms

b
The integration problem can be expressed in a slightly
(x)pn1 (x)2 dx
more general way by introducing a positive weight func- wi = an a
an1 pn (xi )pn1 (xi )
tion into the integrand, and allowing an interval other
than [1, 1]. That is, the problem is to calculate
where ak is the coecient of xk in pk (x) . To prove this,
note that using Lagrange interpolation one can express
b
r(x) in terms of r(xi ) as
(x) f (x) dx
a
n

x xj
for some choices of a, b, and . For a = 1, b = 1,
r(x) =
r(xi )
xi xj
and (x) = 1, the problem is the same as that considi=1
1jn
ered above. Other choices lead to other integration rules.
j=i
Some of these are tabulated below. Equation numbers
because r(x) has degree less than n and is thus xed by
are given for Abramowitz and Stegun (A & S).
the values it attains at n dierent points. Multiplying both
sides by (x) and integrating from a to b yields

3.1

Fundamental theorem

Let p be a nontrivial polynomial of degree n such that

(x)r(x)dx =
a

i=1

r(xi )

(x)
a

(x) xk pn (x) dx = 0,
a

1jn
j=i

x xj
dx
xi xj

all fork = 0, 1, . . . , n1. The weights w are thus given by

If we pick the n nodes x to be the zeros of p , then there


b
x xj
exist n weights w which make the Gauss-quadrature comw
=
(x)
dx
i
puted integral exact for all polynomials h(x) of degree 2n
xi xj
a
1jn
1 or less. Furthermore, all these nodes x will lie in the
j=i
open interval (a, b) (Stoer & Bulirsch 2002, pp. 172
This integral expression for wi can be expressed in terms
175).
of the orthogonal polynomials pn (x) and pn1 (x) as folThe polynomial p is said to be an orthogonal polynomial
lows.
of degree n associated to the weight function (x). It is
unique up to a constant normalization factor. The idea un- We can write
derlying the proof is that, because of its suciently low
degree, h(x) can be divided by pn (x) to produce a quo

tient q(x) of degree strictly lower than n, and a remainder


pn (x)
1jn (x xj )
(x xj ) =
=
r(x) of still lower degree, so that both will be orthogonal
x xi
an (x xi )
1jn
to pn (x) , by the dening property of pn (x) . Thus
j=i

3.2

Computation of Gaussian quadrature rules

where an is the coecient of xn in pn (x) . Taking the


limit of x to xi yields using L'Hpitals rule
xn1 =

(xi xj ) =

1jn
j=i

pn (xi )
an

The term in the brackets is a polynomial of degree n 2


, which is therefore orthogonal to pn1 (x) . The integral
can thus be written as

We can thus write the integral expression for the weights


as

wi =

pn (xi )

(
)
pn1 (x)
pn1 (x)
xn1
+
an1
an1

(x)

(x)
a

pn (x)
dx
x xi

)k

1 xxi
1
=
x xi
x xi

(
+

x
xi

)k

(x)pn1 (x)2 dx
a

According to Eq. (2), the weights are obtained by dividing this by pn (xi ) and that yields the expression in Eq.
(1).

In the integrand, writing


(

pn (x)
an
dx =
x xi
an1 pn1 (xi )

1
x xi

wi can also be expressed in terms of the orthogonal polynomials pn (x) and now pn+1 (x) . In the 3-term recurrence relation pn+1 (xi ) = (a)pn (xi ) + (b)pn1 (xi ) the
term with pn (xi ) vanishes, so pn1 (xi ) in Eq. (1) can
be replaced by pn+1 (xi )/b .

yields

(x)
a

x pn (x)
dx = xki
x xi

3.1.2 Proof that the weights are positive

(x)
a

pn (x)
dx
x xi

Consider the following polynomial of degree 2n-2

provided k n , because
f (x) =
1

x
xi

)k

(x xj )2

1jn
j=i

x xi

where as above the x are the roots of the polynomial


pn (x) . Since the degree of f(x) is less than 2n-1, the
is a polynomial of degree k-1 which is then orthogonal to
Gaussian quadrature formula involving the weights and
pn (x) . So, if q(x) is a polynomial of at most nth degree
nodes obtained from pn (x) applies. Since f (xj ) = 0 for
we have
j not equal to i, we have

(x)
a

pn (x)
1
dx =
x xi
q(xi )

(x)
a

q(x)pn (x)
dx
x xi

(x)f (x)dx =
a

wj f (xj ) = wi f (xi ).

j=1

We can evaluate the integral on the right hand side for


n (x)
is a polyno- Since both (x) and f(x) are non-negative functions, it
q(x) = pn1 (x) as follows. Because pxx
i
mial of degree n-1, we have
follows that wi > 0 .
pn (x)
= an xn1 + s(x)
x xi

3.2 Computation of Gaussian quadrature


rules

where s(x) is a polynomial of degree n 2 . Since s(x) is


orthogonal to pn1 (x) we have
For computing the nodes x and weights w of Gaussian
quadrature rules, the fundamental tool is the three-term
recurrence relation satised by the set of orthogonal poly b
b
nomials associated to the corresponding weight function.
pn (x)
an
(x)
dx =
(x)pn1 (x)xn1 dxFor n points, these nodes and weights can be computed
x xi
pn1 (xi ) a
a
in O(n2 ) operations by an algorithm derived by Gautschi
We can then write
(1968).

4
3.2.1

3 OTHER FORMS
Gautschis theorem

Gautschis theorem (Gautschi, 1968) states that orthogonal polynomials pr with (pr , ps ) = 0 for r = s for a
scalar product (, ) to be specied later, degree (pr ) = r
and leading coecient one (i.e. monic orthogonal polynomials) satisfy the recurrence relation

3.2.2 The Golub-Welsch algorithm


The three-term recurrence relation can be written in the
matrix form J P = xP pn (x) en where P =
[p0 (x), p1 (x), ..., pn1 (x)]T , en is the n th standard basis vector, i.e. en = [0, ..., 0, 1]T , and J is the so-called
Jacobi matrix:

a0
b1

0
J=
0

. . .
...

pr+1 (x) = (xar,r )pr (x)ar,r1 pr1 (x) . . .ar,0 p0 (x)

1
0
...
a1 1
0
b2 a2
1
... ... ...
. . . 0 bn2
... ...
0

...
...
0
...
an2
bn1

...
...

...

1
an1

for r = 0, 1, . . . , n 1 where n is the maximal degree which can be taken to be innity, and where ar,s =
(xpr , ps )/(ps , ps ) . First of all, it is obvious that the
polynomials dened by the recurrence relation starting
with p0 (x) = 1 have leading coecient one and correct
degree. Given the starting point by p0 , the orthogonality The zeros xj of the polynomials up to degree n which are
of pr can be shown by induction. For r = s = 0 one has used as nodes for the Gaussian quadrature can be found
by computing the eigenvalues of this tridiagonal matrix.
This procedure is known as GolubWelsch algorithm.
(p1 , p0 ) = ((xa0,0 p0 , p0 ) = (xp0 , p0 )a0,0 (p0 , p0 ) = (xp
p0 )(xp0 ,the
p0 )weights
= 0. and nodes, it is preferable to
For0 ,computing
Now if p0 , p1 , . . . , pr are orthogonal, then also pr+1 , consider the symmetric tridiagonal matrix J with elements
because in
i = 1, . . . , n
(pr+1 , ps ) = (xpr , ps )ar,r (pr , ps )ar,r1 (pr1 , ps ) . . .ar,0 (p0 , psJ) i,i = Ji,i = ai1

Ji1,i = Ji,i1 = Ji,i1 Ji1,i = bi1 i = 2, . . . , n.


all scalar products vanish except for the rst one and
the one where ps meets the same orthogonal polynomial. J and J are similar matrices and therefore have the same
Therefore,
eigenvalues (the nodes). The weights can be computed
from the corresponding eigenvectors: If (j) is a normalized eigenvector (i.e., an eigenvector with euclidean norm
(pr+1 , ps ) = (xpr , ps )ar,s (ps , ps ) = (xpr , ps )(xpr , pequal
s ) = 0.
to one) associated to the eigenvalue x , the corresponding weight can be computed from the rst compoHowever, if the scalar product satises (xf, g) = (f, xg)
nent of this eigenvector, namely:
(which is the case for Gaussian quadrature), the recurrence relation reduces to a three-term recurrence relation:
For s r 1, xps is a polynomial of degree less or equal
)2
(
(j)
to r 1. On the other hand, pr is orthogonal to every wj = 0 1
polynomial of degree less or equal to r 1. Therefore,
one has (xpr , ps ) = (pr , xps ) = 0 and ar,s = 0 for s < where 0 is the integral of the weight function
r 1. The recurrence relation then simplies to

pr+1 (x) = (x ar,r )pr (x) ar,r1 pr1 (x)

0 =

or

See, for instance, (Gil, Segura & Temme 2007) for further details.

pr+1 (x) = (x ar )pr (x) br pr1 (x)


(with the convention p1 (x) 0 ) where

ar :=

(xpr , pr )
,
(pr , pr )

(x)dx.
a

3.3 Error estimates

The error of a Gaussian quadrature rule can be stated as


follows (Stoer & Bulirsch 2002, Thm 3.6.24). For an in(xpr , pr1 )
(pr , pr ) tegrand which has 2n continuous derivatives,
br :=
=
(pr1 , pr1 )
(pr1 , pr1 )

(the last because of (xpr , pr1 ) = (pr , xpr1 ) =


n
b

f (2n) ()
(pr , pr ) , since xpr1 diers from pr by a degree less
(x) f (x) dx
wi f (xi ) =
(pn , pn )
(2n)!
than r).
a
i=1

5
for some in (a, b), where p is the monic (i.e. the leading
coecient is 1) orthogonal polynomial of degree n and
where

f (x) dx =

(f, g) =

n1

2
[f (1)+f (1)]+
wi f (xi )+Rn .
n(n 1)
i=2

Abscissas: x is the (i 1) st zero of Pn1


(x) .

(x)f (x)g(x) dx.

Weights:

In the important special case of (x) = 1, we have the


error estimate (Kahaner, Moler & Nash 1989, 5.2)
wi =
(b a)2n+1 (n!)4 (2n)
f
(),
(2n + 1)[(2n)!]3

2
,
n(n 1)[Pn1 (xi )]2

xi = 1.

Remainder:
a < < b.

n(n 1)3 22n1 [(n 2)!]4 (2n2)


R
=
f
(),
n
Stoer and Bulirsch remark that this error estimate is in(2n 1)[(2n 2)!]3
convenient in practice, since it may be dicult to estimate the order 2n derivative, and furthermore the ac- Some of the weights are:
tual error may be much less than a bound established by
the derivative. Another approach is to use two Gaussian
quadrature rules of dierent orders, and to estimate the 4 See also
error as the dierence between the two results. For this
purpose, GaussKronrod quadrature rules can be useful.
EulerMaclaurin formula

1 < < 1.

ClenshawCurtis quadrature

3.4

GaussKronrod rules

Main article: GaussKronrod quadrature formula

5 References

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.
GaussKronrod 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 dierence between a Gauss quadrature rule and its
Kronrod extension are often used as an estimate of the
approximation error.

Abramowitz, Milton; Stegun, Irene A., eds. (December 1972) [1964]. Chapter 25.4, Integration. Handbook of Mathematical Functions with
Formulas, Graphs, and Mathematical Tables. Applied Mathematics Series 55 (10 ed.). New York,
USA: United States Department of Commerce,
National Bureau of Standards; Dover Publications.
ISBN 978-0-486-61272-0. LCCN 64-60036. MR
0167642.

3.5

Golub, Gene H.; Welsch, John H. (1969),


Calculation of Gauss Quadrature Rules, Mathematics of Computation 23 (106): 221230,
doi:10.1090/S0025-5718-69-99647-1,
JSTOR
2004418

GaussLobatto rules

Also known as Lobatto quadrature (Abramowitz & Stegun 1972, p. 888), named after Dutch mathematician
Rehuel Lobatto. It is similar to Gaussian quadrature with
the following dierences:
1. The integration points include the end points of the
integration interval.
2. It is accurate for polynomials up to degree 2n
3, where n is the number of integration points
(Quarteroni, Sacco & Saleri 2000).
Lobatto quadrature of function f(x) on interval [1, 1]:

Anderson, Donald G. (1965). Gaussian quadrature


1
formulae for 0 ln(x)f (x)dx ". Math. Comp.
19 (91): 477481. doi:10.1090/s0025-5718-19650178569-1.

Gautschi, Walter (1968). Construction of Gauss


Christoel Quadrature Formulas. Math. Comp.
22 (102). pp. 251270. doi:10.1090/S0025-57181968-0228171-0. MR 0228171.
Gautschi, Walter (1970). On the construction
of Gaussian quadrature rules from modied moments. Math. Comp. 24. pp. 245260.
doi:10.1090/S0025-5718-1970-0285117-6. MR
0285177.

6
Piessens, R. (1971). Gaussian quadrature formulas
for the numerical integration of Bromwichs integral
and the inversion of the laplace transform. J. Eng.
Math. 5 (1). pp. 19. doi:10.1007/BF01535429.
Danloy, Bernard (1973).
Numerical construction of Gaussian quadrature formulas for
1

( log x)x f (x)dx and


Em (x)f (x)dx
0
0
". Math. Comp. 27 (124). pp. 861869.
doi:10.1090/S0025-5718-1973-0331730-X. MR
0331730.

EXTERNAL LINKS

Quarteroni, Alo; Sacco, Riccardo; Saleri, Fausto


(2000). Numerical Mathematics. New York:
Springer-Verlag. pp. 422, 425. ISBN 0-38798959-5.

6 External links
Hazewinkel, Michiel, ed. (2001), Gauss quadrature formula, Encyclopedia of Mathematics,
Springer, ISBN 978-1-55608-010-4

Kahaner, David; Moler, Cleve; Nash, Stephen


(1989), Numerical Methods and Software, PrenticeHall, ISBN 978-0-13-627258-8

ALGLIB contains a collection of algorithms for numerical integration (in C# / C++ / Delphi / Visual
Basic / etc.)

Sagar, Robin P. (1991). A Gaussian quadrature for the calculation of generalized Fermi-Dirac
integrals. Comp. Phys. Commun. 66 (23): 271275.
Bibcode:1991CoPhC..66..271S.
doi:10.1016/0010-4655(91)90076-W.

GNU Scientic Library includes C version of


QUADPACK algorithms (see also GNU Scientic
Library)

Yakimiw, E. (1996).
Accurate computation of weights in classical Gauss-Christoel
quadrature rules.
J. Comp.
Phys.
129:
406430.
Bibcode:1996JCoPh.129..406Y.
doi:10.1006/jcph.1996.0258.

Gaussian Quadrature Rule of Integration Notes,


PPT, Matlab, Mathematica, Maple, Mathcad at
Holistic Numerical Methods Institute

Laurie, Dirk P. (1999), Accurate recovery of recursion coecients from Gaussian quadrature formulas, J. Comp. Appl. Math. 112 (1-2): 165180,
doi:10.1016/S0377-0427(99)00228-9

Gaussian Quadrature by Chris Maes and Anton


Antonov, Wolfram Demonstrations Project.

Laurie, Dirk P. (2001).


Computation
of Gauss-type quadrature formulas.
J.
Comp.
Appl.
Math.
127 (1-2): 201
217.
Bibcode:2001JCoAM.127..201L.
doi:10.1016/S0377-0427(00)00506-9.
Stoer, Josef; Bulirsch, Roland (2002), Introduction
to Numerical Analysis (3rd ed.), Springer, ISBN
978-0-387-95452-3.
Temme, Nico M. (2010), "3.5(v): Gauss Quadrature, in Olver, Frank W. J.; Lozier, Daniel M.;
Boisvert, Ronald F.; Clark, Charles W., NIST Handbook of Mathematical Functions, Cambridge University Press, ISBN 978-0521192255, MR 2723248
Press, WH; Teukolsky, SA; Vetterling, WT; Flannery, BP (2007), Section 4.6. Gaussian Quadratures and Orthogonal Polynomials, Numerical
Recipes: The Art of Scientic Computing (3rd ed.),
New York: Cambridge University Press, ISBN 9780-521-88068-8
Gil, Amparo; Segura, Javier; Temme, Nico M.
(2007), "5.3: Gauss quadrature, Numerical Methods for Special Functions, SIAM, ISBN 978-089871-634-4

From Lobatto Quadrature to the Euler constant e

Weisstein, Eric W., Legendre-Gauss Quadrature,


MathWorld.

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.

Text and image sources, contributors, and licenses

7.1

Text

Gaussian quadrature Source: https://en.wikipedia.org/wiki/Gaussian_quadrature?oldid=703626244 Contributors: AxelBoldt, Michael


Hardy, Kku, Ejrh, Stevenj, Cherkash, Jitse Niesen, Taxman, Robbot, Hankwang, Jaredwf, Wile E. Heresiarch, Giftlite, Rafaelgr, MSGJ,
Phe, MarkSweep, Richard Stephens, Teorth, Scareduck, Keenan Pepper, Count Iblis, Mindmatrix, LOL, Casey Abell, Rjwilmsi, Bgwhite,
Encyclops, KSmrq, Zwobot, Ilmari Karonen, Itub, Berland, Mhym, Salamurai, Jrvz, Highpriority, Hu12, Dsspiegel, Az1568, Shorespirit,
Myasuda, Headbomb, Beta16, Stevvers, Gwern, Sibi antony, Pedrito, Qiqi.wang, TomyDuby, Policron, Yecril, Pleasantville, JohnBlackburne, TXiKiBoT, Rako77, SieBot, Ulrigo, Moonliterhythm, Paolostar, ClueBot, Christos Argyropoulos, Mild Bill Hiccup, He7d3r, Brews
ohare, Filipovisck, DentonW, Qwfp, Whitetmac17, Skarebo, Kbdankbot, Addbot, Segurajj, Kisbesbot, Tide rolls, Yobot, Mech Aaron,
AnomieBOT, Cygnine, He504, PavelSolin, Xqbot, Bdmy, Dneprodzerzhinsk, FrescoBot, Citation bot 1, Jujutacular, Vitavita, Pavel.zorin,
EmausBot, ZroBot, Cosmoskramer, R. J. Mathar, Advanpix, Helpful Pixie Bot, Electriccatsh2, Araqir, Bibcode Bot, ServiceAT, Mazecooperation, ChrisGualtieri, Stefan.Groote, Saullogiovani, Benmccanna, Didigodot, Ruhland~enwiki, Xavives, Abacenis, Zhaiqing and
Anonymous: 79

7.2

Images

File:Comparison_Gaussquad_trapezoidal.svg Source:
https://upload.wikimedia.org/wikipedia/commons/9/93/Comparison_
Gaussquad_trapezoidal.svg License: CC BY-SA 4.0 Contributors: Own work Original artist: Paolostar
File:Legendrepolynomials6.svg Source: https://upload.wikimedia.org/wikipedia/commons/c/c8/Legendrepolynomials6.svg License:
CC BY-SA 3.0 Contributors: Own work Original artist: Geek3

7.3

Content license

Creative Commons Attribution-Share Alike 3.0

Potrebbero piacerti anche