Documente Academic
Documente Profesional
Documente Cultură
Approximation de fonctions
Pagora 1A
Chapitre 3
Approximation de fonctions
29/01/13 - 1/02/13
1 / 64
Plan
1
Introduction
Interpolation polynmiale
Thorie
Forme lagrangienne
Phnomne de Runge
Splines
Approximation de fonctions
29/01/13 - 1/02/13
2 / 64
Introduction
Plan
1
Introduction
Interpolation polynmiale
Thorie
Forme lagrangienne
Phnomne de Runge
Splines
Approximation de fonctions
29/01/13 - 1/02/13
3 / 64
Introduction
Description du problme
On remplace f par une fonction simple dont lvaluation est aise (ex :
utilisation de polynmes, fonctions rationnelles, ...)
2 grandes familles dapproches.
Approximation de fonctions
29/01/13 - 1/02/13
4 / 64
Introduction
Approximation de fonctions
29/01/13 - 1/02/13
5 / 64
Introduction
Interpolation polynmiale
Approximation de fonctions
29/01/13 - 1/02/13
6 / 64
Plan
1
Introduction
Interpolation polynmiale
Thorie
Forme lagrangienne
Phnomne de Runge
Splines
Approximation de fonctions
29/01/13 - 1/02/13
7 / 64
Description du problme
De quoi dispose t-on ?
Ensemble de donnes : n points (xi , yi ), i = 1, . . . , n
Fonction modle : f (x, ) avec vecteur contenant m paramtres
n
X
i=1
Approximation de fonctions
29/01/13 - 1/02/13
8 / 64
Rappel
La drive permet de connatre les variations dune fonction (croissance,
dcroissance, ...). En particulier, si la drive est nulle en un point, la
tangente est horizontale en ce point et donc la fonction ne croit ni ne
dcroit (minimum ou maximum).
Approximation de fonctions
29/01/13 - 1/02/13
9 / 64
Exercice introductif
n
X
i=1
Approximation de fonctions
29/01/13 - 1/02/13
10 / 64
n
X
(yi 0 )2
i=1
S (0 ) = 2
n
X
(yi 0 )
i=1
et on rsout S 0 (0 ) = 0 do
n
1X
yi
0 =
n
i=1
Approximation de fonctions
29/01/13 - 1/02/13
11 / 64
Mthode gnrale
Plan
1
Introduction
Interpolation polynmiale
Thorie
Forme lagrangienne
Phnomne de Runge
Splines
Approximation de fonctions
29/01/13 - 1/02/13
12 / 64
Mthode gnrale
n
X
i=1
X
S()
f (xi , )
= 2
(yi f (xi , ))
=0
k
k
k = 1, . . . , m
i=1
Approximation de fonctions
29/01/13 - 1/02/13
13 / 64
Rgression linaire
Plan
1
Introduction
Interpolation polynmiale
Thorie
Forme lagrangienne
Phnomne de Runge
Splines
Approximation de fonctions
29/01/13 - 1/02/13
14 / 64
Rgression linaire
Rgression linaire
La fonction modle est de la forme
f (x, a, b) = ax + b
On cherche le minimum de
S(a, b) =
n
X
i=1
Analyse numrique (Pagora 1A)
Approximation de fonctions
29/01/13 - 1/02/13
15 / 64
Rgression linaire
Recherche du minimum
Le minimum de S est atteint pour (a, b) solution du systme suivant :
n
X
=
2
xi (yi axi b) = 0
a
i=1
n
X
(yi axi b)
= 0
i=1
1X
x=
xi
n
i=1
1X
y=
yi
n
Approximation de fonctions
i=1
29/01/13 - 1/02/13
16 / 64
Rgression linaire
Exercice
Exprimer b en fonction de a, x, y puis exprimer a.
Approximation de fonctions
29/01/13 - 1/02/13
17 / 64
Rgression linaire
Exercice (correction)
b = y ax
Le systme est maintenant
Pn
Pn
i=1 [(yi
y ) a(xi x)]
= 0
a=
(xi x) (yi y )
i=1
n
X
i=1
n
X
=
2
(xi x)
xi yi x y
i=1
n
X
xi2 x 2
i=1
Approximation de fonctions
29/01/13 - 1/02/13
18 / 64
Plan
1
Introduction
Interpolation polynmiale
Thorie
Forme lagrangienne
Phnomne de Runge
Splines
Approximation de fonctions
29/01/13 - 1/02/13
19 / 64
Approximation de fonctions
29/01/13 - 1/02/13
20 / 64
X11 X12
X21 X22
X= .
..
..
.
f (xi , )
= k (xi )
k
les vecteurs
Xn1 Xn2
. . . X1m
. . . X2m
..
..
.
.
. . . Xnm
1
2
..
.
m
y=
y1
y2
..
.
yn
XT X = XT y
Approximation de fonctions
29/01/13 - 1/02/13
21 / 64
Exercice
tablir le systme XT X = XT y.
Approximation de fonctions
29/01/13 - 1/02/13
22 / 64
Exercice (correction)
tablir le systme XT X = XT y.
Le minimum de S est atteint pour
n
m
X
X
Xik yi
j Xij = 0
i=1
k = 1, . . . , m
j=1
Do
n
X
i=1
Xik yi =
n
X
Xik
i=1
m
X
j Xij =
j=1
m
X
j=1
n
X
!
Xik Xij
k = 1, . . . , m
i=1
XT X = XT y
Approximation de fonctions
29/01/13 - 1/02/13
23 / 64
Plan
1
Introduction
Interpolation polynmiale
Thorie
Forme lagrangienne
Phnomne de Runge
Splines
Approximation de fonctions
29/01/13 - 1/02/13
24 / 64
Mesures exprimentales
En gnral, les mesures faites sur yi sont entches derreur. Notons i une
estimation de lcart-type du bruit qui affecte chaque mesure.
Exemple : On cherche dterminer la valeur de la rsistance R du
composant lectronique resistance.
Approximation de fonctions
29/01/13 - 1/02/13
25 / 64
n
X
i=1
on va chercher minimiser
n
n
X
yi f (xi , ) 2 X
=
wi (yi f (xi , ))2
2 () =
i
i=1
i=1
Approximation de fonctions
29/01/13 - 1/02/13
26 / 64
Exercice
n
X
i=1
Approximation de fonctions
29/01/13 - 1/02/13
27 / 64
Exercice (correction)
Trouver 0 minimisant
2
(0 ) =
n
X
i=1
La drive vaut
0
2 (0 ) = 2
n
X
wi (yi 0 )
i=1
et on rsout
0
2 (
0)
= 0, do
n
X
0 =
wi yi
i=1
n
X
wi
i=1
Approximation de fonctions
29/01/13 - 1/02/13
28 / 64
Interpolation polynmiale
Plan
1
Introduction
Interpolation polynmiale
Thorie
Forme lagrangienne
Phnomne de Runge
Splines
Approximation de fonctions
29/01/13 - 1/02/13
29 / 64
Interpolation polynmiale
Approximation de fonctions
29/01/13 - 1/02/13
30 / 64
Interpolation polynmiale
yi+1 yi
(x xi ) + yi
xi+1 xi
Approximation de fonctions
29/01/13 - 1/02/13
31 / 64
Interpolation polynmiale
Thorie
Plan
1
Introduction
Interpolation polynmiale
Thorie
Forme lagrangienne
Phnomne de Runge
Splines
Approximation de fonctions
29/01/13 - 1/02/13
32 / 64
Interpolation polynmiale
Thorie
Approximation de fonctions
29/01/13 - 1/02/13
33 / 64
Interpolation polynmiale
Thorie
Interpolation polynmiale
Ide (simple) : Trouver un polynme P(x) passant par tous les points
donns (xi , yi ) donc tel que
P(xi ) = yi
i = 0, . . . , n
avec
ak 6= 0
Existence et unicit de P :
si k < n, en gnral pas de solution (moindres carrs)
si k > n, infinit de solutions
si k = n, solution unique (sous certaines conditions) => preuve ?
Approximation de fonctions
29/01/13 - 1/02/13
34 / 64
Interpolation polynmiale
Thorie
1
1
..
.
x0 . . . x0n
a0
y0
x1 . . . x1n
a1 y1
..
.. .. = ..
.
. . .
1 xn . . . xnn
an
Approximation de fonctions
yn
29/01/13 - 1/02/13
35 / 64
Interpolation polynmiale
Thorie
M=
1 x0 . . . x0n
1 x1 . . . x1n
.. ..
..
. .
.
1 xn . . . xnn
Approximation de fonctions
29/01/13 - 1/02/13
36 / 64
Interpolation polynmiale
Forme lagrangienne
Plan
1
Introduction
Interpolation polynmiale
Thorie
Forme lagrangienne
Phnomne de Runge
Splines
Approximation de fonctions
29/01/13 - 1/02/13
37 / 64
Interpolation polynmiale
Forme lagrangienne
Approximation de fonctions
29/01/13 - 1/02/13
38 / 64
Interpolation polynmiale
Forme lagrangienne
de polynmes de Lagrange
`j (x) =
n
Y
k=0,k6=j
x xj1 x xj+1
x xk
x x0
x xn
=
...
...
xj xk
xj x0
xj xj1 xj xj+1
xj xn
Approximation de fonctions
29/01/13 - 1/02/13
39 / 64
Interpolation polynmiale
Forme lagrangienne
Exemple
On dispose des points (0, 3), (2, 1), (4, 2), (9, 5).
Approximation de fonctions
29/01/13 - 1/02/13
40 / 64
Interpolation polynmiale
Forme lagrangienne
Exercice
Vrifier que L(xi ) = yi pour i = 0, . . . , n.
Approximation de fonctions
29/01/13 - 1/02/13
41 / 64
Interpolation polynmiale
Forme lagrangienne
Exercice (correction)
Vrifier que L(xi ) = yi pour i = 0, . . . , n.
Pour i 6= j
`j (xi ) =
n
Y
k=0,k6=j
xi xk
xi x0
xi xi
xi xn
=
...
...
=0
xj xk
xj x0
xj xi
xj xn
et
n
Y
`j (xj ) =
k=0,k6=j
donc
L(xi ) =
n
X
xj xk
=1
xj xk
yj `j (xi ) = yi
j=0
Approximation de fonctions
29/01/13 - 1/02/13
42 / 64
Interpolation polynmiale
Phnomne de Runge
Plan
1
Introduction
Interpolation polynmiale
Thorie
Forme lagrangienne
Phnomne de Runge
Splines
Approximation de fonctions
29/01/13 - 1/02/13
43 / 64
Interpolation polynmiale
Phnomne de Runge
Exercice introductif
On considre lensemble de points suivants
1
1
1,
, (0, 1) , 1,
26
26
Que vaut L ?
Approximation de fonctions
29/01/13 - 1/02/13
44 / 64
Interpolation polynmiale
Phnomne de Runge
`0 (x) =
x(x 1)
1
1
= x2 x
2
2
2
`1 (x) = (x + 1)(x 1) = x 2 + 1
`2 (x) =
x(x + 1)
1
1
= x2 + x
2
2
2
Do
L(x) = y0 `0 (x) + y1 `1 (x) + y2 `2 (x) =
Analyse numrique (Pagora 1A)
Approximation de fonctions
25 2
x +1
26
29/01/13 - 1/02/13
45 / 64
Interpolation polynmiale
Phnomne de Runge
Phnomne de Runge
Considrons la fonction
f (x) =
1
1 + 25x 2
x [1, 1]
Runge (1856 1927) a montr que si cette fonction est interpole aux
points quidistants xi entre 1 et 1
xi = 1 + (i 1)
2
n
i = 0, . . . , n
1x1
Approximation de fonctions
29/01/13 - 1/02/13
46 / 64
Interpolation polynmiale
Phnomne de Runge
Approximation de fonctions
29/01/13 - 1/02/13
47 / 64
Interpolation polynmiale
Splines
Plan
1
Introduction
Interpolation polynmiale
Thorie
Forme lagrangienne
Phnomne de Runge
Splines
Approximation de fonctions
29/01/13 - 1/02/13
48 / 64
Interpolation polynmiale
Splines
Approximation de fonctions
29/01/13 - 1/02/13
49 / 64
Interpolation polynmiale
Splines
Approximation de fonctions
29/01/13 - 1/02/13
50 / 64
Interpolation polynmiale
Splines
Spline cubique
Approximation de fonctions
29/01/13 - 1/02/13
51 / 64
Interpolation polynmiale
Splines
Spline cubique
On dispose dun ensemble de n + 1 points (xi , yi ), i = 0, . . . , n tel que
x0 < x1 < . . . xn .
La spline cubique S interpolant ces points concide sur chaque intervalle
[xi , xi+1 ] avec un polynme pi de degr 3 de la forme :
S(x) = pi (x) = fi + fi 0 (x xi ) +
f 000
fi 00
(x xi )2 + i (x xi )3
2!
3!
Approximation de fonctions
29/01/13 - 1/02/13
52 / 64
Interpolation polynmiale
Splines
i = 0, . . . , n 1
i = 0, . . . , n 1
Approximation de fonctions
29/01/13 - 1/02/13
53 / 64
Interpolation polynmiale
Splines
Conditions C 2
i = 0, . . . , n 2
00
S 00 (xi+1 ) = pi00 (xi+1 ) = pi+1
(xi+1 )
i = 0, . . . , n 2
Approximation de fonctions
29/01/13 - 1/02/13
54 / 64
Interpolation polynmiale
Splines
Illustration
Approximation de fonctions
29/01/13 - 1/02/13
55 / 64
Interpolation polynmiale
Splines
i = 0, . . . , n 1
fi 00
f 000
hi i hi2
2
6
Approximation de fonctions
yi +1 yi
.
hi
i = 0, . . . , n 1
29/01/13 - 1/02/13
56 / 64
Interpolation polynmiale
Splines
00 (x
Montrer partir de la condition pi00 (xi+1 ) = pi+1
i+1 ) que
fi 000 =
00 f 00
fi+1
i
hi
i = 0, . . . , n 2
00 (x ). On a donc f 000 =
On pose fn00 = pn1
n
n1
1
1 00
fi 0 = f [xi , xi+1 ] hi fi 00 hi fi+1
3
6
6
00
fn00 fn1
hn1 .
Montrer que
i = 0, . . . , n 1
0 (x
Montrer partir de la condition pi0 (xi+1 ) = pi+1
i+1 ) que
00
00
hi fi 00 + 2(hi + hi+1 )fi+1
+ hi+1 fi+2
= 6(f [xi+1 , xi+2 ] f [xi , xi+1 ])
pour i = 0, . . . , n 2.
Il ne reste plus qu imposer f000 et fn00 pour obtenir tous les coefficients.
Analyse numrique (Pagora 1A)
Approximation de fonctions
29/01/13 - 1/02/13
57 / 64
Interpolation polynmiale
Splines
h1
2(h1 + h2 )
h2
0
.
..
0
hn3
2(hn3 + hn2 )
hn2
00
...
0
hn2
2(hn2 + hn1 )
fn1
Approximation de fonctions
29/01/13 - 1/02/13
58 / 64
Interpolation polynmiale
Splines
On a automatiquement fi = yi pour i = 0, . . . , n 1.
On calcule les fi 0 et fi 000 partir des formules
1 00
1
fi 0 = f [xi , xi+1 ] hi fi 00 hi fi+1
3
6
fi 000 =
00 f 00
fi+1
i
hi
i = 0, . . . , n 1
i = 0, . . . , n 1
Approximation de fonctions
29/01/13 - 1/02/13
59 / 64
Interpolation polynmiale
Splines
Exercice : correction
1
fi 00
f 000
(x xi )2 + i (x xi )3
2
6
pi0 (x) = fi 0 + fi 00 (x xi ) +
fi 000
(x xi )2
2
i = 0, . . . , n 1
fi 00
f 000
(xi xi )2 + i (xi xi )3 = fi
2
6
pi (xi ) = yi = fi = yi
pi (xi ) = fi + fi 0 (xi xi ) +
Approximation de fonctions
29/01/13 - 1/02/13
60 / 64
Interpolation polynmiale
Splines
Exercice : correction
f 000
fi 00
hi i hi2
2
6
yi +1 yi
.
hi
i = 0, . . . , n 1
f 00
f 000
pi (xi+1 ) = fi +fi 0 hi + i hi2 + i hi3 = yi+1
|{z}
2
6
=yi
fi 0 hi = yi+1 yi
fi 00 2 fi 000 3
h
h
2 i
6 i
Approximation de fonctions
29/01/13 - 1/02/13
61 / 64
Interpolation polynmiale
Splines
Exercice : correction
00 (x
Montrer partir de la condition pi00 (xi+1 ) = pi+1
i+1 ) que
fi 000 =
00 f 00
fi+1
i
hi
i = 0, . . . , n 2
00
00
pi00 (xi+1 ) = fi 00 + fi 000 hi = fi+1
= pi+1
(xi+1 )
Approximation de fonctions
29/01/13 - 1/02/13
62 / 64
Interpolation polynmiale
Splines
Exercice : correction
00 (x ). On a donc f 000 =
On pose fn00 = pn1
n
n1
1 00
1
fi 0 = f [xi , xi+1 ] hi fi 00 hi fi+1
3
6
fi 0 = f [xi , xi+1 ]
00
fn00 fn1
hn1 .
Montrer que
i = 0, . . . , n 1
f 00 fi 00
fi 00
f 000
f 00
hi i hi2 = f [xi , xi+1 ] i hi i+1
hi
2
6
2
6
Do le rsultat.
Approximation de fonctions
29/01/13 - 1/02/13
63 / 64
Interpolation polynmiale
Splines
Exercice : correction
6
0 (x
Montrer partir de la condition pi0 (xi+1 ) = pi+1
i+1 ) que
00
00
hi fi 00 + 2(hi + hi+1 )fi+1
+ hi+1 fi+2
= 6(f [xi+1 , xi+2 ] f [xi , xi+1 ])
pour i = 0, . . . , n 2.
pi0 (xi+1 ) = fi 0 + fi 00 hi +
fi 000 2
0
= pi+1 (xi+1 )
h = fi+1
2 i
f 00 fi 00
1
1 00
f [xi , xi+1 ] hi fi 00 hi fi+1
+ fi 00 hi + i+1
hi
3
6
2
1
1
00
00
= f [xi+1 , xi+2 ] hi+1 fi+1
hi+1 fi+2
3
6
En simplifiant, on vrifie le rsultat.
Analyse numrique (Pagora 1A)
Approximation de fonctions
29/01/13 - 1/02/13
64 / 64