Example 8.10.mw

Example 8.10 Heat Transfer in a Rectangle 

Equation (8.1.26) is solved in Maple below: 

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

>
 

> 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(laplace(u(x,t),t,s)=U(x),bc1);
 

U(x) = 0 (6)
 

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

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

U(x) = 0 (7)
 

> dsolve(eqs,U(x));
 

U(x) = `+`(`*`(exp(`*`(`^`(s, `/`(1, 2)), `*`(x))), `*`(_C2)), `*`(exp(`+`(`-`(`*`(`^`(s, `/`(1, 2)), `*`(x))))), `*`(_C1)), `/`(1, `*`(s))) (8)
 

> U(x):=c[1]*cosh(s^(1/2)*x)+c[2]*sinh(s^(1/2)*x)+1/s;
 

`+`(`*`(c[1], `*`(cosh(`*`(`^`(s, `/`(1, 2)), `*`(x))))), `*`(c[2], `*`(sinh(`*`(`^`(s, `/`(1, 2)), `*`(x))))), `/`(1, `*`(s))) (9)
 

> eq0:=eval(subs(x=0,bc1)):
 

> eq1:=eval(subs(x=1,bc2)):
 

> con:=solve({eq0,eq1},{c[1],c[2]}):
 

> U(x):=subs(con,U(x));
 

`+`(`-`(`/`(`*`(cosh(`*`(`^`(s, `/`(1, 2)), `*`(x)))), `*`(s))), `/`(`*`(`+`(cosh(`*`(`^`(s, `/`(1, 2)))), `-`(1)), `*`(sinh(`*`(`^`(s, `/`(1, 2)), `*`(x))))), `*`(sinh(`*`(`^`(s, `/`(1, 2)))), `*`(s)... (10)
 

> U(x):=factor(combine(simplify(U(x))));
 

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

> P(s):=numer(U(x));
 

`+`(sinh(`*`(`^`(s, `/`(1, 2)), `*`(`+`(x, `-`(1))))), `-`(sinh(`*`(`^`(s, `/`(1, 2)), `*`(x)))), sinh(`*`(`^`(s, `/`(1, 2))))) (12)
 

> Q(s):=denom(U(x));
 

`*`(sinh(`*`(`^`(s, `/`(1, 2)))), `*`(s)) (13)
 

> solve(Q(s),s);
 

0 (14)
 

> _EnvAllSolutions := true;
 

true (15)
 

> solve(Q(s),s);
 

`+`(`-`(`*`(`^`(Pi, 2), `*`(`^`(_Z1, 2))))), 0 (16)
 

s = 0 is repeated twice (one root coming from 2 and the other coming from the sine term in q(s)).  The roots are (where n goes from 1 to infinity): 

> 0,0,-n^2*Pi^2;
 

0, 0, `+`(`-`(`*`(`^`(n, 2), `*`(`^`(Pi, 2))))) (17)
 

> mu0:=0;
 

0 (18)
 

The coefficients B2 and B1 are found as (equation (8.1.22) and (8.1.24)): 

> b[2]:=(s-mu0)^2*P(s)/Q(s);
 

`/`(`*`(s, `*`(`+`(sinh(`*`(`^`(s, `/`(1, 2)), `*`(`+`(x, `-`(1))))), `-`(sinh(`*`(`^`(s, `/`(1, 2)), `*`(x)))), sinh(`*`(`^`(s, `/`(1, 2))))))), `*`(sinh(`*`(`^`(s, `/`(1, 2)))))) (19)
 

> B[2]:=limit(b[2],s=0);
 

0 (20)
 

> b[1]:=diff(b[2],s):
 

> B[1]:=limit(b[1],s=0);
 

0 (21)
 

For this problem the contribution from the repeated root s = 0 is zero.  This is not always true as shown in the next example. 

> A(s):=P(s)/diff(Q(s),s):
 

> A[n]:=simplify(subs(s=mu,A(s)));
 

`+`(`/`(`*`(2, `*`(`+`(sinh(`*`(`^`(mu, `/`(1, 2)), `*`(`+`(x, `-`(1))))), `-`(sinh(`*`(`^`(mu, `/`(1, 2)), `*`(x)))), sinh(`*`(`^`(mu, `/`(1, 2))))))), `*`(`+`(`*`(cosh(`*`(`^`(mu, `/`(1, 2)))), `*`(... (22)
 

> A[n]:=simplify(subs(mu^(1/2)=I*n*Pi,mu=-n^2*Pi^2,A[n])):
 

> vars:={cos(n*Pi)=(-1)^n,sin(n*Pi)=0};
 

{cos(`*`(n, `*`(Pi))) = `^`(-1, n), sin(`*`(n, `*`(Pi))) = 0} (23)
 

> A[n]:=simplify(subs(vars,A[n])):
 

> A[n]:=simplify(subs(vars,expand(A[n])));
 

`+`(`-`(`/`(`*`(2, `*`(sin(`*`(n, `*`(Pi, `*`(x)))), `*`(`+`(`-`(1), `^`(-1, `+`(`-`(n))))))), `*`(n, `*`(Pi))))) (24)
 

> b1s:=B[1]*subs(mu0=0,1/(s-mu0));
 

0 (25)
 

> b1t:=invlaplace(b1s,s,t);
 

0 (26)
 

> b2s:=B[2]*subs(mu0=0,1/(s-mu0)^2);
 

0 (27)
 

> b2t:=invlaplace(b2s,s,t);
 

0 (28)
 

> uns:=A[n]/(s-mu);
 

`+`(`-`(`/`(`*`(2, `*`(sin(`*`(n, `*`(Pi, `*`(x)))), `*`(`+`(`-`(1), `^`(-1, `+`(`-`(n))))))), `*`(n, `*`(Pi, `*`(`+`(s, `-`(mu)))))))) (29)
 

> unt:=invlaplace(uns,s,t);
 

`+`(`/`(`*`(2, `*`(sin(`*`(n, `*`(Pi, `*`(x)))), `*`(exp(`*`(mu, `*`(t))), `*`(`+`(1, `^`(-1, `+`(1, `-`(n)))))))), `*`(n, `*`(Pi)))) (30)
 

> unt:=subs(mu=-n^2*Pi^2,unt);
 

`+`(`/`(`*`(2, `*`(sin(`*`(n, `*`(Pi, `*`(x)))), `*`(exp(`+`(`-`(`*`(`^`(n, 2), `*`(`^`(Pi, 2), `*`(t)))))), `*`(`+`(1, `^`(-1, `+`(1, `-`(n)))))))), `*`(n, `*`(Pi)))) (31)
 

The solution is obtained and plotted as: 

> U:=b1t+b2t+Sum(unt,n=1..infinity);
 

Sum(`+`(`/`(`*`(2, `*`(sin(`*`(n, `*`(Pi, `*`(x)))), `*`(exp(`+`(`-`(`*`(`^`(n, 2), `*`(`^`(Pi, 2), `*`(t)))))), `*`(`+`(1, `^`(-1, `+`(1, `-`(n)))))))), `*`(n, `*`(Pi)))), n = 1 .. infinity) (32)
 

> u:=piecewise(t=0,1,t>0,subs(infinity=20,U)):
 

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

Plot
 

> plot([subs(t=0,u),subs(t=0.01,u),subs(t=0.05,u),subs(t=0.1,u)],x=0..1,axes=boxed,title="Figure Exp. 8.19.",thickness=5,labels=[x,"u"]);
 

Plot_2d
 

>