Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

Analyse Numérique

K. Jbilou
jbilou@univ-littoral.fr

CP2, EILCO, Calais, France

K. Jbilou (LMPA, ULCO) 1 / 15


Chapter II: Quadrature

The problem
Particular cases
Composite formulas
Orthogonal Polynomials
The Gauss Quadrature

K. Jbilou (LMPA, ULCO) 2 / 15


The Problem

Find an approximation to the integral


Z b
I (f ) = f (x)dx. (1)
a
Z b
or in general I (f ) = f (x)w (x)dx where w is some positive function
a
called weight function.
We assume that f has no known primitive or f is known only at some fixed
points in [a, b]. So the idea is to replace f by its polynomial interpolation
Pn at some distinct points x0 , . . . , xn and to approximate I (f ) by I (Pn ).
Let us express Pn in the Lagrange basis:
n
X
Pn (x) = f (xi )Li (x). (2)
i=0

K. Jbilou (LMPA, ULCO) 3 / 15


Some Particular Cases

The case n = 0 and x0 = a


Let us set n = 0 and take x0 = a,. Then in this case P0 is a constant
polynomial given by
Z b
P0 (x) = f (a), and then I (P0 ) = f (a)dx = f (a)(b − a).
a

The error is given by


Z b
E (f ) = [a, x]f (x − a) dx and by using the mean value theorem, we get
a
Z b
= [a, ξ]f (x − a)dx, avec a < ξ < b (if f is derivable in ]a, b[)
a

K. Jbilou (LMPA, ULCO) 4 / 15


which gives the following expression of the error:

(b − a)2
E (f ) = f 0 (η)
avec a < η < ξ ≤ b.
2
Then we get the following integration formulae called ”Left-Rectangle”
(assuming that f is derivable):

b
(b − a)2
Z
I (f ) = f (x) dx = f (a)(b − a) + f 0 (η) , a < η < b.
a 2

We obtain the approximation (Left-Rectangle formulae):


Z b
f (x)dx ≈ f (a)(b − a).
a

K. Jbilou (LMPA, ULCO) 5 / 15


a+b
The case n = 0 and x0 = .
2
In that case, we get the middle-rectangle formulae . So
   
a+b a+b
P0 (x) = f , and I(P0 ) = f (b − a).
2 2

The error is given by


Z b
E (f ) = [x0 , x]f (x − x0 ) dx .
a

As the sign of (x − x0 ) is changing in [a, b], the mean-value theorem


couldn’t be applied.

K. Jbilou (LMPA, ULCO) 6 / 15


We use the following decomposition
Z b
E (f ) = ([x0 , x0 ]f + [x0 , x0 , x]f (x − x0 )) (x − x0 ) dx
a
(b − a)3
= f 00 (η) , a < η < ξ < b, using Cauchy theorem.
24
Then, if f is twice derivable, we get the formulae (Middle formulae)

b
(b − a)3
Z  
a+b 00
I (f ) = f (x) dx = f (b − a) + f (η) , a ≤ η ≤ b.
a 2 24

K. Jbilou (LMPA, ULCO) 7 / 15


The case n = 1, x0 = a and x1 = b: Trapeze formulae

We have
(f(a) + f(b))
P1 (x) = f(a) + [a, b]f (x − a), and I(P1 ) = (b − a) .
2
The error is given by (assuming that f is twice derivable):
Z b
E (f ) = [a, b, x]f (x − a)(x − b) dx and by the mean theorem, we get
a
Z b
1 00 −1 00
= f (η) (x − a)(x − b) dx = f (η)(b − a)3 with a < η < b
2 a 12

We get the Trapeze formulae:

Z b
1 1
I (f ) = f (x) dx = (b − a) (f (a) + f (b))− f 00 (η)(b−a)3 , a < η < b.
a 2 12
K. Jbilou (LMPA, ULCO) 8 / 15
a+b
The casen = 2, x0 = a and x1 = , x2 = b,: The
2
Simpson formulae
In this case the interpolation polynomial is given by

P2 (x) = f(a) + [a, b]f (x − a) + [a, b, (a + b)/2]f (x − a)(x − b).

Then    
b−a a+b
I (P0 ) = f (a) + 4f + f (b)
6 2

