next up previous

Exercise 13: Implicit FDE used to approximate the solution to an IBVP.
Use the implicit FDE Eq. (22) to approximate the solution to the IBVP

Take c = 1 and and experiment with different values of space step h and time step k. Hint: The following Gaussian elimination scheme for tridiagonal linear systems may be a useful starting point in constructing a solution to this problem:

      program trid
c  a holds subdiagonal, b the diagonal, and c the superdiagonal
c  d initially holds the right hand side of the linear system
c  d contains the solution at program termination  
      dimension a(n), b(n), c(n), d(n)
      data a /n*-1.0/
      data b /n*2.0/
      data c /n*-1.0/
      data d/n*1.0/
      do 1 i = 2,n
      ratio = a(i)/b(i-1)
      b(i) = b(i) - ratio*c(i-1)
      d(i) = d(i) - ratio*d(i-1)
 1    continue
      d(n) = d(n)/b(n)
      do 2 i = n-1,1,-1
      d(i) = (d(i) - c(i)*d(i+1))/b(i)
 2    continue