Sol - TD1 - 19 - 20 - Abdellah Lamnii
Sol - TD1 - 19 - 20 - Abdellah Lamnii
Sol - TD1 - 19 - 20 - Abdellah Lamnii
Solution: Exercice 1.
log |Erreurn+1 |
¡ ¢
Or d r e =
log |Erreurn |
¡ ¢
n Erreur Ordre de CV
1 0.298365800681754e − 04
2 0.283610392618824e − 04 1.00486755
3 0.282844784831317e − 04 1.00025816
4 0.282842712489803e − 04 1.000000699
5 0.282842712474619e − 04 1.000000000005126
L’ordre de convergence numérique de cette méthode = 1.
Solution: Exercice 2.
3 5 7
La fonction arctan(x) admet le développement en série suivant : arctan(x) = x − x3 + x5 − x7 + · · ·
1. Soit s n la somme partielle de la série tronquée après le n-ième terme. Si on remplace arctan(x) par s n
ξ2n+1
d’après le cours l’erreur de troncature commise est donnée par E = 2n+1 . Avec ξ est dans un voisinage
A.
21
E = 1.008
21 = 0.0999
Solution: Exercice 3.
II
Soit f (x) une fonction qui vérifie f (3) = 24, f 0 (3) = 23, f 00 (3) = 16 et | f (3) (x)| < 6.01 pour |x − 3| < 0.1.
1. A l’aide de ces informations et un DL, estimer f app (3.1).
(3.1 − 3)2 00
f (3.1) ' f (3) + (3.1 − 3) f 0 (3) + f (3),
2!
0.12
= 24 + 0.1 × 23 + × 16,
2!
= 26.38.
A. LAMNII 1/ 8 2019/2020
UNIVERSITE HASSAN 1er , Settat
Faculté des Sciences et Techniques
3. Sachant la valeur exacte de f exac t (3.1) = 26.381, calculer l’erreur numérique et comparer le résultat avec
l’erreur de troncature.
Erreur pratique = | f exac t (3.1) − f app (3.1)| = |26.381 − 26.38| = 1.00000 × 10−3
Solution: Exercice 4.
1
Soit f (x) = 1+x et h = 14 .
1. Calculer la valeur exacte de f 0 (2).
1 1
On a : f 0 (x) = − (1+x) 0
2 , donc f (2) = − (1+2)2 = −0.111111
1
4
1 1
4 f (2+ 4 )− f (x+2× 4 )−3 f (2)
— D 2 f (x) = 1 = −0.10989
2× 4
3. Calculer l’erreur absolue et relative dans chaque cas. Commenter les résultats obtenus.
Erreur absolue
LA
Commentaire : la méthode de dérivation D 2 f est plus précise par rapport à la méthode de dérivation
D 1 f (car D 2 f utilise plus d’information).
Solution: Exercice 5.
Trouver le polynôme de l’espace vectoriel vec t {x, x 4 − 1, x 5 } qui interpole les points (−1, −3), (0, 1) et (1, 3).
N
−α − γ = −3, β = −1,
4 5
P (x) = αx + β(x − 1) + γx ,
½
c-à-d −β = 1, D’où γ = 3 − α,
P (−1) = −3, P (0) = 1, P (1) = 3,
α + γ = 3, ∀ α ∈ R,
Donc
P (x) = αx − (x 4 − 1) + (3 − α)x 5
Explication des résultats :
Une infinité de solutions (car le degré = 5 est imposé).
Dans le cas interpolation polynomiale : par 3 points il passe un unique polynôme de degré ≤ 2.
Illustration avec Matlab :
A. LAMNII 2/ 8 2019/2020
UNIVERSITE HASSAN 1er , Settat
Faculté des Sciences et Techniques
1 function [ ] = Ex5_TD1_19_20 ( )
2 hold on
3 x = −1.15:0.1:1.15;
4 f o r alpha=−15:15 % Qlq valeur de alpha
5 plot ( x , interP ( x , alpha ) , ’ LineWidth ’ , 1)
6 end
7 plot ( [ − 1 , 0 , 1 ] , [ − 3 , 1 , 3 ] , ’ gs ’ , ’ MarkerSize ’ , 1 0 , . . .
8 ’ MarkerEdgeColor ’ , ’ k ’ , ’ MarkerFaceColor ’ , ’ k ’ )
9 grid on ; box on ;
10 end
11
12 function [ y ]= interP ( x , alpha )
13 y=alpha * x− ( x .^4 −1)+(3−alpha ) * x . ^ 5 ;
14 end
Solution: Exercice 6.
Posons A = {(x 0 , y 0 ) = (−1, −2), (x 1 , y 1 ) = (1, 0), (x 2 , y 2 ) = (2, 7)}
1. Polynôme d’interpolation qui interpole les points de l’ensemble A avec la méthode de Cramer.
Par 3 points il passe un unique polynôme de degré ≤ 2. Ainsi,
A.
½
P (x) = ax + bx + c, 2 a − b + c = −2,
c-à-d a + b + c = 0,
P (−1) = −2, P (1) = 0, P (2) = 7,
4a + 2b + c = 7,
¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯
¯1 −1 1¯ ¯−2 −1 1¯ ¯1 −2 1¯ ¯1 −1 −2¯
∆ = ¯¯1 1 1¯¯ = −6, ∆a = ¯¯ 0 1 1¯¯ = −12, ∆b = ¯¯1 0 1¯¯ = −6, ∆c = ¯¯1 1
¯ ¯ ¯ ¯ ¯ ¯ ¯ ¯
0 ¯¯ = 18.
LA
¯4 2 1 ¯ ¯7 2 1¯ ¯4 7 1 ¯ ¯4 2 7¯
∆a ∆b ∆c
Ainsi, a = ∆ = 2, b = ∆ = 1 et c = ∆ = −3. Donc P (x) = 2x 2 + x − 3.
2. Polynôme d’interpolation de Lagrange qui interpole les points de l’ensemble A .
2
L 0,2 (x) = (x(x−x 1 )(x−x 2 )
0 −x 1 )(x 0 −x 2 )
= x −3x+2
6
(x−x 0 )(x−x 2 ) −x 2 +x+2
L 1,2 (x) = =
M
(x 1 −x 0 )(x 1 −x 2 ) 2
(x−x 0 )(x−x 1 ) x 2 −1
L 2,2 (x) = (x 2 −x 0 )(x 2 −x 1 ) = 3
Donc
= 2x 2 + x − 3.
P 2 (x) = 2x 2 + x − 3.
A. LAMNII 3/ 8 2019/2020
UNIVERSITE HASSAN 1er , Settat
Faculté des Sciences et Techniques
1 function [ ] = Ex6_TD1_19_20 ( )
2 hold on
3 x = −2:0.1:3;
4 plot ( x , interPEx6 ( x ) , ’ LineWidth ’ , 1)
5 plot ( [ − 1 , 1 , 2 ] , [ − 2 , 0 , 7 ] , ’ gs ’ , ’ MarkerSize ’ , 1 0 , . . .
6 ’ MarkerEdgeColor ’ , ’ k ’ , ’ MarkerFaceColor ’ , ’ k ’ )
7 grid on ; box on ;
LA
Solution: Exercice 7.
n
X f (x i )
1. Montrons que f [x 0 , x 1 , ..., x n ] = Qn (1). En effet,
N
j =0, j 6=i (x i −x j )
i =0
Soit P le polynôme d’interpolation de Lagrange de f aux points x 0 , x 1 , · · · , x n . Alors P s’écrit sous la
forme :
II
n
X n
X n
Y (x − x j )
P n (x) = f (x i )L i ,n (x) = f (x i )
i =0 i =0 j =0, j 6=i (x i − x j )
n
X f (x i ) n
Y
= Qn (x − x j )
i =0 j =0, j 6=i (x i − x j ) j =0, j 6=i
A. LAMNII 4/ 8 2019/2020
i =0
n n
2. Montrons par récurrence que π0 (x i ) = (x i − x j ) avec π(x) =
Y Y
(x − x i ). En effet,
j =0, j 6=i i =0
Pour n = 2, π(x) = (x − x 0 )(x − x 1 )(x − x 2 ). Ainsi, π0 (x) = (x − x 1 )(x − x 2 ) + (x − x 0 )(x − x 2 ) + (x − x 0 )(x − x 1 ).
2
Donc π0 (x i )i =0,1,2 =
Y
(x i − x j ). La formule est vrai pour n = 2.
j =0, j 6=i
Supposons que la formuleà ! pour n et montrons la pour n + 1.
est vraie
n+1 n
π(x) =
Y Y
(x − x j ) = (x − x j ) (x − x n+1 )
j =0 j =0
à !0 à !
n n
Ainsi, π (x) =
Y Y
0
(x − x j ) (x − x n+1 ) + (x − x j ) ,
j =0 j =0
On deux cas : soit i = n + 1, soit
à 0 ≤ i ≤ n. !0 à !
n n n+1
Pour i = n + 1 on a π (x n+1 ) =
Y Y Y
0
(x n+1 − x j ) (x n+1 − x n+1 ) + (x n+1 − x j ) = (x n+1 − x j ),
j =0 j =0 j =0, j 6=(n+1)
h y pot hese d e r ecur r ence
à !0 à ! Ãz }| !{
n n n
A.
Pour 0 ≤ i ≤ n, π0 (x i ) =
Y Y Y
(x i − x j ) (x i − x n+1 ) + (x i − x j ) = (x i − x j ) (x i − x n+1 )
j =0 j =0 j =0, j 6=i
D’où le résultat.
π(x)
3. Déduire que le polynôme élémentaire de Lagrange L i ,n peut aussi s’écrire L i ,n (x) = ,
(x − x i )π0 (x i )
n (x − x j ) (x−x i ) nj=0, j 6=i (x−x j ) π(x)
Q
Y
En effet, L i ,n (x) = = =
LA
Qn
(x i − x j ) (x−x i ) j =0, j 6=i (x i −x j ) (x − x i )π0 (x i )
j =0, j 6=i
f (x )
4. Déduire que f.[x 0 , x 1 , ..., x n ] = ni=0 π0 (xii ) .
P
Quest i on 1 Quest i on 2
z }| { z }| {
n n f (x )
X f (x i ) X i
D’après les Questions 1 et 2, on a : f [x 0 , x 1 , ..., x n ] = n =
π 0 (x )
M
i
Y
i =0 (x i − x j ) i =0
j =0, j 6=i
5. Grâce à la formule (1) retrouver les expressions de f [x 0 , x 1 ] et f [x 0 , x 1 , x 2 ].
N
1
X f (x i ) f (x 0 ) f (x ) f [x 1 ]− f [x 0 ]
f [x 0 , x 1 ] = Q1 = (x 0 −x 1 ) + (x1 −x1 0 ) = (x 1 −x 0 )
j =0, j 6=i (x i −x j )
i =0
II
A. LAMNII 5/ 8 2019/2020
UNIVERSITE HASSAN 1er , Settat
Faculté des Sciences et Techniques
2
X f (x i ) f (x 0 ) f (x ) f (x )
f [x 0 , x 1 , x 2 ] = Q2 = (x 0 −x 1 )(x 0 −x 2 ) + (x1 −x0 )(x1 1 −x2 ) + (x2 −x0 )(x2 2 −x1 )
j =0, j 6=i (x i −x j )
i =0
(x 2 −x 1 ) f (x 0 )−(x 2 −x 0 ) f (x 1 )+(x 1 −x 0 ) f (x 2 )
= (x 0 −x 1 )(x 2 −x 0 )(x 2 −x 1 )
A j out er et Ret r ancher
z }| {
(x 2 −x 1 ) f (x 0 ) −(x 2 − x 1 ) f (x 1 ) + (x 2 − x 1 ) f (x 1 ) −(x 2 −x 0 ) f (x 1 )+(x 1 −x 0 ) f (x 2 )
= (x 0 −x 1 )(x 2 −x 0 )(x 2 −x 1 )
F act or i ser Si mpl i f i er
z }| { z }| {
(x 2 − x 1 ) f (x 0 ) − (x 2 − x 1 ) f (x 1 ) + (x 2 − x 1 ) f (x 1 ) − (x 2 − x 0 ) f (x 1 ) +(x1 −x0 ) f (x2 )
= (x 0 −x 1 )(x 2 −x 0 )(x 2 −x 1 )
¡ ¢ ¡ ¢ ¡ ¢
−(x 2 −x 1 ) f (x 1 )− f (x 0 ) −(x 1 −x 0 ) f (x 1 )+(x 1 −x 0 ) f (x 2 ) −(x 2 −x 1 ) f (x 1 )− f (x 0 ) +(x 1 −x 0 ) f (x 2 )− f (x 1 )
= (x 0 −x 1 )(x 2 −x 0 )(x 2 −x 1 ) = (x 0 −x 1 )(x 2 −x 0 )(x 2 −x 1 )
¡ ¢ ¡ ¢ ¡ ¢ ¡ ¢
−(x 2 −x 1 ) f (x 1 )− f (x 0 ) (x 1 −x 0 ) f (x 2 )− f (x 1 ) − f (x 1 )− f (x 0 ) f (x 2 )− f (x 1 )
(x 0 −x 1 )(x 2 −x 1 ) + (x 0 −x 1 )(x 2 −x 1 ) (x 0 −x 1 ) + (x 2 −x 1 )
= =
(x 2 − x 0 ) (x 2 − x 0 )
f [x 1 , x 2 ] − f [x 0 , x 1 ]
=
(x 2 − x 0 )
A.
Solution: Exercice 8.
b−a
Soit I = [a, b] et f ∈ C n ([a, b]). Posons x i = a + i h, i = 0, ..., n et h = n
1. Montrer que
¯Y n ¯ h n+1
∀ x ∈]a, b[ on a ¯ (x − x i )¯ ≤ n! (1)
¯ ¯
LA
i =0 4
En effet, Soit x ∈ [a, b], alors il existe 1 ≤ i ≤ n tel que x i −1 ≤ x ≤ x i .
Posons g (x) = (x − x i −1 )(x − x i ). Ainsi on a : g 0 (x) = 2x − x i − x i −1 et g 0 xi −12+xi = 0.
¡ ¢
x i −1 +x i
x x i −1 2
xi
g 0 (x) − 0 +
N
0 0
g (x) 2
− h4
II
h2
D’après le tableau de variation on ∀x ∈ [x i −1 , x i ], |g (x)| ≤ 4 .
Sans perte de généralité on prend i = 1, ainsi x ∈ [x 0 , x 1 ] (voir figure). Donc on a :
2
|(x − x0)(x − x 1 )| ≤ h4 , |x − x 2 | ≤ 2h, |x − x 3 | ≤ 3h, · · · , |x − x n | ≤ nh.
¯Y n ¯ h n+1
D’où ¯ (x − x i )¯ ≤ n! .
¯ ¯
i =0 4
A. LAMNII 6/ 8 2019/2020
UNIVERSITE HASSAN 1er , Settat
Faculté des Sciences et Techniques
Soit p(x) le polynôme d’interpolation de Lagrange qui passe par les points (x i , y i ), i = 0, ..., n, avec
x i = i et y i = 1n
(i )
On rappelle l’expression pour les coefficients binomiaux : ni = i ! (n−i
n!
¡ ¢
)!
1. L’expression de p(x)
LA
n
X n
X n
Y (x − x j )
p(x) = f (x i )L i ,n (x) = f (x i )
i =0 i =0 j =0, j 6=i (x i − x j )
n 1
X n
Y (x − j )
= ¡n ¢
i =0 i j =0, j 6=i (i − j )
M
2. Montrer que
n
Y 1 (−1)n−i
= (3)
j =0, j 6=i i − j (n − i )! i !
Par recurrence sur n.
N
Pour n = 1,
1
Y 1 1 (−1)(1−0)
pour i = 0 : = = , vrai
1 1
i − j 0 − 1 (1 − 0)!0!
Y j =0, j 6=i
II
=
j =0, j 6=i i−j Y1 1 1 (−1)(1−1)
pour i = 1 : = = , vrai
i − j 1 − 0 (1 − 1)!1!
j =0, j 6=i
A. LAMNII 7/ 8 2019/2020
UNIVERSITE HASSAN 1er , Settat
Faculté des Sciences et Techniques
n 1
X n
Y (x − j ) X n i !(n − i )! (−1)n−i n
Y X n (−1)n−i n
Y
p(x) = ¡n ¢ = (x − j ) = (x − j )
i =0 i j =0, j 6=i (i − j ) i =0 n! (n − i )! i ! j =0, j 6=i i =0 n! j =0, j 6=i
A. LAMNII 8/ 8 2019/2020