and
Z b  
a+b a+b
E (f ) = , b, x]f (x − a) x −
[a, (x − b) dx .
a 2 2
 
a+b
As the sign of (x − a) x − (x − b) is changing in [a, b], the mean
2
value theorem couldn’t be applied.
K. Jbilou (LMPA, ULCO) 9 / 15
In that case, we use the following decomposition
Z b
a+b a+b a+b
E (f ) = [a,
, b, ]f (x − a)(x − )(x − b) dx
a 2 2 2
Z b
a+b a+b a+b a+b
+ [a, , b, , x]f (x − )(x − a)(x − )(x − b) d
a 2 2 2 2
a+b 2
Z b
f (4) (η)
 
= (x − a) x − (x − b) dx
4! a 2
(if f has a forth derivative order, and using the mean value theore
1
= − (b − a)5 f (4) (η), avec a < η < b.
2880

K. Jbilou (LMPA, ULCO) 10 / 15


Finally, the Simpson formulae is given as
   
b−a a+b 1
I (f ) = f (a) + 4f + f (b) − .(b − a)5 f (4) (η), a < η <
6 2 2880

The integral is approximated by

b    
b−a
Z
a+b
I (f ) = f (x) dx ≈ f (a) + 4f + f (b)
a 6 2

K. Jbilou (LMPA, ULCO) 11 / 15


The composite formulas

We decompose the interval [a, b] into N small intervals (where N is fixed)


using a subdivision (αi ). Then

Z b N Z
X αi
f (x)dx = f (x)dx
a i=1 αi−1

with a = α0 < α1 < α2 < · · · < αN−1 < αN = b and then we apply one
of the formulas seen before to each interval [αi−1 , αi ] for i = 1, . . . , N.
For simplification, we choose equidistant points αi in [a, b] which means
that αi − αi−1 = h = cst., and this gives

αi= a + i h, 0 ≤ i ≤ N with
b−a
h =
N

K. Jbilou (LMPA, ULCO) 12 / 15


The composite rectangle method

N Z αi N N
X X h2 X 0
f (x)dx = h f (αi−1 ) + f (ηi ), avec αi−1 < ηi < αi , 1 ≤
αi−1 2
i=1 i=1 i=1
N
X h2
= h f (αi−1 ) + Nf 0 (ζ), avec a ≤ ζ ≤ b.
2
i=1

Z b
h
f (x)dx = h [f (a) + f (a + h) + · · · + f (a + (N − 1)h)] + (b − a)f 0 (ζ),
a 2

If f is of class C 1 ([a, b]) then we obtain a convergent formulae (the error is


a O(h)):
N−1
"Z #
b X
lim f (x)dx − h f (a + i h) = 0.
n→∞ a i=0
K. Jbilou (LMPA, ULCO) 13 / 15
The middle composite method

In the same manner and assuming that f is of class C 2 ([a, b]), we get the
composite-middle formulae

Z b  
h 3h 1
f (x)dx = h f (a + ) + f (a + ) + · · · + f (a + (N − )h)
a 2 2 2
h 2
+ (b − a)f 00 (ζ), a ≤ ζ ≤ b.
24
Here the error is in O(h2 ) which is better than the preceding formulae.
N−1
"Z #
b X h
lim f (x)dx − h f (a + (2i + 1) ) = 0.
n→∞ a 2
i=0

K. Jbilou (LMPA, ULCO) 14 / 15


The composite Simpson method

Interpolating f by a polynomial of degree 2 in [αi−1 , αi ], at the points


αi + αi−1
αi−1 , , αi we get the Simpson formulae
2
Z αi
h5 (4)
   
h αi + αi−1
f (x)dx = f (αi−1 ) + 4f + f (αi ) − f (ηi ),
αi−1 6 2 2880
αi−1 < ηi < αi
Summing all these integrals gives the composite Simpson formulae as
follows

Z b
h h h
f (x)dx = [f (a)+ 4f (a + ) + 2f (a + h) + 4f (a + 3 ) + · · ·
a 6 2 2
1 (b − a) 4
+ 2f (a + (N − 1)h) + 4f (a + (N − )h) + f (b)] − h
2 2880
If f ∈ C 4 ([a, b]) then the error is an O(h4 ).
K. Jbilou (LMPA, ULCO) 15 / 15

You might also like