Example 8.8.mw
Example 8.8 Diffusion with Reaction
Equation (8.1.18) is solved in Maple below:
| > |
 |
| > |
eq:=diff(u(x,t),t)=diff(u(x,t),x$2)-Phi^2*u(x,t); |
 |
(1) |
 |
(2) |
 |
(3) |
 |
(4) |
| > |
eqs:=subs(laplace(u(x,t),t,s)=U(x),eqs); |
 |
(5) |
| > |
bc1:=subs(laplace(u(x,t),t,s)=U(x),bc1); |
 |
(6) |
| > |
bc2:=subs(laplace(u(x,t),t,s)=U(x),bc2); |
 |
(7) |
 |
(8) |
| > |
U(x):=c[1]*cosh((s+Phi^2)^(1/2)*x)+c[2]*sinh((s+Phi^2)^(1/2)*x); |
![`+`(`*`(c[1], `*`(cosh(`*`(`^`(`+`(s, `*`(`^`(Phi, 2))), `/`(1, 2)), `*`(x))))), `*`(c[2], `*`(sinh(`*`(`^`(`+`(s, `*`(`^`(Phi, 2))), `/`(1, 2)), `*`(x))))))](images/Example 8.8_10.gif) |
(9) |
| > |
eq0:=eval(subs(x=0,bc1)): |
| > |
eq1:=eval(subs(x=1,bc2)): |
| > |
con:=solve({eq0,eq1},{c[1],c[2]}): |
 |
(10) |
| > |
U(x):=combine(simplify(U(x))): |
The shifting theorem is used to find the inverse Laplace transform(1) as: L-1F(s)=exp(-Φ2t)L=1F(s-Φ2).
 |
(11) |
| > |
U1(x):=subs(s=s-Phi^2,U(x)); |
 |
(12) |
 |
(13) |
 |
(14) |
| > |
A(s):=P(s)/diff(Q(s),s); |
 |
(15) |
 |
(16) |
| > |
_EnvAllSolutions := true: |
The roots are:
| > |
Phi^2,-((2*n-1)*Pi/2)^2; |
 |
(17) |
| > |
A[n]:=simplify(subs(s=mu,A(s))); |
 |
(18) |
| > |
A[0]:=subs(mu^(1/2)=Phi,mu=Phi^2,A[n]): |
 |
(19) |
| > |
A[n]:=simplify(subs(mu^(1/2)=I*(2*n-1)/2*Pi,mu=-((2*n-1)*Pi/2)^2,A[n])): |
| > |
vars:={cos(1/2*(2*n-1)*Pi)=0,sin(1/2*(2*n-1)*Pi)=(-1)^(n-1)}: |
| > |
A[n]:=simplify(subs(vars,A[n])); |
 |
(20) |
| > |
u0s:=A[0]*subs(mu=Phi^2,1/(s-mu)); |
 |
(21) |
| > |
u0t:=invlaplace(u0s,s,t); |
 |
(22) |
 |
(23) |
| > |
unt:=invlaplace(uns,s,t); |
 |
(24) |
| > |
unt:=subs(mu=-((2*n-1)/2*Pi)^2,unt); |
 |
(25) |
The time domain solution is obtained by multiplying the inverse Laplace transform of U1(x) by exp(-Φ2t):
| > |
U:=simplify(u0t*exp(-Phi^2*t))+Sum(unt,n=1..infinity)*exp(-Phi^2*t); |
 |
(26) |
| > |
u:=piecewise(t=0,0,t>0,subs(infinity=20,U)): |
The following plots are obtained:
| > |
plot3d(subs(Phi=1,u),x=1..0,t=0.5..0,axes=boxed,title="Figure Exp. 8.15.",labels=[x,t,"u"],orientation=[-45,60]); |
The solution obtained matches the separation of variables solution obtained in example 7.8.