% exmp8.m - for Table 5 % This computes m(t) % by discretizing the interval (0,a) clear all i=sqrt(-1); % Set up basic data %h=number of divisions per unit length h=20 %a=length of interval a=10 %b=diffusion paramter b=20 % number of points altogether N = h*a-1 % set up tridiagonal matrix u=ones(N,1); v=ones(N-1,1); A=-2*(h^2)*b^(-1)*diag(u)+(h^2)*b^(-1)*diag(v,1)+(h^2)*b^(-1)*diag(v,-1); B=(-h/2)*diag(v,1)+(h/2)*diag(v,-1); A; B; C=A+B; f=sin((pi/(h*a))*(1:N)'); format long m=zeros(10,1); % compute the norms for t=1:10 m(t,1)=norm(expm(t*C)*f,inf); end; m