152
10
•
Différences finies en dimension 1
4. Compléter le programme précédent en construisantles 2matrices de R
N × N
A 1 =
⎛
⎜
⎜
⎜
⎜
⎜
⎜
⎝
2 − 10
− 12− 1
. . .
. . .
. . .
. . .
. . . − 1
0
− 12
⎞
⎟
⎟
⎟
⎟
⎟
⎟
⎠
, A 2 =
⎛
⎜
⎜
⎜
⎜
⎜
⎜
⎝
10c ( x 2 ) c ( x 3 )0
c ( x 2 )1 0 c ( x 3 )
. . .
. . .
. . .
c ( x N +1 )
0
c ( x N )1 0 c ( x N +1 )
⎞
⎟
⎟
⎟
⎟
⎟
⎟
⎠
et A = A 1 +
h
2
12
A 2 que l’on affichera. Sauvegarder sous numerov2.m et test avec N = 5
✞
☎
>> numerov2
A=
2.0039
-0.9992
000
-0.9996
2.0077
-0.9988
00
0- 0.9992
2.0116
-0.9985
0
00
-0.9988
2.0154
-0.9981
000
-0.9985
2.0193
✝
✆
5. Compléter le programme ci-dessus avec le calcul de
b 1 =
⎛
⎜
⎜
⎜
⎜
⎝
f ( x 1 )+10 f ( x 2 )+ f ( x 3 )
. . .
. . .
f ( x N )+10 f ( x N +1 )+ f ( x N +2 )
⎞
⎟
⎟
⎟
⎟
⎠
∈ R
N
, b 2 =
⎛
⎜
⎜
⎜
⎜
⎜
⎝
(1 −
h
2
12 c ( x 1 ))a
0
. . .
0
(1 −
h
2
12 c ( x N +2 ))b
⎞
⎟
⎟
⎟
⎟
⎟
⎠
∈ R
N
et b =
h
2
12
b 1 + b 2 que l’on affichera. Sauvegardersous numerov3.m et test avec N = 5 , a = 1,
b = − 1.
✞
☎
>> numerov3
b=
1.2359
0.1382
-0.0004
-0.1434
-1.2496
✝
✆
6. Détermineretafficher W , V et err = V − U ∞ .Dessiner solutions exacte et approchée.
Sauvegarder sous numerov4.m et testa vec N = 5. La solution exacte est donnée par u ( x ) =
sin(p ( x +1/ 2)).
10
•
Différences finies en dimension 1
4. Compléter le programme précédent en construisantles 2matrices de R
N × N
A 1 =
⎛
⎜
⎜
⎜
⎜
⎜
⎜
⎝
2 − 10
− 12− 1
. . .
. . .
. . .
. . .
. . . − 1
0
− 12
⎞
⎟
⎟
⎟
⎟
⎟
⎟
⎠
, A 2 =
⎛
⎜
⎜
⎜
⎜
⎜
⎜
⎝
10c ( x 2 ) c ( x 3 )0
c ( x 2 )1 0 c ( x 3 )
. . .
. . .
. . .
c ( x N +1 )
0
c ( x N )1 0 c ( x N +1 )
⎞
⎟
⎟
⎟
⎟
⎟
⎟
⎠
et A = A 1 +
h
2
12
A 2 que l’on affichera. Sauvegarder sous numerov2.m et test avec N = 5
✞
☎
>> numerov2
A=
2.0039
-0.9992
000
-0.9996
2.0077
-0.9988
00
0- 0.9992
2.0116
-0.9985
0
00
-0.9988
2.0154
-0.9981
000
-0.9985
2.0193
✝
✆
5. Compléter le programme ci-dessus avec le calcul de
b 1 =
⎛
⎜
⎜
⎜
⎜
⎝
f ( x 1 )+10 f ( x 2 )+ f ( x 3 )
. . .
. . .
f ( x N )+10 f ( x N +1 )+ f ( x N +2 )
⎞
⎟
⎟
⎟
⎟
⎠
∈ R
N
, b 2 =
⎛
⎜
⎜
⎜
⎜
⎜
⎝
(1 −
h
2
12 c ( x 1 ))a
0
. . .
0
(1 −
h
2
12 c ( x N +2 ))b
⎞
⎟
⎟
⎟
⎟
⎟
⎠
∈ R
N
et b =
h
2
12
b 1 + b 2 que l’on affichera. Sauvegardersous numerov3.m et test avec N = 5 , a = 1,
b = − 1.
✞
☎
>> numerov3
b=
1.2359
0.1382
-0.0004
-0.1434
-1.2496
✝
✆
6. Détermineretafficher W , V et err = V − U ∞ .Dessiner solutions exacte et approchée.
Sauvegarder sous numerov4.m et testa vec N = 5. La solution exacte est donnée par u ( x ) =
sin(p ( x +1/ 2)).
