Example4.4 rev 1.mw

Example 4.4

In the previous examples, the initial condition was a constant and independent of x. The same technique can be applied for the case where there is an initial temperature profile. Consider the transient heat conduction problem in a slab

=α

u(x,0) =sin(πx)

(0,t) = 0 and u(∞,t) is defined (4.1.4)

Equation (4.1.4) is solved in Maple below. The programs given for the previous examples have to be modified to solve equation (4.1.4) by only changing the initial condition:

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

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

| (1)

> | u(x,0):=sin(Pi*x);

| (2)

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

| (3)

> | bc2:=u(infinity,t)=defined;

| (4)

The following solution and plots are obtained:

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

| (5)

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

| (6)

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

| (7)

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

| (8)

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

| (9)

> | eqc:=coeff(U(x),exp(1/alpha^(1/2)*s^(1/2)*x));

| (10)

> | _C2:=solve(eqc,_C2);

| (11)

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

| (12)

> | u:=invlaplace(U(x),s,t);

| (13)

> | pars:={alpha=0.001};

| (14)

> | plot3d(subs(pars,u),x=10..0,t=100..0,axes=boxed,title="Figure Exp. 4.1.9.",labels=[x,t,"u"],orientation=[-60,60]);

> | plot([subs(pars,t=1,u),subs(pars,t=10,u),subs(pars,t=100,u),subs(pars,t=200,u)],x=0..1,axes=boxed,title="Figure Exp. 4.1.10.",thickness=5,labels=[x,"u"]);

> |