Vous êtes sur la page 1sur 4

UNIVERSITÉ CADI AYYAD Année Universitaire 2019-20

DÉPARTEMENT DE PHYSIQUE
MARRAKECH

Exercices d’Application du chapitre 6 (suite)


On considère l’équation différentielle suivante :

𝑦 ′ (𝑡) = 𝑡 2 sin 𝑦(𝑡)


{
𝑦(0) = 1

Utiliser les méthodes suivantes et calculer 𝑦1 , 𝑦2 et 𝑦3 en utilisant un pas de temps


ℎ = 0.1.

Faites quelques itérations pour 𝑡 ∈ [0,1] en utilisant un pas ℎ = 0.1 et les méthodes
suivantes :

1) Méthode d’Euler
2) Méthode de Taylor d’ordre 2
3) Méthode d’Euler modifiée (ordre 2)
4) Méthode du point milieu (ordre 2)
5) Méthode de Runge-Kutta d’ordre 4 (déjà traité ; voir Applications 5).

Solution
1) Méthode d’Euler
L’algorithme général est simple : 𝑦𝑛+1 = 𝑦𝑛 + ℎ𝑓(𝑡𝑛 , 𝑦𝑛 )
𝑦1 = 𝑦0 + ℎ𝑓(𝑡0 , 𝑦0 ) = 𝑦0 + 𝑡02 sin 𝑦0 = 1

𝑦2 = 𝑦1 + ℎ𝑓(𝑡1 , 𝑦1 ) = 𝑦1 + ℎ𝑡12 sin 𝑦1 = 1 + 0.13 sin 1 = 1.000 8414 71


𝑦3 = 𝑦2 + ℎ𝑓(𝑡2 , 𝑦2 ) = 𝑦2 + ℎ𝑡22 sin 𝑦2 = 1.004 209 172

2) Méthode de Taylor d’ordre 2


Dans l’algorithme, on aura besoin de :
𝝏𝒇(𝒕𝒏 ,𝒚𝒏 ) 𝝏𝒇(𝒕𝒏 ,𝒚𝒏 )
= 𝟐𝒕𝒏 𝐬𝐢𝐧 𝒚𝒏 et = 𝒕𝟐𝒏 𝐜𝐨𝐬 𝒚𝒏
𝝏𝒕 𝝏𝒚

L’algorithme devient :
ℎ2
𝑦𝑛+1 = 𝑦𝑛 + ℎ𝑓(𝑡𝑛 , 𝑦𝑛 ) + [2𝑡𝑛 𝑠𝑖𝑛 𝑦𝑛 + 𝑡𝑛4 sin 𝑦𝑛 cos 𝑦𝑛 ]
2
ℎ2
𝑦𝑛+1 = 𝑦𝑛 + ℎ[𝑡𝑛 sin 𝑦𝑛 + [2𝑡𝑛 𝑠𝑖𝑛 𝑦𝑛 + 𝑡𝑛4 sin 𝑦𝑛 cos 𝑦𝑛 ]
2 ]
2
Ainsi :
ℎ2
𝑦1 = 𝑦0 + ℎ[𝑡02 sin 𝑦0 ] + [2𝑡0 𝑠𝑖𝑛 𝑦0 + 𝑡04 sin 𝑦0 cos 𝑦0 ] = 1
2
ℎ2
𝑦2 = 𝑦1 + ℎ[𝑡12 sin 𝑦1 ] +[2𝑡1 𝑠𝑖𝑛 𝑦1 + 𝑡14 sin 𝑦1 cos 𝑦1 ]
2
0.12
𝑦2 = 1 + 0.1[0.12 sin 1] + [2 × 0.1 sin 1 + 0.14 sin 1 cos 1]
2
𝑦2 = 1.000 841 471 + 0.005[0.168 294 197 + 0.000 045 465] = 1.001 683 169

ℎ2
𝑦3 = 𝑦2 + ℎ[𝑡22 sin 𝑦2 ] +
[2𝑡2 𝑠𝑖𝑛 𝑦2 + 𝑡24 sin 𝑦2 cos 𝑦2 ]
2
𝑦3 = 1.001 683 169 + 0.1[0.033 695 169 ] + 0.005[0.336 951 685 + 0.000 726 313]
𝑦3 = 1.001 683 169 + 0.003 369 517 + 0.001 688 39 = 1.006 741 076

