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.

264 CHAPTER 6. LINEAR PDE MODELS. PART 2<br />

T (x; 0) = A±(x ¡ a), i.e., is a Dirac delta function 2 of amplitude A located at<br />

x = a>0. The end x = 0 is perfectly insulated so that no heat can °ow across<br />

this end. For no heat °ow to occur, the boundary condition is @T=@xjx=0 =0,<br />

i.e., the gradient of the temperature is zero. The evolution of the temperature<br />

pro¯le is to be animated over the spatial range x = 0 to 20 for the time interval<br />

t = 1 to 200, with a =5,A = 5, and a heat di®usion constant d =1.<br />

In her mathematical physics course, Vectoria has learned that when a gradient<br />

boundary condition is involved for a semi-in¯nite domain problem the<br />

Fourier cosine transform should be used. The Fourier cosine transform F (s) of<br />

a function f(x) forwhichbothf(x) andf 0 (x) ! 0asx !1and its inverse<br />

transform are<br />

r<br />

de¯ned as<br />

Z 1<br />

2<br />

F (s) = f(x) cos(sx) dx; f(x) =<br />

¼<br />

0<br />

r 2<br />

¼<br />

Z 1<br />

F (s) cos(sx) ds:<br />

Guided by her easy conquest of the previous problem, Vectoria realizes that she<br />

will be done by the time Mike arrives to pick her up.<br />

She again loads the plots and integral transform library packages, and enters<br />

the 1-dimensional heat di®usion equation.<br />

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

> DE:=diff(T(x,t),t)=d*diff(T(x,t),x,x);<br />

DE := @ μ<br />

T (x; t) =d @<br />

@t 2<br />

<br />

2 T (x; t)<br />

@x<br />

The boundary condition bc and the initial condition ic are speci¯ed. The differential<br />

command D[1](T)(0,t) is used to enter @T(x; t)=@xjx=0, while the<br />

Dirac delta function is entered with the Dirac command.<br />

> bc:=D[1](T)(0,t)=0; ic:=A*Dirac(x-a);<br />

bc := D1(T )(0; t)=0 ic := A Dirac(¡x + a)<br />

The Fourier cosine transforms of the initial condition (assuming that a>0) and<br />

the di®usion equation are calculated. The boundary condition is substituted<br />

into the latter result.<br />

> F0:=fouriercos(ic,x,s) assuming a>0;<br />

F0 := A p 2cos(sa)<br />

p<br />

¼<br />

> FCT:=subs(bc,fouriercos(DE,x,s));<br />

FCT := @<br />

@t fouriercos(T (x; t); x;s)=¡ds2 fouriercos(T (x; t); x;s)<br />

As in the previous recipe, fouriercos(T (x; t); x;s) is replaced with F (t)inFCT .<br />

> FCT:=subs(fouriercos(T(x,t),x,s)=F(t),FCT);<br />

FCT := d<br />

dt F (t) =¡ds2 F (t)<br />

2 The Dirac delta function ±(x ¡ a) is an in¯nitely tall spike located at x = a and is equal<br />

to zero for x 6= a. One of its most important properties is the sifting property, viz., for a<br />

smooth function f(x) (not another delta function) and ²>0, R a+²<br />

f(x) ±(x ¡ a) dx = f(a):<br />

a¡²<br />

0

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

Saved successfully!

Ooh no, something went wrong!