Example 8.2.mw

Example 8.2

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

> |

> | eq:=diff(u(x,t),t)+diff(u(x,t),x);

| (1)

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

| (2)

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

| (3)

The solution obtained in the Laplace domain is:

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

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

| (4)

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

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

| (5)

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

| (6)

The solution obtained in the time domain is obtained as:

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

| (7)

> | plot3d(u,x=1e-6..1,t=0..1,axes=boxed,title="Figure Exp. 8.3.",labels=[x,t,"u"],orientation=[120,60]);

> | plot([subs(t=0.1,u),subs(t=0.25,u),subs(t=0.5,u),subs(t=1,u)],x=0..1,axes=boxed,title="Figure Exp. 8.4.",thickness=5,labels=[x,"u"]);

> |