You are on page 1of 12

Gaussian Quadratures

• Newton-Cotes Formulae
– use evenly-spaced functional values
– Did not use the flexibility we have to select the quadrature points
• In fact a quadrature point has several degrees of freedom.
Q(f)=∑i=1m ci f(xi)
A formula with m function evaluations requires specification of
2m numbers ci and xi
• Gaussian Quadratures
– select both these weights and locations so that a higher order
polynomial can be integrated (alternatively the error is proportional
to a higher derivatives)
• Price: functional values must now be evaluated at non-
uniformly distributed points to achieve higher accuracy
• Weights are no longer simple numbers
• Usually derived for an interval such as [-1,1]
• Other intervals [a,b] determined by mapping to [-1,1]
Gaussian Quadrature on [-1, 1]
1 n

∫ f ( x )dx ≈ ∑ c i f ( x i ) = c 1 f ( x 1 ) + c 2 f ( x 2 ) + L + c n f ( x n )
−1
i =1

• Two function evaluations:


– Choose (c1, c2, x1, x2) such that the method yields “exact
integral” for f(x) = x0, x1, x2, x3

1
n=2: ∫−1
f(x)dx
= c 1 f(x 1 ) + c 2 f(x 2 )

-1 x1 x2 1
Finding quadrature nodes and weights
• One way is through the theory of orthogonal
polynomials.
• Here we will do it via brute force
• Set up equations by requiring that the 2m points
guarantee that a polynomial of degree 2m-1 is integrated
exactly.
• In general process is non-linear
– (involves a polynomial function involving the unknown point
and its product with unknown weight)
– Can be solved by using a multidimensional nonlinear solver
– Alternatively can sometimes be done step by step
Gaussian Quadrature on [-1, 1]
1
n=2: ∫
−1
f(x)dx = c 1 f(x 1 ) + c 2 f(x 2 )
Exact integral for f = x0, x1, x2, x3
– Four equations for four unknowns
⎧f 1
= 1 ⇒ ∫ 1dx = 2 = c 1 + c 2 ⎧c 1 = 1
⎪ −1
⎪c = 1
⎪ 1
⎪ 2
⎪f = x ⇒ ∫ xdx = 0 = c 1 x 1 + c 2 x 2 −1
−1 ⎪
⎨ 1 2 ⇒ ⎨ x1 =
⎪f = x ⇒ ∫ x dx = = c 1 x 12 + c 2 x 22
2 2
⎪ 3
⎪ −1 3 ⎪ 1
⎪f 1
= x ⇒ ∫ x 3 dx = 0 = c 1 x 13 + c 2 x 23
3 ⎪ x2 = 3
⎩ −1

1 1 1
I = ∫ f ( x )dx = f ( − )+ f ( )
−1
3 3
Error
• If we approximate a function with a Gaussian quadrature
formula we cause an error proportional to 2n th
derivative
Gaussian Quadrature on [-1, 1]
1
n=3: ∫−1
f ( x )dx = c 1 f ( x 1 ) + c 2 f ( x 2 ) + c 3 f ( x 3 )

-1 x1 x2 x3 1
• Choose (c1, c2, c3, x1, x2, x3) such that the method
yields “exact integral” for f(x) = x0, x1, x2, x3,x4, x5
Gaussian Quadrature on [-1, 1]
1
f = 1 ⇒ ∫ xdx = 2 = c1 + c2 + c3
−1
1
f = x ⇒ ∫ xdx = 0 = c1 x1 + c2 x2 + c3 x3
−1 ⎧c1 = 5 / 9
1 ⎪c = 8 / 9
2 ⎪ 2
f = x ⇒ ∫ x dx = = c1 x12 + c2 x22 + c3 x32
2 2

−1
3 ⎪⎪c3 = 5 / 9
⇒⎨
⎪ x1 = − 3 / 5
1
f = x 3 ⇒ ∫ x 3dx = 0 = c1 x13 + c2 x23 + c3 x33
−1
⎪ x2 = 0
1

2 ⎪⎩ x3 = 3 / 5
f = x ⇒ ∫ x dx = = c1 x14 + c2 x24 + c3 x34
4 4

−1
5
1
f = x 5 ⇒ ∫ x 5 dx = 0 = c1 x15 + c2 x25 + c3 x35
−1
Gaussian Quadrature on [-1, 1]

Exact integral for f = x0, x1, x2, x3, x4, x5

1 5 3 8 5 3
I=∫ f ( x )dx = f ( − )+ f (0 )+ f ( )
−1 9 5 9 9 5
Gaussian Quadrature on [a, b]
Coordinate transformation from [a,b] to [-1,1]

b−a b+a
t= x+
2 2
⎧ x = −1 ⇒ t = a

⎩x = 1 ⇒ t = b

a t1 t2 b
b 1 b−a b+a b−a 1
∫a
f ( t )dt = ∫
−1
f(
2
x+
2
)(
2
)dx = ∫ g ( x )dx
−1
Example: Gaussian Quadrature
4
Evaluate I = ∫ te dt = 5216.926477
2t
0
Coordinate transformation
b−a b+a
t= x+ = 2 x + 2; dt = 2dx
2 2
4 1 1
I = ∫ te dt = ∫ (4 x + 4)e
2t 4 x+4
dx = ∫ f ( x)dx
0 −1 −1

Two-point formula

4 4
1 −1 1 4 4− 4 4+
I = ∫ f ( x )dx = f ( )+ f ( )= (4 − )e 3
+(4 + )e 3
−1
3 3 3 3
= 9.167657324 + 3468.376279 = 3477.543936 ( ε = 33.34%)
Example: Gaussian Quadrature
Three-point formula
1 5 8 5
I = ∫ f ( x )dx = f ( − 0.6 ) + f ( 0 ) + f ( 0.6 )
−1 9 9 9
5 4 − 0 .6 8 5
= ( 4 − 4 0.6 )e + ( 4 )e + ( 4 + 4 0.6 )e 4 + 0.6
4

9 9 9
5 8 5
= ( 2.221191545 ) + ( 218.3926001 ) + ( 8589.142689 )
9 9 9
= 4967.106689 ( ε = 4.79%)
Four-point formula

I = ∫ f ( x )dx = 0.34785[ f ( −0.861136 ) + f ( 0.861136 )]


1

−1
+ 0.652145 [ f ( −0.339981 ) + f ( 0.339981 )]
= 5197.54375 ( ε = 0.37%)
Other rules
• Gauss-Lobatto:
– requiring end points be included in the formula
• Gauss-Radau
– Require one end point be in the formula

You might also like