16.12.2012 Views

Computer Algebra Recipes

Computer Algebra Recipes

Computer Algebra Recipes

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

6.2. SEMI-INFINITE AND INFINITE DOMAINS 267<br />

where K is a positive constant with units in kg/(m 2 ¢ s). The coe±cients can be<br />

eliminated and the two equations cast into dimensionless form by introducing<br />

the new variables t ´ ¸T, x ´ p ¸=d X, and c = ( p ¸d=K) C. Then the<br />

concentration equation becomes<br />

@c(x; t)<br />

@t<br />

= @2c(x; t)<br />

¡ c(x; t); (6.10)<br />

@x2 with @c=@x = ¡1 as the boundary condition at x =0.<br />

Assuming that initially c =0forx¸ 0, we want to determine the distribution<br />

of radioactive gas in the atmosphere for times t ¸ 0 and animate the<br />

solution. The method of attack will be to make use of the Laplace transform.<br />

The Laplace transform of a function f(t) isde¯nedas<br />

Z 1<br />

L(f(t)) ´ F (s) = f(t) e ¡st dt: (6.11)<br />

Integrating by parts and assuming that e ¡stf(t)!0 ast!1,then<br />

μ <br />

μ 2 df<br />

d f<br />

L = sF(s) ¡ f(0); and L<br />

dt<br />

dt2 <br />

= s 2 df (0)<br />

F (s) ¡ sf(0) ¡ : (6.12)<br />

dt<br />

To solve the concentration equation (6.10), subject to the boundary and<br />

initial conditions, the Laplace transform can be applied to the time part of the<br />

equation, the resultant second-order ODE in x solved, and the inverse Laplace<br />

transform performed to regain the time dependence.<br />

This program is now carried out using the laplace command contained in<br />

the integral transform library package.<br />

> restart: with(plots): with(inttrans):<br />

The dimensionless concentration equation is entered,<br />

> CE:=diff(c(x,t),t)=diff(c(x,t),x,x)-c(x,t);<br />

CE := @ μ 2 <br />

@<br />

c(x; t) = c(x; t) ¡ c(x; t)<br />

@t @x2 and the initial concentration speci¯ed.<br />

> c(x,0):=0:<br />

The Laplace transform of CE is taken with respect to the time variable, and<br />

the function laplace(c(x; t); t;s) then replaced with f (x) inLT .<br />

> LT:=laplace(CE,t,s);<br />

> LT:=subs(laplace(c(x,t),t,s)=f(x),LT);<br />

μ 2 d<br />

LT := s f(x) = f (x) ¡ f (x)<br />

dx2 This second-order ODE is solved for f(x), the following DEtools command line<br />

being used to obtain exponential solutions, which are convenient here.<br />

> sol:=DEtools[expsols](LT,f(x));<br />

sol := [e (p s+1 x) ;e (¡ p s+1 x) ]<br />

0

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!