Une fois le processus compris, vous pouvez continuer tranquillement.


Avec un programme, c’est encore plus simple !

3) Méthode d’Euler modifiée


𝑦 ∗ = 𝑦𝑛 + ℎ𝑓(𝑡𝑛 , 𝑦𝑛 ) = 𝑦𝑛 + ℎ[𝑡𝑛2 sin 𝑦𝑛 ]

𝑦𝑛+1 = 𝑦𝑛 + [𝑓(𝑡𝑛 , 𝑦𝑛 ) + 𝑓(𝑡𝑛+1 , 𝑦 ∗ )]
2
Ainsi :
𝑦 ∗ = 1 + 0.1[02 sin 1] = 1

𝑦1 = 𝑦0 + [𝑓(𝑡0 , 𝑦0 ) + 𝑓(𝑡1 , 𝑦 ∗ )]
2
0.1 2
𝑦1 = 1 + [0 sin 1 + 0.12 sin 1] = 1.000 420 735
2

𝑦 ∗ = 𝑦1 + ℎ𝑓(𝑡1 , 𝑦1 ) = 𝑦1 + ℎ[𝑡12 sin 𝑦1 ] = 1.001 262 433


ℎ 0.1 2
𝑦2 = 𝑦1 + [𝑓(𝑡1 , 𝑦1 ) + 𝑓(𝑡2 , 𝑦 ∗ )] = 1.000 420 735 + [𝑡 sin 𝑦1 + 𝑡22 sin 𝑦 ∗ ]
2 2 1
𝑦2 = 1.002 525 889

𝑦 ∗ = 𝑦2 + ℎ𝑓(𝑡2 , 𝑦2 ) = 𝑦2 + ℎ[𝑡22 sin 𝑦2 ] = 1.005 897 221


ℎ 0.1 2
𝑦3 = 𝑦2 + [𝑓(𝑡2 , 𝑦2 ) + 𝑓(𝑡3 , 𝑦 ∗ )] = 1.002 525 889 + [𝑡 sin 𝑦2 + 𝑡32 sin 𝑦 ∗ ]
2 2 2
𝑦3 = 1.008 012 447


On continue les calculs en suivant la même procédure.

4) Méthode du point milieu


L’algorithme devient :
𝑘𝑛 = ℎ𝑓(𝑡𝑛 , 𝑦𝑛 ) = ℎ[𝑡𝑛2 sin 𝑦𝑛 ]
ℎ 𝑘𝑛 ℎ 𝑘𝑛
𝑦𝑛+1 = 𝑦𝑛 + ℎ [𝑓 (𝑡𝑛 + , 𝑦𝑛 + )] = 𝑦𝑛 + ℎ [(𝑡𝑛 + )2 sin(𝑦𝑛 + )]
2 2 2 2
Ainsi :
𝑘0 = ℎ[𝑡𝑛2 sin 𝑦𝑛 ] = 0.1[02 sin 𝑦0 ] = 0
ℎ 𝑘0
𝑦1 = 𝑦0 + ℎ [(𝑡0 + )2 sin(𝑦0 + )]
2 2
0.1 2
𝑦1 = 1 + 0.1 [( ) sin 1] = 1.000 210 368
2
𝑘1 = ℎ𝑓(𝑡1 , 𝑦1 ) = ℎ[𝑡12 sin 𝑦1 ] = 0.000 841 585
ℎ 𝑘1 ℎ 𝑘1
𝑦2 = 𝑦1 + ℎ [𝑓 (𝑡1 + , 𝑦1 + )] = 𝑦1 + ℎ [(𝑡1 + )2 sin(𝑦1 + )] = 1.002 104 445
2 2 2 2

𝑘2 = ℎ𝑓(𝑡2 , 𝑦2 ) = ℎ[𝑡22 sin 𝑦2 ] = 0.003 370 425


ℎ 𝑘2 ℎ 𝑘2
𝑦3 = 𝑦2 + ℎ [𝑓 (𝑡2 + , 𝑦2 + )] = 𝑦2 + ℎ [(𝑡2 + )2 sin(𝑦2 + )] = 1.007 376 398
2 2 2 2

On continue les calculs en suivant la même procédure.

5) Méthode de Runge-Kutta d’ordre 4


