Example5.2.5 Rev 1.mw

Example 5.2.5 Two Coupled PDEs 

> restart;
 

> with(linalg):with(plots):
 

Enter the governing equations: 

> ge[1]:=diff(u[1](x,t),t)=diff((u[2](x,t)-1)*diff(u[1](x,t),x),x)+(16*x*t-2*t-16*(u[2](x,t)-1))*(u[1](x,t)-1)+10*x*exp(-4*x);
 

diff(u[1](x, t), t) = `+`(`*`(diff(u[2](x, t), x), `*`(diff(u[1](x, t), x))), `*`(`+`(u[2](x, t), `-`(1)), `*`(diff(diff(u[1](x, t), x), x))), `*`(`+`(`*`(16, `*`(x, `*`(t))), `-`(`*`(2, `*`(t))), `-`...
diff(u[1](x, t), t) = `+`(`*`(diff(u[2](x, t), x), `*`(diff(u[1](x, t), x))), `*`(`+`(u[2](x, t), `-`(1)), `*`(diff(diff(u[1](x, t), x), x))), `*`(`+`(`*`(16, `*`(x, `*`(t))), `-`(`*`(2, `*`(t))), `-`...
(1)
 

> ge[2]:=diff(u[2](x,t),t)=diff(u[2](x,t),x$2)+diff(u[1](x,t),x)+4*(u[1](x,t)-1)+x^2-2*t-10*t*exp(-4*x);
 

diff(u[2](x, t), t) = `+`(diff(diff(u[2](x, t), x), x), diff(u[1](x, t), x), `*`(4, `*`(u[1](x, t))), `-`(4), `*`(`^`(x, 2)), `-`(`*`(2, `*`(t))), `-`(`*`(10, `*`(t, `*`(exp(`+`(`-`(`*`(4, `*`(x))))))... (2)
 

Enter the boundary conditions at x = 0: 

> bc1[1]:=u[1](x,t)-1;
 

`+`(u[1](x, t), `-`(1)) (3)
 

> bc1[2]:=u[2](x,t)-1;
 

`+`(u[2](x, t), `-`(1)) (4)
 

Enter the boundary conditions at x = 1: 

> bc2[1]:=3*u[1](x,t)+diff(u[1](x,t),x)-3;
 

`+`(`*`(3, `*`(u[1](x, t))), diff(u[1](x, t), x), `-`(3)) (5)
 

> bc2[2]:=5*diff(u[2](x,t),x)-evalf(exp(4))*(u[1](x,t)-1);
 

`+`(`*`(5, `*`(diff(u[2](x, t), x))), `-`(`*`(54.59815003, `*`(u[1](x, t)))), 54.59815003) (6)
 

Enter the initial conditions: 

> IC[1]:=u[1](x,0)=1;
 

u[1](x, 0) = 1 (7)
 

> IC[2]:=u[2](x,0)=1;
 

u[2](x, 0) = 1 (8)
 

Enter the number of governing equations: 

> NN:=2;
 

2 (9)
 

> N:=2;
 

2 (10)
 

> L:=1;
 

1 (11)
 

Develop finite difference expressions for the first and second derivatives for the given two dependent dependent variables: 

> for i to NN do
 

> dydxf[i]:=1/2*(-u[2,i](t)-3*u[0,i](t)+4*u[1,i](t))/h;
 

> dydxb[i]:=1/2*(u[N-1,i](t)+3*u[N+1,i](t)-4*u[N,i](t))/h;
 

> dydx[i]:=1/2/h*(u[m+1,i](t)-u[m-1,i](t));
 

> d2ydx2[i]:=1/h^2*(u[m-1,i](t)-2*u[m,i](t)+u[m+1,i](t));od;
 

 

 

 

 

 

 

 

`+`(`/`(`*`(`/`(1, 2), `*`(`+`(`-`(u[2, 1](t)), `-`(`*`(3, `*`(u[0, 1](t)))), `*`(4, `*`(u[1, 1](t)))))), `*`(h)))
`+`(`/`(`*`(`/`(1, 2), `*`(`+`(u[1, 1](t), `*`(3, `*`(u[3, 1](t))), `-`(`*`(4, `*`(u[2, 1](t))))))), `*`(h)))
`+`(`/`(`*`(`/`(1, 2), `*`(`+`(u[`+`(m, 1), 1](t), `-`(u[`+`(m, `-`(1)), 1](t))))), `*`(h)))
`/`(`*`(`+`(u[`+`(m, `-`(1)), 1](t), `-`(`*`(2, `*`(u[m, 1](t)))), u[`+`(m, 1), 1](t))), `*`(`^`(h, 2)))
`+`(`/`(`*`(`/`(1, 2), `*`(`+`(`-`(u[2, 2](t)), `-`(`*`(3, `*`(u[0, 2](t)))), `*`(4, `*`(u[1, 2](t)))))), `*`(h)))
`+`(`/`(`*`(`/`(1, 2), `*`(`+`(u[1, 2](t), `*`(3, `*`(u[3, 2](t))), `-`(`*`(4, `*`(u[2, 2](t))))))), `*`(h)))
`+`(`/`(`*`(`/`(1, 2), `*`(`+`(u[`+`(m, 1), 2](t), `-`(u[`+`(m, `-`(1)), 2](t))))), `*`(h)))
`/`(`*`(`+`(u[`+`(m, `-`(1)), 2](t), `-`(`*`(2, `*`(u[m, 2](t)))), u[`+`(m, 1), 2](t))), `*`(`^`(h, 2))) (12)
 

Convert the boundary conditions to the finite difference form: 

> for i to NN do bc1[i]:=subs(diff(u[1](x,t),x)=dydxf[1],diff(u[2](x,t),x)=dydxf[2],u[1](x,t)=u[0,1](t),u[2](x,t)=u[0,2](t),x=0,bc1[i]);od;
 

 

`+`(u[0, 1](t), `-`(1))
`+`(u[0, 2](t), `-`(1)) (13)
 

> for i to NN do bc2[i]:=subs(diff(u[1](x,t),x)=dydxb[1],diff(u[2](x,t),x)=dydxb[2],u[1](x,t)=u[N+1,1](t),u[2](x,t)=u[N+1,2](t),x=L,bc2[i]);od;
 

 

`+`(`*`(3, `*`(u[3, 1](t))), `/`(`*`(`/`(1, 2), `*`(`+`(u[1, 1](t), `*`(3, `*`(u[3, 1](t))), `-`(`*`(4, `*`(u[2, 1](t))))))), `*`(h)), `-`(3))
`+`(`/`(`*`(`/`(5, 2), `*`(`+`(u[1, 2](t), `*`(3, `*`(u[3, 2](t))), `-`(`*`(4, `*`(u[2, 2](t))))))), `*`(h)), `-`(`*`(54.59815003, `*`(u[3, 1](t)))), 54.59815003) (14)
 

> for i to NN do eq[0,i]:=bc1[i];eq[N+1,i]:=bc2[i];od;
 

 

 

 

`+`(u[0, 1](t), `-`(1))
`+`(`*`(3, `*`(u[3, 1](t))), `/`(`*`(`/`(1, 2), `*`(`+`(u[1, 1](t), `*`(3, `*`(u[3, 1](t))), `-`(`*`(4, `*`(u[2, 1](t))))))), `*`(h)), `-`(3))
`+`(u[0, 2](t), `-`(1))
`+`(`/`(`*`(`/`(5, 2), `*`(`+`(u[1, 2](t), `*`(3, `*`(u[3, 2](t))), `-`(`*`(4, `*`(u[2, 2](t))))))), `*`(h)), `-`(`*`(54.59815003, `*`(u[3, 1](t)))), 54.59815003) (15)
 

Convert the first governing equation to the finite difference form: 

> for i from 1 to N do eq[i,1]:=diff(u[i,1](t),t)= subs(diff(u[1](x,t),x$2) = subs(m=i,d2ydx2[1]),diff(u[2](x,t),x$2) = subs(m=i,d2ydx2[2]),diff(u[1](x,t),x) = subs(m=i,dydx[1]),diff(u[2](x,t),x) = subs(m=i,dydx[2]),u[1](x,t)=u[i,1](t),u[2](x,t)=u[i,2](t),x=i*h,rhs(ge[1]));od;
 

 

diff(u[1, 1](t), t) = `+`(`/`(`*`(`/`(1, 4), `*`(`+`(u[2, 2](t), `-`(u[0, 2](t))), `*`(`+`(u[2, 1](t), `-`(u[0, 1](t)))))), `*`(`^`(h, 2))), `/`(`*`(`+`(u[1, 2](t), `-`(1)), `*`(`+`(u[0, 1](t), `-`(`*...
diff(u[1, 1](t), t) = `+`(`/`(`*`(`/`(1, 4), `*`(`+`(u[2, 2](t), `-`(u[0, 2](t))), `*`(`+`(u[2, 1](t), `-`(u[0, 1](t)))))), `*`(`^`(h, 2))), `/`(`*`(`+`(u[1, 2](t), `-`(1)), `*`(`+`(u[0, 1](t), `-`(`*...
diff(u[1, 1](t), t) = `+`(`/`(`*`(`/`(1, 4), `*`(`+`(u[2, 2](t), `-`(u[0, 2](t))), `*`(`+`(u[2, 1](t), `-`(u[0, 1](t)))))), `*`(`^`(h, 2))), `/`(`*`(`+`(u[1, 2](t), `-`(1)), `*`(`+`(u[0, 1](t), `-`(`*...
diff(u[2, 1](t), t) = `+`(`/`(`*`(`/`(1, 4), `*`(`+`(u[3, 2](t), `-`(u[1, 2](t))), `*`(`+`(u[3, 1](t), `-`(u[1, 1](t)))))), `*`(`^`(h, 2))), `/`(`*`(`+`(u[2, 2](t), `-`(1)), `*`(`+`(u[1, 1](t), `-`(`*...
diff(u[2, 1](t), t) = `+`(`/`(`*`(`/`(1, 4), `*`(`+`(u[3, 2](t), `-`(u[1, 2](t))), `*`(`+`(u[3, 1](t), `-`(u[1, 1](t)))))), `*`(`^`(h, 2))), `/`(`*`(`+`(u[2, 2](t), `-`(1)), `*`(`+`(u[1, 1](t), `-`(`*...
diff(u[2, 1](t), t) = `+`(`/`(`*`(`/`(1, 4), `*`(`+`(u[3, 2](t), `-`(u[1, 2](t))), `*`(`+`(u[3, 1](t), `-`(u[1, 1](t)))))), `*`(`^`(h, 2))), `/`(`*`(`+`(u[2, 2](t), `-`(1)), `*`(`+`(u[1, 1](t), `-`(`*...
(16)
 

Convert the second governing equation to the finite difference form: 

> for i from 1 to N do eq[i,2]:=diff(u[i,2](t),t)= subs(diff(u[1](x,t),x$2) = subs(m=i,d2ydx2[1]),diff(u[2](x,t),x$2) = subs(m=i,d2ydx2[2]),diff(u[1](x,t),x) = subs(m=i,dydx[1]),diff(u[2](x,t),x) = subs(m=i,dydx[2]),u[1](x,t)=u[i,1](t),u[2](x,t)=u[i,2](t),x=i*h,rhs(ge[2]));od;
 

 

diff(u[1, 2](t), t) = `+`(`/`(`*`(`+`(u[0, 2](t), `-`(`*`(2, `*`(u[1, 2](t)))), u[2, 2](t))), `*`(`^`(h, 2))), `/`(`*`(`/`(1, 2), `*`(`+`(u[2, 1](t), `-`(u[0, 1](t))))), `*`(h)), `*`(4, `*`(u[1, 1](t)...
diff(u[1, 2](t), t) = `+`(`/`(`*`(`+`(u[0, 2](t), `-`(`*`(2, `*`(u[1, 2](t)))), u[2, 2](t))), `*`(`^`(h, 2))), `/`(`*`(`/`(1, 2), `*`(`+`(u[2, 1](t), `-`(u[0, 1](t))))), `*`(h)), `*`(4, `*`(u[1, 1](t)...
diff(u[2, 2](t), t) = `+`(`/`(`*`(`+`(u[1, 2](t), `-`(`*`(2, `*`(u[2, 2](t)))), u[3, 2](t))), `*`(`^`(h, 2))), `/`(`*`(`/`(1, 2), `*`(`+`(u[3, 1](t), `-`(u[1, 1](t))))), `*`(h)), `*`(4, `*`(u[2, 1](t)...
diff(u[2, 2](t), t) = `+`(`/`(`*`(`+`(u[1, 2](t), `-`(`*`(2, `*`(u[2, 2](t)))), u[3, 2](t))), `*`(`^`(h, 2))), `/`(`*`(`/`(1, 2), `*`(`+`(u[3, 1](t), `-`(u[1, 1](t))))), `*`(h)), `*`(4, `*`(u[2, 1](t)...
(17)
 

> for i to NN do u[0,i](t):=(solve(eq[0,i],u[0,i](t)));od;
 

 

1
1 (18)
 

Eliminate the boundary values: 

> for i to NN do u[N+1,i](t):=(solve(eq[N+1,i],u[N+1,i](t)));od;
 

 

`+`(`/`(`*`(`/`(1, 3), `*`(`+`(`-`(u[1, 1](t)), `*`(4, `*`(u[2, 1](t))), `*`(6, `*`(h))))), `*`(`+`(`*`(2, `*`(h)), 1))))
`+`(`-`(`/`(`*`(0.1333333333e-8, `*`(`+`(`*`(500000000., `*`(u[1, 2](t), `*`(h))), `*`(250000000., `*`(u[1, 2](t))), `-`(`*`(2000000000., `*`(u[2, 2](t), `*`(h)))), `-`(`*`(1000000000., `*`(u[2, 2](t)...
`+`(`-`(`/`(`*`(0.1333333333e-8, `*`(`+`(`*`(500000000., `*`(u[1, 2](t), `*`(h))), `*`(250000000., `*`(u[1, 2](t))), `-`(`*`(2000000000., `*`(u[2, 2](t), `*`(h)))), `-`(`*`(1000000000., `*`(u[2, 2](t)...
`+`(`-`(`/`(`*`(0.1333333333e-8, `*`(`+`(`*`(500000000., `*`(u[1, 2](t), `*`(h))), `*`(250000000., `*`(u[1, 2](t))), `-`(`*`(2000000000., `*`(u[2, 2](t), `*`(h)))), `-`(`*`(1000000000., `*`(u[2, 2](t)...
(19)
 

> h:=L/(N+1);
 

`/`(1, 3) (20)
 

> for i from 1 to N do eq[i,1]:=eval(eq[i,1]);od;
 

 

diff(u[1, 1](t), t) = `+`(`*`(`/`(9, 4), `*`(`+`(u[2, 2](t), `-`(1)), `*`(`+`(u[2, 1](t), `-`(1))))), `*`(9, `*`(`+`(u[1, 2](t), `-`(1)), `*`(`+`(1, `-`(`*`(2, `*`(u[1, 1](t)))), u[2, 1](t))))), `*`(`...
diff(u[1, 1](t), t) = `+`(`*`(`/`(9, 4), `*`(`+`(u[2, 2](t), `-`(1)), `*`(`+`(u[2, 1](t), `-`(1))))), `*`(9, `*`(`+`(u[1, 2](t), `-`(1)), `*`(`+`(1, `-`(`*`(2, `*`(u[1, 1](t)))), u[2, 1](t))))), `*`(`...
diff(u[2, 1](t), t) = `+`(`*`(`/`(9, 4), `*`(`+`(`-`(`*`(1.333333333, `*`(u[1, 2](t)))), `*`(1.333333333, `*`(u[2, 2](t))), `-`(`*`(.4853168888, `*`(u[1, 1](t)))), `*`(1.941267556, `*`(u[2, 1](t))), `...
diff(u[2, 1](t), t) = `+`(`*`(`/`(9, 4), `*`(`+`(`-`(`*`(1.333333333, `*`(u[1, 2](t)))), `*`(1.333333333, `*`(u[2, 2](t))), `-`(`*`(.4853168888, `*`(u[1, 1](t)))), `*`(1.941267556, `*`(u[2, 1](t))), `...
diff(u[2, 1](t), t) = `+`(`*`(`/`(9, 4), `*`(`+`(`-`(`*`(1.333333333, `*`(u[1, 2](t)))), `*`(1.333333333, `*`(u[2, 2](t))), `-`(`*`(.4853168888, `*`(u[1, 1](t)))), `*`(1.941267556, `*`(u[2, 1](t))), `...
(21)
 

> for i from 1 to N do eq[i,2]:=eval(eq[i,2]);od;
 

 

diff(u[1, 2](t), t) = `+`(`/`(65, 18), `-`(`*`(18, `*`(u[1, 2](t)))), `*`(9, `*`(u[2, 2](t))), `*`(`/`(3, 2), `*`(u[2, 1](t))), `*`(4, `*`(u[1, 1](t))), `-`(`*`(2, `*`(t))), `-`(`*`(10, `*`(t, `*`(exp...
diff(u[2, 2](t), t) = `+`(`*`(6.000000000, `*`(u[1, 2](t))), `-`(`*`(6.00000000, `*`(u[2, 2](t)))), `-`(`*`(6.167852000, `*`(u[1, 1](t)))), `*`(22.67140800, `*`(u[2, 1](t))), `-`(16.05911156), `-`(`*`...
diff(u[2, 2](t), t) = `+`(`*`(6.000000000, `*`(u[1, 2](t))), `-`(`*`(6.00000000, `*`(u[2, 2](t)))), `-`(`*`(6.167852000, `*`(u[1, 1](t)))), `*`(22.67140800, `*`(u[2, 1](t))), `-`(16.05911156), `-`(`*`...
(22)
 

Store the governing equations in eqs: 

> eqs:=seq(seq((eq[i,j]),i=1..N),j=1..NN);
 

diff(u[1, 1](t), t) = `+`(`*`(`/`(9, 4), `*`(`+`(u[2, 2](t), `-`(1)), `*`(`+`(u[2, 1](t), `-`(1))))), `*`(9, `*`(`+`(u[1, 2](t), `-`(1)), `*`(`+`(1, `-`(`*`(2, `*`(u[1, 1](t)))), u[2, 1](t))))), `*`(`...
diff(u[1, 1](t), t) = `+`(`*`(`/`(9, 4), `*`(`+`(u[2, 2](t), `-`(1)), `*`(`+`(u[2, 1](t), `-`(1))))), `*`(9, `*`(`+`(u[1, 2](t), `-`(1)), `*`(`+`(1, `-`(`*`(2, `*`(u[1, 1](t)))), u[2, 1](t))))), `*`(`...
diff(u[1, 1](t), t) = `+`(`*`(`/`(9, 4), `*`(`+`(u[2, 2](t), `-`(1)), `*`(`+`(u[2, 1](t), `-`(1))))), `*`(9, `*`(`+`(u[1, 2](t), `-`(1)), `*`(`+`(1, `-`(`*`(2, `*`(u[1, 1](t)))), u[2, 1](t))))), `*`(`...
diff(u[1, 1](t), t) = `+`(`*`(`/`(9, 4), `*`(`+`(u[2, 2](t), `-`(1)), `*`(`+`(u[2, 1](t), `-`(1))))), `*`(9, `*`(`+`(u[1, 2](t), `-`(1)), `*`(`+`(1, `-`(`*`(2, `*`(u[1, 1](t)))), u[2, 1](t))))), `*`(`...
diff(u[1, 1](t), t) = `+`(`*`(`/`(9, 4), `*`(`+`(u[2, 2](t), `-`(1)), `*`(`+`(u[2, 1](t), `-`(1))))), `*`(9, `*`(`+`(u[1, 2](t), `-`(1)), `*`(`+`(1, `-`(`*`(2, `*`(u[1, 1](t)))), u[2, 1](t))))), `*`(`...
diff(u[1, 1](t), t) = `+`(`*`(`/`(9, 4), `*`(`+`(u[2, 2](t), `-`(1)), `*`(`+`(u[2, 1](t), `-`(1))))), `*`(9, `*`(`+`(u[1, 2](t), `-`(1)), `*`(`+`(1, `-`(`*`(2, `*`(u[1, 1](t)))), u[2, 1](t))))), `*`(`...
diff(u[1, 1](t), t) = `+`(`*`(`/`(9, 4), `*`(`+`(u[2, 2](t), `-`(1)), `*`(`+`(u[2, 1](t), `-`(1))))), `*`(9, `*`(`+`(u[1, 2](t), `-`(1)), `*`(`+`(1, `-`(`*`(2, `*`(u[1, 1](t)))), u[2, 1](t))))), `*`(`...
(23)
 

Store the dependent variables in Y: 

> Y:=seq(seq(u[i,j](t),i=1..N),j=1..NN);
 

u[1, 1](t), u[2, 1](t), u[1, 2](t), u[2, 2](t) (24)
 

Store the initial conditions in ICs: 

> ICs:=seq(u[i,1](0)=rhs(IC[1]),i=1..N),seq(u[i,2](0)=rhs(IC[2]),i=1..N);
 

u[1, 1](0) = 1, u[2, 1](0) = 1, u[1, 2](0) = 1, u[2, 2](0) = 1 (25)
 

> sol:=dsolve({eqs,ICs},{Y},type=numeric,stiff=true,maxfun=1000000,abserr=1e-6,relerr=1e-5,output=listprocedure);
 

[t = proc (t) local res, data, solnproc, outpoint, t; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; `:=`(_EnvDSNumericSaveDigits, Digits); `:=`(Digits, 14); if _EnvInFsolve ...
[t = proc (t) local res, data, solnproc, outpoint, t; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; `:=`(_EnvDSNumericSaveDigits, Digits); `:=`(Digits, 14); if _EnvInFsolve ...
[t = proc (t) local res, data, solnproc, outpoint, t; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; `:=`(_EnvDSNumericSaveDigits, Digits); `:=`(Digits, 14); if _EnvInFsolve ...
(26)
 

> for j to NN do for i to N do U[i,j]:=subs(sol,u[i,j](t));od:od;
 

> for i to NN do U[0,i]:=subs(u[1,1](t)=U[1,1],u[1,2](t)=U[1,2],u[2,1](t)=U[2,1],u[2,2](t)=U[2,2],u[0,i](t));od;
 

 

1
1 (27)
 

> for i to NN do U[N+1,i]:=eval(subs(u[N,1](t)=U[N,1],u[N,2](t)=U[N,2],u[N-1,1](t)=U[N-1,1],u[N-1,2](t)=U[N-1,2],u[N+1,i](t)));od;
 

 

`+`(`-`(`*`(`/`(1, 5), `*`(U[1, 1]))), `*`(`/`(4, 5), `*`(U[2, 1])), `/`(2, 5))
`+`(`-`(`*`(.3333333332, `*`(U[1, 2]))), `*`(1.333333333, `*`(U[2, 2])), `-`(`*`(.4853168888, `*`(U[1, 1]))), `*`(1.941267556, `*`(U[2, 1])), `-`(1.455950666)) (28)
 

The numerical solution obtained is compared with the exact analytical solution at x = 1: 

> ua:=1+10*x*t*exp(-4*x);
 

`+`(1, `*`(10, `*`(x, `*`(t, `*`(exp(`+`(`-`(`*`(4, `*`(x)))))))))) (29)
 

> va:=1+x^2*t;
 

`+`(1, `*`(`^`(x, 2), `*`(t))) (30)
 

> U[N+1,1](1);evalf(subs(x=1.,t=1.,ua));
 

 

1.169488249
1.183156389 (31)
 

> evalf(U[N+1,2](1));evalf(subs(x=1.,t=1.,va));
 

 

1.961089198
2. (32)
 

> U[N+1,1](2);evalf(subs(x=1.,t=2.,ua));
 

 

1.341573468
1.366312778 (33)
 

> evalf(U[N+1,2](2));evalf(subs(x=1.,t=2.,va));
 

 

2.920892289
3. (34)
 

We obtain reasonable results even with N=2 node points. 

> tf:=1.;
 

1. (35)
 

> M:=30;
 

30 (36)
 

> T1:=[seq(tf*i/M,i=0..M)];
 

[0., 0.3333333333e-1, 0.6666666667e-1, .1000000000, .1333333333, .1666666667, .2000000000, .2333333333, .2666666667, .3000000000, .3333333333, .3666666667, .4000000000, .4333333333, .4666666667, .5000...
[0., 0.3333333333e-1, 0.6666666667e-1, .1000000000, .1333333333, .1666666667, .2000000000, .2333333333, .2666666667, .3000000000, .3333333333, .3666666667, .4000000000, .4333333333, .4666666667, .5000...
[0., 0.3333333333e-1, 0.6666666667e-1, .1000000000, .1333333333, .1666666667, .2000000000, .2333333333, .2666666667, .3000000000, .3333333333, .3666666667, .4000000000, .4333333333, .4666666667, .5000...
[0., 0.3333333333e-1, 0.6666666667e-1, .1000000000, .1333333333, .1666666667, .2000000000, .2333333333, .2666666667, .3000000000, .3333333333, .3666666667, .4000000000, .4333333333, .4666666667, .5000...
[0., 0.3333333333e-1, 0.6666666667e-1, .1000000000, .1333333333, .1666666667, .2000000000, .2333333333, .2666666667, .3000000000, .3333333333, .3666666667, .4000000000, .4333333333, .4666666667, .5000...
(37)
 

> PP:=matrix(N+2,M+1);
 

array( 1 .. 4, 1 .. 31, [ ] ) (38)
 

> for i from 1 to N+2 do PP[i,1]:=evalf(subs(x=(i-1)*h,rhs(IC[1])));od:
 

> for i from 1 to N+2 do for j from 2 to M+1 do PP[i,j]:=evalf(subs(t=T1[j],U[i-1,1](t)));od;od:
 

> plotdata := [seq([ seq([(i-1)*h,T1[j],PP[i,j]], i=1..N+2)], j=1..M+1)]:
 

> surfdata(plotdata,axes=boxed,title="Figure Exp. 5.2.11.",labels=[x,t,"u"],orientation=[-45,60]);
 

Plot
 

> plot3d(ua,x=0..1,t=0..1,axes=boxed,title="Figure Exp. 5.2.12.",labels=[x,t,"ua"],orientation=[-45,60]);
 

Plot
 

> PP:=matrix(N+2,M+1);
 

array( 1 .. 4, 1 .. 31, [ ] ) (39)
 

> for i from 1 to N+2 do PP[i,1]:=evalf(subs(x=(i-1)*h,rhs(IC[2])));od:
 

> for i from 1 to N+2 do for j from 2 to M+1 do PP[i,j]:=evalf(subs(t=T1[j],U[i-1,2](t)));od;od:
 

> plotdata := [seq([ seq([(i-1)*h,T1[j],PP[i,j]], i=1..N+2)], j=1..M+1)]:
 

> surfdata(plotdata,axes=boxed,title="Figure Exp. 5.2.13.",labels=[x,t,"v"],orientation=[-45,60]);
 

Plot
 

> plot3d(va,x=0..1,t=0..1,labels=[x,t,"va"],axes=boxed,title="Figure Exp. 5.2.14.",orientation=[-45,60]);
 

Plot
 

>
 

The results obtained with N = 10 are: