Example 8.5.mw

Example 8.5 

Equation (8.1.5) is solved in Maple below: 

> restart:with(inttrans):with(plots):
 

The governing equation and boundary conditions are entered and converted to the Laplace domain. 

> eq:=diff(u(x,t),t)=diff(u(x,t),x$2);
 

diff(u(x, t), t) = diff(diff(u(x, t), x), x) (1)
 

> u(x,0):=1;
 

1 (2)
 

> bc1:=u(x,t)=0;
 

u(x, t) = 0 (3)
 

> bc2:=u(x,t)=0;
 

u(x, t) = 0 (4)
 

> eqs:=laplace(eq,t,s):
 

> eqs:=subs(laplace(u(x,t),t,s)=U(x),eqs);
 

`+`(`*`(s, `*`(U(x))), `-`(1)) = diff(diff(U(x), x), x) (5)
 

> bc1:=laplace(bc1,t,s):
 

> bc1:=subs(diff(laplace(u(x,t),t,s),x)=D(U)(0),laplace(u(x,t),t,s)=U(0),bc1);
 

U(0) = 0 (6)
 

> bc2:=laplace(bc2,t,s):
 

> bc2:=subs(diff(laplace(u(x,t),t,s),x)=D(U)(1),laplace(u(x,t),t,s)=U(1),bc2);
 

U(1) = 0 (7)
 

The solution obtained in the Laplace domain is: 

> U(x):=rhs(dsolve({eqs,bc1,bc2},U(x)));
 

