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)

> | u(x,0):=0;

| (2)

> | bc1:=u(x,t)=1;

| (3)

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

| (4)

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

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

| (5)

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

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

| (6)

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

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

| (7)

> | dsolve(eqs,U(x));

| (8)

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

| (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));

| (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).

> | U(x):=factor(U(x));

| (11)

> | U1(x):=subs(s=s-Phi^2,U(x));

| (12)

> | P(s):=numer(U1(x));

| (13)

> | Q(s):=denom(U1(x));

| (14)

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

| (15)

> | solve(Q(s),s);

| (16)

> | _EnvAllSolutions := true:

> | solve(Q(s),s):

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]):

> | A[0]:=simplify(A[0]);

| (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)

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

| (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.