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.

198 CHAPTER 4. NONLINEAR ODE MODELS<br />

determined, the curve that minimizes the time of descent will be known.<br />

At the starting point x = 0, we shall choose to set the parameter μ equal<br />

to zero. Some care must be taken in evaluating the arctan term at μ =0. The<br />

limit must be taken from the positive side (i.e., from the \right") of μ =0.<br />

> eq:=limit(x,theta=0,right)=0;<br />

eq := B ¡ A¼<br />

4 =0<br />

The resulting eq is easily solved for the constant B.<br />

> sol2:=B=solve(eq,B);<br />

sol2 := B = A¼<br />

4<br />

The solution sol2 is assigned and x displayed.<br />

> assign(sol2); x:=x;<br />

x := ¡ 1<br />

μ <br />

1<br />

cos(2 μ)<br />

A sin(2 μ) ¡ A arctan<br />

+<br />

2 2 sin(2 μ)<br />

A¼<br />

4<br />

We still have to determine the constant A and the range of μ. Now it gets a bit<br />

tricky. Wehavenoideayetwhatthecoordinates(x1 ; y1 ) of the endpoint on<br />

the museum roof should be.<br />

Hand me that copy of Mathematical Methods in Physics [MW71]. Ah, here<br />

we go. The case in which one endpoint of the sought-after curve is ¯xed and<br />

the other endpoint is allowed to vary along a line g(x; y) = 0 is considered.<br />

It is shown that if the Euler{Lagrange function F is of the structure8 F =<br />

f(x; y) p 1+(y0 ) 2 ; which it is in our case, then the condition for determining<br />

the unknown endpoint is that the slope of y(x) must satisfy the condition y 0 =<br />

(@g=@y)=(@g=@x) atthatpoint. Butthisisjustamathematicalstatement<br />

that the curve y(x) of quickest descent must intersect the destination curve<br />

g(x; y) = 0 at right angles. Here the equation for the slanting museum roof is<br />

the straight line g(x; y) =y + x ¡ 200 = 0: But both @g=@y and @g=@x are<br />

equal to 1, so we have y 0 = 1 at the museum roof. Since the parameter μ has<br />

been introduced, the slope of y(x) mustbecalculatedintermsofμ.<br />

> slope:=simplify(diff(rhs(Y),theta)/diff(x,theta));<br />

slope := cos(μ)<br />

sin(μ)<br />

Setting the slope to 1, the value £ that the parameter μ must have at the<br />

museum roof is determined, assuming that μ is positive.<br />

> Theta:=solve(slope=1,theta) assuming theta>0;<br />

£:= ¼<br />

4<br />

8If F is not of this structure, the endpoint condition is more complicated, taking the form<br />

³<br />

0 @F<br />

F ¡ y<br />

@y 0<br />

´<br />

@g @F<br />

¡<br />

@y @y 0<br />

@g<br />

@x =0:

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

Saved successfully!

Ooh no, something went wrong!