9.8 Chapitre 8
347
Solution 8.3 On remarque que
u(¯ x + h) = u(¯ x) + hu
(¯ x) +
h
2
2
u
(¯ x) +
h
3
6
u
(¯ x) +
h
4
24
u
(4) (ξ+),
u(¯ x − h) = u(¯ x) − hu
(¯ x) +
h
2
2
u
(¯ x) −
h
3
6
u
(¯ x) +
h
4
24
u
(4) (ξ−),
où ξ+ ∈]x, x + h[ et ξ− ∈]x − h, x[. En ajoutant ces deux expressions, on
obtient
u(¯ x + h) + u(¯ x − h) = 2u(¯ x) + h
2 u
(¯ x) +
h
4
24
(u
(4) (ξ+) + u
(4) (ξ−)),
ce qui est la propriété voulue.
Solution 8.4 La matrice est encore tridiagonale, de coefficients ai,i−1 =
−μ/h
2 − η/(2h), aii = 2μ/h
2 + σ, ai,i+1 = −μ/h
2 + η/(2h). Le second
membre, tenant compte des conditions aux limites, devient f = (f (x1) +
α(μ/h
2 + η/(2h)), f(x2), . . . , f (xN−1), f(xN ) + β(μ/h
2 − η/(2h)))
T .
Solution 8.5 On calcule les solutions correspondant aux trois valeurs de h à
l’aide des instructions suivantes :
f = inline ( ’ 1+ sin (4* pi *x ) ’, ’x ’ );
[x , uh11 ]= bvp (0 ,1 ,9 ,1 ,0 ,0.1 ,f ,0 ,0);
[x , uh21 ]= bvp (0 ,1 ,19 ,1 ,0 ,0.1 ,f ,0 ,0);
[x , uh41 ]= bvp (0 ,1 ,39 ,1 ,0 ,0.1 ,f ,0 ,0);
Rappelons que h = (b − a)/(N + 1). Comme on ne connaît pas la solution
exacte, on estime la convergence en calculant sur un maillage très fin (par
exemple h = 1/1000) une solution approchée qu’on utilise en remplacement
de la solution exacte. On trouve :
[x , uhex ]= bvp (0 ,1 ,999 ,1 ,0 ,0.1 ,f ,0 ,0);
max ( abs ( uh11 - uhex (1:100: end )))
ans =
8.6782e-04
max(abs(uh21-uhex(1:50:end)))
ans =
2.0422e-04
max(abs(uh41-uhex(1:25:end)))
ans =
5.2789e-05
En divisant h par deux, l’erreur est divisée par 4, ce qui montre que la convergence est d’ordre 2 par rapport à h.
Solution 8.6 On peut modifier le Programme 8.1 pour imposer des conditions
aux limites de Neumann. On propose une implémentation possible dans le
Programme 9.4.
347
Solution 8.3 On remarque que
u(¯ x + h) = u(¯ x) + hu
(¯ x) +
h
2
2
u
(¯ x) +
h
3
6
u
(¯ x) +
h
4
24
u
(4) (ξ+),
u(¯ x − h) = u(¯ x) − hu
(¯ x) +
h
2
2
u
(¯ x) −
h
3
6
u
(¯ x) +
h
4
24
u
(4) (ξ−),
où ξ+ ∈]x, x + h[ et ξ− ∈]x − h, x[. En ajoutant ces deux expressions, on
obtient
u(¯ x + h) + u(¯ x − h) = 2u(¯ x) + h
2 u
(¯ x) +
h
4
24
(u
(4) (ξ+) + u
(4) (ξ−)),
ce qui est la propriété voulue.
Solution 8.4 La matrice est encore tridiagonale, de coefficients ai,i−1 =
−μ/h
2 − η/(2h), aii = 2μ/h
2 + σ, ai,i+1 = −μ/h
2 + η/(2h). Le second
membre, tenant compte des conditions aux limites, devient f = (f (x1) +
α(μ/h
2 + η/(2h)), f(x2), . . . , f (xN−1), f(xN ) + β(μ/h
2 − η/(2h)))
T .
Solution 8.5 On calcule les solutions correspondant aux trois valeurs de h à
l’aide des instructions suivantes :
f = inline ( ’ 1+ sin (4* pi *x ) ’, ’x ’ );
[x , uh11 ]= bvp (0 ,1 ,9 ,1 ,0 ,0.1 ,f ,0 ,0);
[x , uh21 ]= bvp (0 ,1 ,19 ,1 ,0 ,0.1 ,f ,0 ,0);
[x , uh41 ]= bvp (0 ,1 ,39 ,1 ,0 ,0.1 ,f ,0 ,0);
Rappelons que h = (b − a)/(N + 1). Comme on ne connaît pas la solution
exacte, on estime la convergence en calculant sur un maillage très fin (par
exemple h = 1/1000) une solution approchée qu’on utilise en remplacement
de la solution exacte. On trouve :
[x , uhex ]= bvp (0 ,1 ,999 ,1 ,0 ,0.1 ,f ,0 ,0);
max ( abs ( uh11 - uhex (1:100: end )))
ans =
8.6782e-04
max(abs(uh21-uhex(1:50:end)))
ans =
2.0422e-04
max(abs(uh41-uhex(1:25:end)))
ans =
5.2789e-05
En divisant h par deux, l’erreur est divisée par 4, ce qui montre que la convergence est d’ordre 2 par rapport à h.
Solution 8.6 On peut modifier le Programme 8.1 pour imposer des conditions
aux limites de Neumann. On propose une implémentation possible dans le
Programme 9.4.
