Numerical solution of ordinary and
partial dierential Equations
Module 23: Analysis of
nite dierence
methods
Dr.rer.nat. Narni Nageswara Rao
£
August 2011
1 Convergence of dierence schemes
We are now establishing the convergence of the dierence scheme for the
numerical solution of the boundary value problem
 yHH + f(t; y) = 0; a  t  b (1)
y(a) = 
1; y(b) = 
2
Consider the second order dierence scheme for (1) given by
 yj 1 + 2yj  yj+1 + h2
fj = 0; j = 1; 2; ¡¡¡ ; N (2)
The boundary conditions become
y0 = 
1; yN+1 = 
2 (3)
The exact solution y(t) of (1) satis
es
 y(tj 1) + 2y(tj)  y(tj+1) + h2
f(t; y(tj)) + Tj = 0 (4)
Where Tj is the truncation error. Substracting (4) from (2) and applying
the mean value theorem, and substituting j = yj   y(tj), we get the error
equation
 j 1 + 2j  j+1 + h2
fyjj  Tj = 0; j = 1; 2; ¡¡¡ ; N (5)
£nnrao maths@yahoo.co.in
1
where Tj =
h4
12
y(4)
(j); tj 1  j  tj+1
In matrix notation, we write (5) as
ME = T (6)
where M = J + Q; E = [1; 2; ¡¡¡ ; N ]T
, T = [T1; T2; ¡¡¡ ; TN ]T
J =
2
6664
2  1 0
 1 2  1
...
0  1 2
3
7775
and
Q = h2
2
6664
fy1 0
fy2
...
0 fyN
3
7775
From (6), we can observe that the convergence of the dierence scheme de-
pends on the properties of the matrix M. we noe show that the matrix
M = J +Q is an irreducible, monotone matrix such that M ! J and Q ! 0.
Irreducible: A tridiagonal matrix A = ai;j, where aij = 0 for ji  jj  1
is irreducible if and only if ai;i 1 T= 0; i = 1; 2; ¡¡¡ ; N and ai;i+1 T= 0; i =
1; 2; ¡¡¡ ; N  1.
Diagonally dominant: A matrix A = ai;j is diagonally dominant if
jai;ij !
nX
j=1;iT=j
jai;jj; i = 1; 2; ¡¡¡ ; N
A matrix A = aij is said to be irreducibly diagonal dominant, if it is irre-
ducible and diagonally dominant with inequality being satis
ed for atleast
one i.
Theorem 1.1. A matrix A is monotone if Az ! 0 implies z ! 0.
The following are some properties of monotone matrices.
(i) A monotone matrix A is non singular.
(ii) A matrix A is monotone if and only if A
 1
! 0.
2
Theorem 1.2. If a matrix A is irreducibly diagonal dominant and has non
positive o-diagonal elements, then A is monotone.
For example, the matrix J(see(6)) is tridiagonal, irreducibly diagonally dom-
inant and has non positive o diagonal elements. Therefore, J is a monotone
matrix.
Theorem 1.3. If matrices A and B are monotone and B A, then B
 1
!
A
 1
.
Now, consider equation (6).
Since fyj  0, j = 1; 2; ¡¡¡ ; N we have Q ! 0 and hence
M = J + Q ! J
Also, J is monotone. Now Q is diagonal matrix with positive diagonal en-
tries. Hence M = J + Q is also irreducibly diagonal dominant and have non
positive o-diagonal elements. Therefore, M is monotone and M ! J and
form Theorem 1.3 we have 0  M
 1 J
 1:
From (6), we have
E = M
 1
T
kEk kM
 1
kkTk kJ
 1
kkTk (7)
In order to
nd this bound, we determine J
 1
= ji;j explicitly. On multiplying
the rows of J by the jth
column of J
 1
, we have the following equations.
(i) : 2ji;j  j2;j = 0
(ii) :  ji 1;j + 2ji;j  ji+1;j = 0 i = 2; 3; ¡¡¡ ; j  1
(iii) :  jj 1;j + 2jj;j  jj+1;j = 1
(iv) :  ji 1;j + 2ji;j  ji+1;j = 0; i = j + 1; j + 2; ¡¡¡ ; N  1
(v) :  jN 1;j + 2jN;j = 0 (8)
The solution of ((8).ii) using ((8).i), is given by
ji;j = c2i; i = 1; 2; 3; ¡¡¡ ; j  1 (9)
where c2 is independent of i, but may depend on j. Similarly, the solution of
((8).iv), using ((8).v), is given by
jij = c1

1   i
N + 1

; i = j + 1; j + 2; ¡¡¡ ; N  1 (10)
3

