Académique Documents
Professionnel Documents
Culture Documents
11 Interpollation
11 Interpollation
Mthodes numriques
pour lingnieur
Interpolation
f(x)
Approximation de fonctions
Soit une fonction f (inconnue explicitement)
connue seulement en certains points x0,x1xn
ou valuable par un calcul coteux.
Principe :
reprsenter f par une fonction simple, facile valuer
Problme :
il existe une infinit de solutions !
2
1
0
-1
-2
-3
-4
0
0.2
0.4
0.6
0.8
1.2
1.4
1.6
1.8
Approximation de fonctions
Il faut se restreindre une famille de fonctions
polynmes,
exponentielles,
fonctions trigonomtriques
2
1
0
-1
-2
-3
-4
0.2
0.4
0.6
0.8
1.2
1.4
1.6
1.8
Interpolation d'Hermite
informations sur les drives de la fonction approcher
...voir le groupe de TT
4
x [a, b]
)+
ff(x)+(x
P(x)
P (x)
f(x)
f (x)
f (x)
f(x)-
ab
ab
Interpolation :
n + 1 points, n + 1 contraintes, n + 1 quations, n + 1 inconnues : ordre n5
Interpolation polynomiale
Le problme : les donnes, la solution recherche
( x0 , y0 = f ( x0 ) ),..., ( xi , yi = f ( xi ) ),..., ( xi , yi = f ( xi ) )
P( x) tel que P ( xi ) = f ( xi ), i = 0, n
ji
ainsi P( xi ) = y0 P0 ( xi ) + ... + yi Pi ( xi ) + yn Pn ( xi )
0
1
0
Construction de p :
p( x ) = y i Li ( x )
i =0
(x x )
L (x)=
(x x )
n
j =0
j i
Li(xi)=1
Li(xj)=0 (j i)
7
Lagrange : exemple n1
Exemple avec n=1
on connat 2 points (x0,y0) et (x1,y1)
on cherche la droite y=ax+b (polynme de degr 1)
qui passe par les 2 points :
y0 = a x0 + b
y1 = a x1 + b
y1
y0
y0 y1
x 0 y 1 x1 y 0
y=
x+
x0 x 1
x0 x1
x0
x1
x x0
x x0
x x1
x x1
y1
= y0
+ y1
y = y0
x0 x1
x 0 x1
x0 x1
x1 x0
L0(x)
L1(x)
8
Lagrange : exemple n2
Exemple avec n=2
on connat 3 points (0,1), (2,5) et (4,17)
polynmes de Lagrange associs :
(
x( x 2 )
x( x 4 )
x 2 )(x 4 )
L2 ( x ) =
L1 ( x ) =
L0 ( x ) =
8
8
4
Lagrange : exemple n2
calcul du polynme d'interpolation
30
25
20
15
10
0
-1
10
Lagrange : lalgorithme
Fonction y = lagrange(x,xi,yi)
pour i = 1 jusqu' n
pour j = 1 jusqu' n, j i;
x xi ( j )
l l*
xi (i ) xi ( j )
fait
y y + yi * l
fait
Complexit du calcul : n2
11
Lagrange : exemple n3
Exemple avec n=2
50
40
30
20
10
-10
-1
12
Lagrange : exemple n3
Erreur d'interpolation e(x) = f(x) - p(x)
60
50
40
30
20
10
-10
-20
-1
13
e( x ) =
( ) (x )
(n + 1)!
NB : dpend de x
.
14
Lagrange : choix de n
Supposons que l'on possde un nb lev de points pour
approcher f faut-il tous les utiliser ?
(calculs lourds)
Mthode de Neville :
on augmente progressivement n
on calcule des Li de manire rcursive
on arrte ds que l'erreur est infrieure un seuil
(dou lutilit du calcul de lerreur)
15
La mthode de Neuville
Dfinition
Pm1 ,m2 ,...,mk ( x) polynme de Lagrange calcul sur
xi x j
Dmonstration
P( xi ) = f ( xi ); P( x j ) = f ( x j ) et P( xk ) = f ( xk )
Application systmatique
x0
x1
x2
x3
P0 = Q0,0
P1 = Q1,0
P2 = Q2,0
P3 = Q3,0
P0,1 = Q1,1
P1, 2 = Q2,1
P2,3 = Q3,1
Qi , j = Pi j ,i j +1,...,i 1,i
P0,1, 2 = Q2, 2
P1, 2,3 = Q3, 2
P0,1, 2, 4 = Q3,3
16
Lalgorithme de Neuville
Fonction y = Neuville(x,xi,yi)
pour i = 1 jusqu' n
Q (i,0) yi (i )
fait
pour i = 1 jusqu' n
pour j = 1 jusqu' i
( x xi (i j ) )Q(i,j 1 ) ( x xi (i ) )Q(i 1,j 1 )
Q(i,j)
xi (i ) xi (i j )
fait
y Q (n, n)
fait
Complexit du calcul : n2
17
18
19
avec k = 0 n
erreur d'interpolation :
e(x) = f [x0, x1,, xn, x] (x)
20
x0
f [x0]
x1 f [x1]
x2 f [x2]
xn
f [xn]
a1
f [x0, x1]
f [x1, x2]
f [xn-1, xn]
a2
an
21
Newton : exemple
(ex. n2) : n=2
a0
f [x0]=1
f [x1]=5
f [x2]=17
a1
f [x0, x1]
=(1-5)/(0-2)=2
f [x1, x2]
=(5-17)/(2-4)=6
p(x)=1 + 2x + x(x-2)
Newton : lalgorithme
Fonction a = Newton(xi,yi)
pour i = 1 jusqu' n
F (i,0) yi (i )
fait
pour i = 1 jusqu' n
pour j = 1 jusqu' i
F(i,j 1 ) F(i 1,j 1 )
F(i,j)
xi (i ) xi (i j )
fait
fait
pour i = 1 jusqu' n
a(i) F (n, i )
fait
Complexit du calcul : n2
23
avec 9 points
-2
-4
-6
-6
-4
-2
24
25
Remarque :
Il faut des conditions supplmentaires pour dfinir la spline
dinterpolation de faon unique
Ex. de conditions supplmentaires :
g"(a) = g"(b) = 0
spline naturelle.
26
Splines : illustration
P2(x)=a2 (x-x2) 3+b2 (x-x2) 2+c2 (x-x2) +d2
P1(x)=1x3+1x2+1x+1
=a1 (x-x1)3+b1 (x-x1) 2+c1 (x-x1) +d1
27
Notations :
hi = xi+1 - xi
pour i = 0 n-1
i= [xi; xi+1]
gi(x) le polynme de degr 3 qui concide avec g sur lintervalle i
28
on intgre
(ai constante)
on continue
(bi constante)
gi(xi) = yi
gi(xi+1) = yi+1
x xi
xi + 1 x
+ mi
hi
hi
(
(
xi +1 x )2
x xi )2
g i (x ) = mi +1
mi
+ ai
2hi
2hi
g i(x ) = mi +1
g i (x ) = mi +1
(x xi )3 + m (xi +1 x )3 + a (x x ) + b
i
6 hi
mi hi 2
yi =
+ bi
6
1
yi +1
6 hi
mi +1 hi 2
=
+ ai hi + bi
6
29
g i (xi ) = mi
hi
hi 1
+ ai = mi
+ ai 1 = g i1 (xi ) 3
2
2
hi
1
ai = ( yi +1 yi ) (mi +1 mi )
hi
6
( yi yi 1 )
= 6 ( y i +1 yi )
hi 1
hi
(spline naturelle)
30
( yi yi 1 )
= 6 ( y i +1 yi )
hi 1
hi
Tm=f
( y i 1 2 y i + y i + 1 ) =
fi
1
0 m1 f 1
4 1
l = l
p p p
1 4 1
1 4 mn 1 f n 1
f (i 1) 6
hi
hi 1
fait
T T (2:n-1,2:n-1)
m T \ f
m [0, m,0]
pour i = 1; n 1
h
1
a(i ) ( yi +1 yi ) i (mi +1 mi )
6
hi
mi hi
b(i ) y (i )
6
fait
Complexit du calcul : complexit du solveur
32
avec 9 points
spline
-2
-4
-6
-6
polynme de degr 8
-4
-2
33
Conclusion
Interpolation polynomiale
valuer la fonction en un point : Polynme de Lagrange ->
mthode de Neville
compiler la fonction : Polynme de Newton
approximation - apprentissage
34