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.

228 CHAPTER 5. LINEAR PDE MODELS. PART 1<br />

The answer will require that the two-dimensional form of Laplace's equation,<br />

@ 2 T (x; y)<br />

@x 2<br />

+ @2 T (x; y)<br />

@y 2 =0; (5.9)<br />

be solved, subject to the four boundary conditions. After loading the plots<br />

package, we enter Laplace's equation (LE).<br />

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

> LE:=diff(T(x,y),x,x)+diff(T(x,y),y,y)=0;<br />

μ μ <br />

2<br />

2<br />

@ @<br />

LE := T (x; y) + T (x; y) =0<br />

@x2 @y2 Using the pdsolve commandwiththeHINT=f(x)*g(y),INTEGRATE, andbuild<br />

options, we generate the general product solution of Laplace's equation.<br />

> sol:=pdsolve(LE,HINT=f(x)*g(y),INTEGRATE,build);<br />

sol := T (x; y) = C3 sin( p c1 y) C1 e (p c1 x) + C3 sin( p c1 y) C2<br />

e (p c1 x)<br />

+ C4 cos( p c1 y) C1 e (p c1 x) + C4 cos( p c1 y) C2<br />

e (p c1 x)<br />

The solution involves one separation constant c1 and four unknown coe±cients.<br />

For notational convenience, we substitute p c1 = m in the rhs of sol.<br />

> T:=subs(sqrt(_c[1])=m,rhs(sol));<br />

T := C3 sin(my) C1 e (mx) +<br />

+ C4 cos(my) C2<br />

e (mx)<br />

C3 sin(my) C2<br />

e (mx)<br />

+ C4 cos(my) C1 e (mx)<br />

The coe±cients are determined from the four boundary conditions. To satisfy<br />

T (x; 0) = 0, the cos(my) terms are removed since they don't vanish at y =0.<br />

> T:=remove(has,T,cos(m*y)); #bc1<br />

T := C3 sin(my) C1 e (mx) C3 sin(my) C2<br />

+<br />

e (mx)<br />

Then T is converted completely to trigonometric form.<br />

> T:=expand(convert(T,trig));<br />

T := C3 sin(my) C1 cosh(mx)+ C3 sin(my) C1 sinh(mx)<br />

C3 sin(my) C2<br />

+<br />

cosh(mx) + sinh(mx)<br />

The second boundary condition is that T (0;y) = 0. Since cosh(mx)doesn't<br />

vanish at x = 0, terms involving cosh(mx) are removed from T .<br />

> T:=remove(has,T,cosh(m*x)); #bc2<br />

T := C3 sin(my) C1 sinh(mx)<br />

The third boundary condition, T (x; h) = 0, requires that sin(mh)=0,sothat<br />

m = n¼=hwith n a positive integer. This relation is substituted into T ,and

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

Saved successfully!

Ooh no, something went wrong!