
1322 LINEAR PARTIAL DIFFERENTIAL EQUATIONS WITH MAPLE
od; od;
printf(` i X(i) U(X(i),NT)\n`);
for i from 1 to NX1 do
X[i-1]:=(i-1)*h: printf(`%3d %11.8f %13.8f\n`,i,X[i-1],U[i-1,NT1-1]);
od:
Points:=[seq([X[i-1],U[i-1,NT1-1]],i=1..NX1)];
plot(Points,style=point,color=blue,symbol=circle);
We construct and visualize the same ap proximate numer ic al solution of the initial-boundary
value problem by applying the explicit central finite difference method and by following a different
style of p rogramming as fo llows:
with(plots): c:=evalf(1/(4*Pi)); L:=0.5: T:=1.5: NX:=40: NT:=40:
h:=L/NX; k:=T/NT; r:=(c*k/h)ˆ2; f1:=x->0: f2:=x->evalf(sin(4*Pi*x)):
IC:={seq(U1(i,0)= ...