656 Chapter 10
General solution for U(x, s)
> assume(x>0):U(x,s):=C1(s)*exp(−sqrt(s/k)*x)+C2(s)*exp(sqrt(s/k)*x);
U(x∼,s):= C1(s) e
−
√
sx∼
+C2(s) e
√
sx∼
(10.40)
Substituting the boundary conditions at x = 0 and as x approaches infinity, for Re{s} > 0,
we get
> C2(s):=0;
C2(s) := 0 (10.41)
> eq:=Q(s)=eval(subs(x=0,U(x,s)));
eq := 1 = C1(s) (10.42)
> C1(s):=solve(eq,C1(s));
C1(s) := 1 (10.43)
Transformed solution
> U(x,s):=eval(U(x,s));
U(x∼,s):= e
−
√
sx∼
(10.44)
Solution is the inverse Laplace of U(x, s)
> u(x,t):=invlaplace(U(x,s),s,t);
u(x∼,t):=
1
2
x∼ e
−
1
4
x∼
2
t
√
πt
3/2
(10.45)
ANIMATION
> animate(u(x,t),x=0..10,t=0..5,thickness=3);
The preceding animation command shows the spatial-time temperature distribution u(x, t) in
the rod. The animation sequence here and in Figure 10.3 shows snapshots of the animation at
times t = 1/2, 1, 2, 3, 4, 5.
ANIMATION SEQUENCE
> u(x,0):=subs(t=1/2,u(x,t)):u(x,1):=subs(t=1,u(x,t)):
> u(x,2):=subs(t=2,u(x,t)):u(x,3):=subs(t=3,u(x,t)):
> u(x,4):=subs(t=4,u(x,t)):u(x,5):=subs(t=5,u(x,t)):
> plot({u(x,0),u(x,1),u(x,2),u(x,3),u(x,4),u(x,5)},x=0..10,thickness=10);