𝑘1 = ℎ𝑓(𝑡𝑛 , 𝑦𝑛 )
ℎ 𝑘
𝑘2 = ℎ𝑓 (𝑡𝑛 + 2 , 𝑦𝑛 + 21 )
ℎ 𝑘2
𝑘3 = ℎ𝑓 (𝑡𝑛 + , 𝑦𝑛 + )
2 2
𝑘4 = ℎ𝑓(𝑡𝑛 + ℎ, 𝑦𝑛 + 𝑘3 )
1
𝑦𝑛+1 = 𝑦𝑛 + (𝑘1 + 2𝑘2 + 2𝑘3 + 𝑘4 )
6
Ainsi :
Solution

𝑘1 = ℎ𝑓(𝑡0 , 𝑦0 ) = ℎ𝑡02 sin 𝑦0 = 0.1 × 02 sin 𝑡 = 0


ℎ 𝑘1 ℎ 2 𝑘1
𝑘2 = ℎ𝑓 (𝑡0 + , 𝑦0 + ) = ℎ (𝑡0 + ) sin (𝑦0 + ) = 0.000 210 368
2 2 2 2
2
ℎ 𝑘2 ℎ 𝑘2
𝑘3 = ℎ𝑓 (𝑡0 + , 𝑦0 + ) = ℎ (𝑡0 + ) sin (𝑦0 + ) = 0.000 210 382
2 2 2 2
𝑘4 = ℎ𝑓(𝑡0 + ℎ, 𝑦0 + 𝑘3 ) = ℎ(𝑡0 + ℎ)2 sin(𝑦0 + 𝑘3 ) = 0.000 841 585

1
𝑦1 = 𝑦0 + [𝑘1 + 2(𝑘2 + 𝑘3 ) + 𝑘4 ] = 1.000 280 514
6

𝑘1 = ℎ𝑓(𝑡1 , 𝑦1 ) = ℎ𝑡12 sin 𝑦1 = 0.1 × 0.12 sin(1.000 280 514) = 0.000 841 623
ℎ 𝑘1 ℎ 2 𝑘1
𝑘2 = ℎ𝑓 (𝑡1 + , 𝑦1 + ) = ℎ (𝑡1 + ) sin (𝑦1 + ) = 0.001 894 162
2 2 2 2
ℎ 𝑘2 ℎ 2 𝑘2
𝑘3 = ℎ𝑓 (𝑡1 + , 𝑦1 + ) = ℎ (𝑡1 + ) sin (𝑦1 + ) = 0.001 894 801
2 2 2 2
2
𝑘4 = ℎ𝑓(𝑡1 + ℎ, 𝑦1 + 𝑘3 = ℎ(𝑡1 + ℎ) sin 1 + 𝑘3 ) = 0.003 370 577
) (𝑦

1
𝑦2 = 𝑦1 + [𝑘1 + 2(𝑘2 + 𝑘3 ) + 𝑘4 ] = 1.002 245 535
6

𝑘1 = ℎ𝑓(𝑡2 , 𝑦2 ) = ℎ𝑡22 sin 𝑦2 = 0.1 × 0.22 sin 1.002245535 = 0.003 370 729
ℎ 𝑘1 ℎ 2 𝑘1
𝑘2 = ℎ𝑓 (𝑡2 + , 𝑦2 + ) = ℎ (𝑡2 + ) sin (𝑦2 + ) = 0.005 272 427
2 2 2 2
ℎ 𝑘2 ℎ 2 𝑘2
𝑘3 = ℎ𝑓 (𝑡2 + , 𝑦2 + ) = ℎ (𝑡2 + ) sin (𝑦2 + ) = 0.005 275 616
2 2 2 2
𝑘4 = ℎ𝑓(𝑡2 + ℎ, 𝑦2 + 𝑘3 ) = ℎ(𝑡2 + ℎ)2 sin(𝑦2 + 𝑘3 ) = 0.007 609 598

1
𝑦3 = 𝑦2 + [𝑘1 + 2(𝑘2 + 𝑘3 ) + 𝑘4 ] = 1.007 591 604
6

On continue les calculs en suivant la même procédure.


Remarque
En comparant la méthode de Runge-Kutta d’ordre 4 avec les autres
méthodes d’ordre 2, on notera que la solution analytique est reproduite par
RK4 avec une erreur absolue autour de 10-6.

Vous aimerez peut-être aussi