Académique Documents
Professionnel Documents
Culture Documents
Interpolation Polynomiale
Interpolation Polynomiale
Interpolation Polynomiale
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 1.2 1.4 1.6 1.8
Approximation de fonctions
Il faut se restreindre une famille de fonctions
polynmes, exponentielles, fonctions trigonomtriques
Interpolation d'Hermite
informations sur les drives de la fonction approcher
...voir le groupe de TT
4
f(x)-
f (x)
ab
ab
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
Construction de p :
p( x ) = y i Li ( x )
i =0
(x x ) L (x)= (x x )
n j i j =0 j i i j
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 a = (y0 - y1) / (x0 - x1) b = (x0 y1 - x1 y0) / (x0 - x1)
y1 y0 x0 x1
y0 y1 x 0 y 1 x1 y 0 y= x+ x0 x 1 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 2 )(x 4 ) L ( x ) = x(x 4 ) x( x 2 ) L2 ( x ) = L0 ( x ) = 1 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
(fonction approcher y=ex) on connat 3 points (0,1), (2,7.3891) et (4,54.5982) Polynme d'interpolation
p(x) =L0(x) + 7.3891 L1(x) + 54.5982 L2(x)
60 50
40
30
20
10
-10 -1 0 1 2 3 4 5
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)!
.
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
Dmonstration
xi x j
P( xi ) = f ( xi ); P( x j ) = f ( x j ) et P( xk ) = f ( xk )
Qi , j = Pi j ,i j +1,...,i 1,i
Application systmatique
x0 x1 x2 x3 P0 = Q0,0 P = Q1,0 1 P2 = Q2,0 P3 = Q3,0 P0,1 = Q1,1 P , 2 = Q2,1 1 P2,3 = Q3,1
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
20
x0
f [x0]
a1
a2
f [x0, x1, x2] ... f [xn-3, xn-2, xn-1] f [xn-2, xn-1, xn]
an
21
Newton : exemple
(ex. n2) : n=2
a0
0 2 4
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
-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
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
g i (x ) = mi +1
(x xi )3 + m (xi +1 x )3 + a (x x ) + b
6 hi
i
6 hi
mi hi 2 yi = + bi 6
1 yi +1
mi +1 hi 2 = + ai hi + bi 6
29
1 ( yi +1 yi ) hi (mi +1 mi ) hi 6
1 1 ( y i +1 yi ) ( y i y i 1 ) = 6 hi 1 hi
4
1 1 ( y i +1 yi ) ( y i y i 1 ) = 6 hi 1 hi
( y i 1 2 y i + y i + 1 ) =
fi
Tm=f
4 1
1 0 m1 f 1 4 1 l = l p p p 1 4 1 1 4 mn 1 f n 1
avec 9 points
spline
-2
-4
polynme de degr 8
-4 -2 0 2 4 6
-6 -6
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