`+`(`-`(`/`(`*`(exp(`*`(`^`(s, `/`(1, 2)), `*`(x))), `*`(`+`(`-`(1), exp(`+`(`-`(`*`(`^`(s, `/`(1, 2))))))))), `*`(s, `*`(`+`(`-`(exp(`*`(`^`(s, `/`(1, 2))))), exp(`+`(`-`(`*`(`^`(s, `/`(1, 2)))))))))... (8)
 

Maple fails to invert the solution obtained: 

> invlaplace(U(x),s,t);
 

`+`(`-`(`*`(`/`(1, 2), `*`(invlaplace(`/`(`*`(exp(`*`(`^`(s, `/`(1, 2)), `*`(x)))), `*`(s, `*`(sinh(`*`(`^`(s, `/`(1, 2))))))), s, t)))), `-`(invlaplace(`/`(`*`(exp(`+`(`*`(`^`(s, `/`(1, 2)), `*`(x)),...
`+`(`-`(`*`(`/`(1, 2), `*`(invlaplace(`/`(`*`(exp(`*`(`^`(s, `/`(1, 2)), `*`(x)))), `*`(s, `*`(sinh(`*`(`^`(s, `/`(1, 2))))))), s, t)))), `-`(invlaplace(`/`(`*`(exp(`+`(`*`(`^`(s, `/`(1, 2)), `*`(x)),...
(9)
 

The first two terms of U(x) are expressed as an infinite series below: 

> U1s:=-exp(s^(1/2)*x)/s/(exp(s^(1/2))+1);
 

`+`(`-`(`/`(`*`(exp(`*`(`^`(s, `/`(1, 2)), `*`(x)))), `*`(s, `*`(`+`(exp(`*`(`^`(s, `/`(1, 2)))), 1)))))) (10)
 

> U2s:=-exp(-s^(1/2)*x)*exp(s^(1/2))/s/(exp(s^(1/2))+1);
 

`+`(`-`(`/`(`*`(exp(`+`(`-`(`*`(`^`(s, `/`(1, 2)), `*`(x))))), `*`(exp(`*`(`^`(s, `/`(1, 2)))))), `*`(s, `*`(`+`(exp(`*`(`^`(s, `/`(1, 2)))), 1)))))) (11)
 

We want to write a series in terms of S=exp(-s^(1/2)) so that the series will converge: 

> U1S:=series(subs(exp(s^(1/2))=1/S,U1s),S);
 

series(`+`(`-`(`*`(`/`(`*`(exp(`*`(`^`(s, `/`(1, 2)), `*`(x)))), `*`(s)), `*`(S))), `*`(`/`(`*`(exp(`*`(`^`(s, `/`(1, 2)), `*`(x)))), `*`(s)), `*`(`^`(S, 2))), `-`(`*`(`/`(`*`(exp(`*`(`^`(s, `/`(1, 2)... (12)
 

> U1S:=subs(S=exp(-s^(1/2)),U1S);
 

`+`(`-`(`/`(`*`(exp(`*`(`^`(s, `/`(1, 2)), `*`(x))), `*`(exp(`+`(`-`(`*`(`^`(s, `/`(1, 2)))))))), `*`(s))), `/`(`*`(exp(`*`(`^`(s, `/`(1, 2)), `*`(x))), `*`(`^`(exp(`+`(`-`(`*`(`^`(s, `/`(1, 2)))))), ... (13)
 

> simplify(U1S);
 

`/`(`*`(`+`(`-`(exp(`*`(`^`(s, `/`(1, 2)), `*`(`+`(x, `-`(1)))))), exp(`*`(`^`(s, `/`(1, 2)), `*`(`+`(x, `-`(2))))), `-`(exp(`*`(`^`(s, `/`(1, 2)), `*`(`+`(x, `-`(3)))))), exp(`*`(`^`(s, `/`(1, 2)), `... (14)
 

Hence, U1S can be written as the infinite series: 

> U1S:=Sum((-1)^n*exp(s^(1/2)*(x-n))/s,n=1..infinity);
 

Sum(`/`(`*`(`^`(-1, n), `*`(exp(`*`(`^`(s, `/`(1, 2)), `*`(`+`(x, `-`(n))))))), `*`(s)), n = 1 .. infinity) (15)
 

The general term in the above series is: 

> u1s:=(-1)^n*exp(s^(1/2)*(x-n))/s;
 

`/`(`*`(`^`(-1, n), `*`(exp(`*`(`^`(s, `/`(1, 2)), `*`(`+`(x, `-`(n))))))), `*`(s)) (16)
 

The time domain solution for this expression is: 

> u1t:=invlaplace(u1s,s,t);
 

`*`(`^`(-1, n), `*`(invlaplace(`/`(`*`(exp(`*`(`^`(s, `/`(1, 2)), `*`(`+`(x, `-`(n)))))), `*`(s)), s, t))) (17)
 

Hence, the inverse of U1S is the infinite series given by: 

> U1t:=Sum(u1t,n=1..infinity);
 

Sum(`*`(`^`(-1, n), `*`(invlaplace(`/`(`*`(exp(`*`(`^`(s, `/`(1, 2)), `*`(`+`(x, `-`(n)))))), `*`(s)), s, t))), n = 1 .. infinity) (18)
 

Similarly, U2S is inverted below: 

> U2S:=series(subs(exp(s^(1/2))=1/S,U2s),S);
 

series(`+`(`-`(`/`(`*`(exp(`+`(`-`(`*`(`^`(s, `/`(1, 2)), `*`(x)))))), `*`(s))), `*`(`/`(`*`(exp(`+`(`-`(`*`(`^`(s, `/`(1, 2)), `*`(x)))))), `*`(s)), `*`(S)), `-`(`*`(`/`(`*`(exp(`+`(`-`(`*`(`^`(s, `/... (19)
 

> U2S:=subs(S=exp(-s^(1/2)),U2S);
 

`+`(`-`(`/`(`*`(exp(`+`(`-`(`*`(`^`(s, `/`(1, 2)), `*`(x)))))), `*`(s))), `/`(`*`(exp(`+`(`-`(`*`(`^`(s, `/`(1, 2)), `*`(x))))), `*`(exp(`+`(`-`(`*`(`^`(s, `/`(1, 2)))))))), `*`(s)), `-`(`/`(`*`(exp(`...
`+`(`-`(`/`(`*`(exp(`+`(`-`(`*`(`^`(s, `/`(1, 2)), `*`(x)))))), `*`(s))), `/`(`*`(exp(`+`(`-`(`*`(`^`(s, `/`(1, 2)), `*`(x))))), `*`(exp(`+`(`-`(`*`(`^`(s, `/`(1, 2)))))))), `*`(s)), `-`(`/`(`*`(exp(`...
(20)
 

> simplify(U2S);
 

`/`(`*`(`+`(`-`(exp(`+`(`-`(`*`(`^`(s, `/`(1, 2)), `*`(x)))))), exp(`+`(`-`(`*`(`^`(s, `/`(1, 2)), `*`(`+`(x, 1)))))), `-`(exp(`+`(`-`(`*`(`^`(s, `/`(1, 2)), `*`(`+`(x, 2))))))), exp(`+`(`-`(`*`(`^`(s... (21)
 

> U2S:=Sum((-1)^n*exp(-s^(1/2)*(x+n-1))/s,n=1..infinity);
 

Sum(`/`(`*`(`^`(-1, n), `*`(exp(`+`(`-`(`*`(`^`(s, `/`(1, 2)), `*`(`+`(x, n, `-`(1))))))))), `*`(s)), n = 1 .. infinity) (22)
 

> u2s:=(-1)^n*exp(-s^(1/2)*(x+n-1))/s;
 

`/`(`*`(`^`(-1, n), `*`(exp(`+`(`-`(`*`(`^`(s, `/`(1, 2)), `*`(`+`(x, n, `-`(1))))))))), `*`(s)) (23)
 

> u2t:=invlaplace(u2s,s,t);
 

`*`(`^`(-1, n), `*`(invlaplace(`/`(`*`(exp(`*`(`+`(`-`(x), `-`(n), 1), `*`(`^`(s, `/`(1, 2)))))), `*`(s)), s, t))) (24)
 

> U2t:=Sum(u2t,n=1..infinity);
 

Sum(`*`(`^`(-1, n), `*`(invlaplace(`/`(`*`(exp(`*`(`+`(`-`(x), `-`(n), 1), `*`(`^`(s, `/`(1, 2)))))), `*`(s)), s, t))), n = 1 .. infinity) (25)
 

The final solution for u in the time domain is: 

> Ut:=U1t+U2t+1;
 

`+`(Sum(`*`(`^`(-1, n), `*`(invlaplace(`/`(`*`(exp(`*`(`^`(s, `/`(1, 2)), `*`(`+`(x, `-`(n)))))), `*`(s)), s, t))), n = 1 .. infinity), Sum(`*`(`^`(-1, n), `*`(invlaplace(`/`(`*`(exp(`*`(`+`(`-`(x), `... (26)
 

For plotting purposes, infinity is replaced by N = 20: 

> u:=subs(infinity=N,Ut);
 

`+`(Sum(`*`(`^`(-1, n), `*`(invlaplace(`/`(`*`(exp(`*`(`^`(s, `/`(1, 2)), `*`(`+`(x, `-`(n)))))), `*`(s)), s, t))), n = 1 .. N), Sum(`*`(`^`(-1, n), `*`(invlaplace(`/`(`*`(exp(`*`(`+`(`-`(x), `-`(n), ... (27)
 

> u:=subs(N=20,u);
 

`+`(Sum(`*`(`^`(-1, n), `*`(invlaplace(`/`(`*`(exp(`*`(`^`(s, `/`(1, 2)), `*`(`+`(x, `-`(n)))))), `*`(s)), s, t))), n = 1 .. 20), Sum(`*`(`^`(-1, n), `*`(invlaplace(`/`(`*`(exp(`*`(`+`(`-`(x), `-`(n),... (28)
 

The following plots can be obtained: 

> plot3d(u,x=0..1,t=1e-6..0.1,axes=boxed,title="Figure 8.9.",labels=[x,t,"u"],orientation=[60,60]);
 

Plot
 

> plot([subs(t=1e-6,u),subs(t=1e-3,u),subs(t=0.01,u),subs(t=0.05,u)],x=0..1,axes=boxed,title="Figure 8.10.",thickness=5,labels=[x,"u"]);
 

Plot_2d
 

Note that for plotting purposes t = 0 is replaced by t = `^`(10, -6)to avoid singularity at t = 0. 

>