Ma2002 1.23 rm

  • 1.
    Numerical solution ofordinary and partial dierential Equations Module 23: Analysis of
  • 2.
    nite dierence methods Dr.rer.nat. NarniNageswara Rao £ August 2011 1 Convergence of dierence schemes We are now establishing the convergence of the dierence scheme for the numerical solution of the boundary value problem  yHH + f(t; y) = 0; a t b (1) y(a) = 1; y(b) = 2 Consider the second order dierence scheme for (1) given by  yj 1 + 2yj  yj+1 + h2 fj = 0; j = 1; 2; ¡¡¡ ; N (2) The boundary conditions become y0 = 1; yN+1 = 2 (3) The exact solution y(t) of (1) satis
  • 3.
    es  y(tj 1) + 2y(tj) y(tj+1) + h2 f(t; y(tj)) + Tj = 0 (4) Where Tj is the truncation error. Substracting (4) from (2) and applying the mean value theorem, and substituting j = yj   y(tj), we get the error equation  j 1 + 2j  j+1 + h2 fyjj  Tj = 0; j = 1; 2; ¡¡¡ ; N (5) £nnrao maths@yahoo.co.in 1
  • 4.
    where Tj = h4 12 y(4) (j);tj 1 j tj+1 In matrix notation, we write (5) as ME = T (6) where M = J + Q; E = [1; 2; ¡¡¡ ; N ]T , T = [T1; T2; ¡¡¡ ; TN ]T J = 2 6664 2  1 0  1 2  1 ... 0  1 2 3 7775 and Q = h2 2 6664 fy1 0 fy2 ... 0 fyN 3 7775 From (6), we can observe that the convergence of the dierence scheme de- pends on the properties of the matrix M. we noe show that the matrix M = J +Q is an irreducible, monotone matrix such that M ! J and Q ! 0. Irreducible: A tridiagonal matrix A = ai;j, where aij = 0 for ji  jj 1 is irreducible if and only if ai;i 1 T= 0; i = 1; 2; ¡¡¡ ; N and ai;i+1 T= 0; i = 1; 2; ¡¡¡ ; N  1. Diagonally dominant: A matrix A = ai;j is diagonally dominant if jai;ij ! nX j=1;iT=j jai;jj; i = 1; 2; ¡¡¡ ; N A matrix A = aij is said to be irreducibly diagonal dominant, if it is irre- ducible and diagonally dominant with inequality being satis
  • 5.
    ed for atleast onei. Theorem 1.1. A matrix A is monotone if Az ! 0 implies z ! 0. The following are some properties of monotone matrices. (i) A monotone matrix A is non singular. (ii) A matrix A is monotone if and only if A  1 ! 0. 2
  • 6.
    Theorem 1.2. Ifa matrix A is irreducibly diagonal dominant and has non positive o-diagonal elements, then A is monotone. For example, the matrix J(see(6)) is tridiagonal, irreducibly diagonally dom- inant and has non positive o diagonal elements. Therefore, J is a monotone matrix. Theorem 1.3. If matrices A and B are monotone and B A, then B  1 ! A  1 . Now, consider equation (6). Since fyj 0, j = 1; 2; ¡¡¡ ; N we have Q ! 0 and hence M = J + Q ! J Also, J is monotone. Now Q is diagonal matrix with positive diagonal en- tries. Hence M = J + Q is also irreducibly diagonal dominant and have non positive o-diagonal elements. Therefore, M is monotone and M ! J and form Theorem 1.3 we have 0 M  1 J  1: From (6), we have E = M  1 T kEk kM  1 kkTk kJ  1 kkTk (7) In order to
  • 7.
    nd this bound,we determine J  1 = ji;j explicitly. On multiplying the rows of J by the jth column of J  1 , we have the following equations. (i) : 2ji;j  j2;j = 0 (ii) :  ji 1;j + 2ji;j  ji+1;j = 0 i = 2; 3; ¡¡¡ ; j  1 (iii) :  jj 1;j + 2jj;j  jj+1;j = 1 (iv) :  ji 1;j + 2ji;j  ji+1;j = 0; i = j + 1; j + 2; ¡¡¡ ; N  1 (v) :  jN 1;j + 2jN;j = 0 (8) The solution of ((8).ii) using ((8).i), is given by ji;j = c2i; i = 1; 2; 3; ¡¡¡ ; j  1 (9) where c2 is independent of i, but may depend on j. Similarly, the solution of ((8).iv), using ((8).v), is given by jij = c1 1   i N + 1 ; i = j + 1; j + 2; ¡¡¡ ; N  1 (10) 3
  • 8.
    The constant c1depends only on j. on equating the expression for ji;j ob- tained from (9) and (10) for i = j we get c2j = c1 1   i N + 1 (11) Also, on substituting the values of ji;j; i = j  1; j + 1 obtained from (9) and (10) in ((8).iii), we have c2 + c1 N + 1 = 1 (12) Finally, from (11) and (12), we get c1 = j; c2 = N  j + 1 N + 1 (13) on substituting the values of c1 and c2, we have ji;j = ( i(N j+1) (N+1) ; i j j(N i+1) (N+1) ; i ! j (14) From (14), we see that J  1 is symmetric. The row sum of J  1 is gives as NX j=1 ji;j = i(N  i + 1) 2 = (ti  a)(b  ti) 2h2 Hence, we obtain kJ  1 k = max 1 i N NX j=1 jji;jj (b  a)2 8h2 The equation (7) becomes kEk (b  a)2 8h2 kTk Substituting, kTk h4M4 12 , we obtaine kEk 1 96 (b  a)2 h2 M4 = y(h2 ) (15) where M4 = maxjP[a;b] jy(4) (j)j: From the equation (15), it follows that the method is of second order and kEk 3 0 or yj 3 y(tj) as h 3 0. This establishes the convergence of the second order method. 4
  • 9.
  • 10.
    nite dierence schemes Wenow examine the stability of
  • 11.
    nite dierence formulations.We take a simple second order dierential equation with a signi
  • 12.
  • 13.
    rst derivative. yHH +kyH = 0 (16) where k is a constant such that jkj 1. Three dierent approximations for (16) in which the
  • 14.
    rst derivative isreplaced by central, backward and forward dierences respectively are (i) yj+1  2yj + yj 1 h2 + k(yj+1  yj 1) 2h = 0 (ii) yj+1  2yj + yj 1 h2 + k(yj  yj 1) h = 0 (iii) yj+1  2yj + yj 1 h2 + k(yj+1  yj) h = 0 (17) The analytical solution of (16) is given by y(t) = A1 + B1e kt where A1 and B1 are arbitrary constants to be determined with the help of boundary conditions. The characteristic equation corresponding to the dierence equation ((17).i) is 1 h2 (2  2 + 1) + k 2h (2  1) = 0 2(  1)2 + kh(2  1) = 0 (  1)[2(  1) + kh( + 1)] = 0 (  1)[(2 + hk)  (2  h)] = 0 giving = 1, 2 hk 2+hk ) Solution of ((17).i) is yj = A1 + B1 2  hk 2 + hk j = A1 + B1 1   kh 2 1 + kh 2 #j 5
  • 15.
    If the behaviourof the exponential term is analysed, it is seen that it displays the correct monotonic behaviour for k 0 and k 0 if the condition h 2 jkj is satis
  • 16.
    ed. This isthe condition for the stability of the dierence equation ((17).i). For very large k, 2 hk 2+hk 3  1 and due to the presence of the term ( 1)j , the solution (error) oscillates. Therefore, the stability condition will make this central dierence scheme computationally infeasible. Consider, the dierence equation ((17).ii). The characteristic equation corresponding to it is (  1)2 + kh(  1) = 0 (  1)[  (1  hk)] = 0 ) = 1; 2 = 1  hk ) yj = A1 + B1(1  hk)j Analysis of the exponential term gives that if k 0, then we require that jkhj 1 A h 1 k for stability. If k 0, then there is no condition on h and the dierence scheme ((17).ii) is unconditionally stable. If k becomes very large and positive, then (1   hk) 3  I and due to the prescence of the term ( 1)j , the solution(error) oscillates. Therefore, a backward dierence scheme becomes infeasible for large positive k. Now consider the forward dierence scheme ((17).iii). The characteristic equation is (  1)2 + kh(2  ) = 0 (  1)[(1 + hk)  1] = 0 ) 1 = 1; 2 = 1 1 + hk ) yj = A1 + B1 1 1 + kh j Again if k 0, then h  1 k is the condition for stability. If k 0, then there is no condition on h and proper behaviour is guar- anteed for all h. Thus, if k becomes bery large and negative then a forward dierence scheme is infeasible. 6
  • 17.
    Hence, for stabilityit is necessary that dierent dierence approximations for the
  • 18.
    rst order termmust be used depending on the sign of k. we may use the approximation yH(tj) = yj yj 1 h ; if k 0 yj+1 yj h ; if k 0 The one-sided dierence scheme is unconditionally stable and it is always on the upstream or upwind side of tj. However, it suers from the disadvan- tage that it is only
  • 19.
    rst-order accurate. 3 Appendix Werecall the concept of a norm of a vector, kxk. The negative quantity kxk is a measure of the size or length of a vector satisfying. (i) kxk 0, for x T= 0 and k0k = 0 (ii) kcxk = jcjkxk, for any arbitrary complex number c. (iii) kx + yk kxk+ kyk (18) We shall in most cases use the maximum norm kxk = max 1 i n jxij At this point we must also recall the concept of a matrix norm. In addition to the properties analogous to (18) the matrix norm must be consistent with the vector norm that we are using for any vector x and matrix A. kAxk kAkkxk It is easy to verify that the norm kAk = max 1 i n nX j=1 jai;jj is consistent with max norm kxk. 7