16.12.2012 Views

Computer Algebra Recipes

Computer Algebra Recipes

Computer Algebra Recipes

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

118 CHAPTER 3. LINEAR ODE MODELS<br />

3.2 Second-Order Models<br />

3.2.1 Daniel Encounters Resistance<br />

Belief like any other moving body follows the path of least resistance.<br />

Samuel Butler, English writer (1835{1902)<br />

In the introductory recipe, recall that Richard's grandson Daniel threw a small<br />

ball with an initial speed of 15 m/s toward a 3:5-meter-high fence located 20<br />

meters from the ball's initial position. The ball left his hand at a height of 2<br />

m above the level ground and just cleared the top of the fence. The gravitational<br />

acceleration has the value g =9:8 m/s2 . The ball was regarded as a point<br />

particle and air resistance was neglected.<br />

In the recipe, we determined the angle with the horizontal that the ball was<br />

thrown, the time for the ball to reach the fence, and animated the motion of<br />

the ball with the fence included.<br />

In the following recipe, we shall make the above model calculation more<br />

realistic by including the e®ect of air resistance on the ball. Provided that the<br />

ball is smooth and its velocity ~v is not too high, the air resistance is governed by<br />

Stokes's resistance law, the drag force taking the form ~ Fdrag = ¡mk~v, where<br />

m is the mass of the ball and the drag coe±cient k is positive.<br />

As previously, the origin is chosen to be on the ground below the initial<br />

position of the ball and the x-coordinate is taken to be horizontal and the<br />

y-coordinate vertical. The plots package, needed for the animation, is loaded.<br />

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

With air resistance included, Newton's second law of motion yields the following<br />

ODE in the x direction.<br />

> xeq:=diff(x(t),t,t)=-k*diff(x(t),t);<br />

xeq := d2<br />

μ <br />

d<br />

x (t) =¡k x (t)<br />

dt2 dt<br />

Although xeq is a second-order ODE, it clearly can be reduced to a ¯rst-order<br />

ODE by integrating both sides once, and then solved by the same \hand"<br />

procedure used in the last recipe. However, it's quicker to solve for x(t) using<br />

the dsolve command, subject to the initial condition x(0) = xb and _x(0) =<br />

V cos(Á). Here xb is the initial x-coordinate of the ball, V the initial speed,<br />

and Á the initial angle of the velocity with the horizontal. For the time being,<br />

everything is kept symbolic, the parameter values being substituted later. After<br />

applying the dsolve command, we take the rhs of the resulting answer, yielding<br />

the x-coordinate of the ball at time t ¸ 0.<br />

> x:=rhs(dsolve(fxeq,x(0)=xb,D(x)(0)=V*cos(phi)g,x(t)));<br />

xb k + V cos(Á)<br />

x := ¡<br />

k<br />

V cos(Á) e(¡kt)<br />

k<br />

Taking xf to be the x-coordinate of the fence, we ¯nd the time tf for the ball<br />

to reach the fence by equating x to xf and solving for t.

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

Saved successfully!

Ooh no, something went wrong!