TP/TD
n°2: Analyse Numérique
Considérons les deux problèmes
'' ''
( P 1) y (t )− y ( t )=f (t) ; 0<t ≤ 1 , & ( P 2) y ( t )− y ( t )=f (t) ; 0<t ≤ 1 ,
{ y ( 0 )=1 , y ' ( 0 )=1 {
y ( 0 )=1 , y ( 1 )=2 e
Avec f ( t )=( 2+ 4 t ) e t
1°) Vérifier que les deux problèmes ont la même solution exacte Y ( t ) =( t 2+1 ) e t .
2°) On se propose une estimation de la solution sur l’ensemble
1
Ωn ={ t i =ih ; i=0,1 , … , n }avec un pash= .
n
Solution approchée du problème ( P 1)
y ' ( t )=z (t )
En posant z= y ' et X (t)=
0 1 g(t )= 0
y (t)
z (t) ( )
, le problème ( P 1) s’écrit :( P 1)
{
z ' ( t )= y ( t ) +f ( t); 0 <t ≤ 1,
X= y = 1
()()
z 1
ou
( P 1) ¿ où A=
10
,( ) f (t ) ( )
c’est un problème de Cauchy a 2 dimensions
2.1) Donner le schéma itératif d’Euler explicite
X i +1=X i +h { A X i+ g i } ; i=0,1, … , n−1
( Euler Explicite)
{ X 0= 1
() 1
gi=
( f (t0 ))≡( 0f )
i i
Ce schéma s’écrit aussi
y i+1= y i +h z i
{
( Euler Explicite) z i+1=z i +hy i +h f i ; i=0,1 , … , n−1
y 0=1 ; z 0=1
2.2) Donner le schéma itératif d’Euler implicite
X i= X i+1−h { A X i+1 + gi+ 1 } ; i=0,1 , … , n−1
( Euler Implicite)
{ X 0= 1()1
Ecole Nationale Supérieure Sciences et Technologie Master1 (S.E. et G.T.) TP/TD Proposé par A.Malki
Page 1
0
A= 0 1 et gi+ 1=
10( ) f i+1 ( )
Ce schéma s’écrit aussi
y i = y i+1−h z i+1
{
( Euler Implicite) z i=z i+1−hy i +1−h f i+1 ; i=0,1, … , n−1
y 0=1 ; z0 =1
En résolvant par rapport à z i+1 et y i+1 on a
1
( Euler Implicite)
{ z i+1=
1−h 2
{h ( y i + f i+1 ) + z i }
y i+1= y i +h z i+1 ; i=0,1 , … , n−1
y 0=1 ; z 0=1
X i +1=X i +h { A X i+ g i } ; i=0,1, … , n−1
( Euler Explicite)
{ X 0= 1
() 1
2.3) Donner le schéma itératif de Runge-Kutta d’ordre 2
X i = y i → A X i= z i
()
zi yi ()
( RK 2 ) ¿
( RK 2 ) ¿
(1+h^2/2)y +1/2 h^2f(t) + hz
z + h*y + (h^2*z)/2 +h ( 1+ 2t) exp(t) +h( 1 + 2(t+h))exp(t+h)
y ' ' ( t ) − y ( t )=f (t) ; 0<t ≤1 ,
Solution approchée du problème ( P 2) { y ( 0 )=1 , y ( 1 )=2 e
'' y ( t−h )−2 y ( t ) + y (t +h)
Ici on utilise les techniques des différences finies y ( t ) ≈ 2
h
En notant y i= y ( t i ) et f i=f (t i ) , montrer qu’on a
y i−1−( 2+ h2 ) y i + y i +1=h2 f i (*)
Déterminer la matrice A et le vecteur b tels que (*) s’écrit sous la forme Ay=b
Ecole Nationale Supérieure Sciences et Technologie Master1 (S.E. et G.T.) TP/TD Proposé par A.Malki
Page 2
Calculer la factorisation de A par Cholesky i.e. A=L Lt
Montrer que Ay=b est équivalent à Lv=b et Lt y=v
Donner le code Matlab qui calcule L , v et y
Comparaison des solutions approchée des problèmes ( P 1) et ( P 2)
Par calcul des erreurs d’approximation quelle est la méthode la plus précise ?
Ecole Nationale Supérieure Sciences et Technologie Master1 (S.E. et G.T.) TP/TD Proposé par A.Malki
Page 3