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

| (1)

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

| (2)

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

| (3)

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

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

| (7)

The solution obtained in the Laplace domain is:

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

| (8)

Maple fails to invert the solution obtained:

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

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

| (10)

> | U2s:=-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);

| (12)

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

| (13)

> | simplify(U1S);

| (14)

Hence, U1S can be written as the infinite series:

> | U1S:=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;

| (16)

The time domain solution for this expression is:

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

| (17)

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

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

| (18)

Similarly, U2S is inverted below:

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

| (19)

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

| (20)

> | simplify(U2S);

| (21)

> | U2S:=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;

| (23)

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

| (24)

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

| (25)

The final solution for u in the time domain is:

> | Ut:=U1t+U2t+1;

| (26)

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

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

| (27)

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

| (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([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"]);

Note that for plotting purposes t = 0 is replaced by t = to avoid singularity at t = 0.

> |