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.

4 INTRODUCTION<br />

(a) At what angle Á with the horizontal is the ball thrown?<br />

(b) How long does it take the ball to reach the fence?<br />

(c) Plot the entire trajectory, then animate the motion of the ball, including<br />

the fence in the animation.<br />

Let's choose the origin to be on the ground below the initial position of the<br />

ball and take the x-coordinate to be horizontal and the y-coordinate vertical.<br />

To begin the recipe, we ¯rst clear Maple's internal memory of any previously<br />

assigned values (other worksheets may be open with numerical values given to<br />

some of the same symbols being used in the present recipe). This is done by<br />

typing in the restart command after the opening prompt ( >) symbol, ending<br />

the command with a colon (:), and pressing Enter (which generates a new<br />

prompt symbol) on the computer keyboard.<br />

> restart:<br />

All Maple command lines must be ended with either a colon, which suppresses<br />

any output, or a semicolon (;), which allows the output to be viewed.<br />

Next, the given parameter values are speci¯ed. For example, the initial<br />

x-coordinate of the ball is entered, the symbolic name xb being placed to the<br />

left of the Maple assignment operator (:=). The numerical value (0) of the<br />

coordinate is placed on the right-hand side of the operator and the output<br />

suppressed here with a command-ending colon. Assigned quantities can be<br />

mathematically manipulated. In a similar manner, the numerical values of the<br />

ball's initial y-coordinate (yb), the horizontal location (xf) of the fence, the<br />

fence's height (yf), the initial speed (V) of the ball, and the magnitude of the<br />

gravitational acceleration (g) are entered. Because the command entries are<br />

short, we have chosen to place them all on the same prompt line, separating<br />

the entries by a space for reading clarity.<br />

> xb:=0: yb:=2: xf:=20: yf:=3.5: V:=15: g:=9.8:<br />

Using the symbol * for multiplication, we express the horizontal (vx) and vertical<br />

(vy) components of the ball's initial velocity in terms of the unknown angle<br />

Á. The Maple input syntax phi is used to generate the Greek letter Á in the<br />

output. Note that the assigned value (15) of V is automatically substituted.<br />

> vx:=V*cos(phi); vy:=V*sin(phi);<br />

vx := 15 cos(Á) vy := 15 sin(Á)<br />

Using the standard kinematic relations [Oha85], we calculate the ball's x and y<br />

coordinates at arbitrary time t. The symbols +, -, /, and^ are used for addition,<br />

subtraction, division, and exponentiation. Note that the decimal coe±cient of<br />

t 2 in the output is given to 10 digits, Maple's usual default accuracy.<br />

> x:=xb+vx*t; y:=yb+vy*t-(1/2)*g*t^2;<br />

x := 15 cos(Á) t y := 2 + 15 sin(Á) t ¡ 4:900000000 t 2<br />

Setting x=xf in the solve command, the time t = tf for the ball to reach the<br />

fence is determined in terms of Á.<br />

> tf:=solve(x=xf,t); #time to reach fence

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

Saved successfully!

Ooh no, something went wrong!