Projectile Motion - Appalachian State University · 2012-06-23 · Projectile Motion by Chris...

27
Chapter 11 Projectile Motion by Chris Pettit and Frank Wattenberg In this QuickStart tutorial you will learn how to create a model and simulation for projectile motion. This is also a good tutorial if you’d like to review, or learn about, vectors. Vectors provide a powerful and compact notation that is particularly useful for dealing with motion in two- or three-dimensional space. You will also use the If function. 11.1 Introduction We begin by looking at our goal – we want to produce a model and simulation that will enable users to hit a target with a projectile. Launch DIYModeling in the usual way and open the QuickStart example file target-practice.xml. See Section 1.2 on page 6. Choose Simulate and Pause from the Run menu. You should see something like the top screenshot in Figure 11.1. Notice the over-sized baseball sitting on one twenty yard line and the large target sitting on the other twenty yard line. Click the Play button and watch as the baseball soars through the air and lands on the field well short of the target. Notice that when the baseball hits the field it splits in two copies. One copy remains at the spot it hit the field and the other continues rolling downfield. See the bottom screenshot in Figure 11.1. The player’s job is to hit the target using two controls. One control enables the player to change the initial speed of the baseball and the other control enables the player to change the angle of elevation the flight of the baseball when it is first launched. You may want 78

Transcript of Projectile Motion - Appalachian State University · 2012-06-23 · Projectile Motion by Chris...

Page 1: Projectile Motion - Appalachian State University · 2012-06-23 · Projectile Motion by Chris Pettit and Frank Wattenberg In this QuickStart tutorial you will learn how to create

Chapter 11

Projectile Motion

by Chris Pettit and Frank Wattenberg

In this QuickStart tutorial you will learn how to create a model and simulationfor projectile motion. This is also a good tutorial if you’d like to review, orlearn about, vectors. Vectors provide a powerful and compact notation that isparticularly useful for dealing with motion in two- or three-dimensional space.You will also use the If function.

11.1 Introduction

We begin by looking at our goal – we want to produce a model and simulation that willenable users to hit a target with a projectile. Launch DIYModeling in the usual wayand open the QuickStart example file target-practice.xml. See Section 1.2 on page 6.Choose Simulate and Pause from the Run menu. You should see something like thetop screenshot in Figure 11.1. Notice the over-sized baseball sitting on one twenty yardline and the large target sitting on the other twenty yard line. Click the Play button andwatch as the baseball soars through the air and lands on the field well short of the target.Notice that when the baseball hits the field it splits in two copies. One copy remains at thespot it hit the field and the other continues rolling downfield. See the bottom screenshotin Figure 11.1.

The player’s job is to hit the target using two controls. One control enables the playerto change the initial speed of the baseball and the other control enables the player to changethe angle of elevation the flight of the baseball when it is first launched. You may want

78

Page 2: Projectile Motion - Appalachian State University · 2012-06-23 · Projectile Motion by Chris Pettit and Frank Wattenberg In this QuickStart tutorial you will learn how to create

CHAPTER 11. PROJECTILE MOTION 79

Figure 11.1: Target practice

Page 3: Projectile Motion - Appalachian State University · 2012-06-23 · Projectile Motion by Chris Pettit and Frank Wattenberg In this QuickStart tutorial you will learn how to create

CHAPTER 11. PROJECTILE MOTION 80

to experiment a bit before reading on. Press the Pause button, then use the two controlsto change the initial speed and angle of elevation, press the Restart button and the Playbutton to try to hit the target.

The next sections discuss the physics behind this simulation.

11.2 Position, Velocity, and Acceleration

You may want to review the first few pages of the QuickStart Tutorial in Chapter 2 on page11. The center of the football field shown in Figure 11.1 is located at the point (0, 0, 0).The center is the located on the 50 yard line and is midway between the two sidelines. Thepositive y-axis is pointing straight upward and the positive x-axis is pointing to your righttoward the home team’s goal line. The z-axis is lined up with the 50 yard line with thepositive z-axis pointing toward the viewer. For this QuickStart guide all the action is inthe plane z = 0.

In this QuickStart tutorial we will be modeling the flight of a projectile in three-dimensions. At any given moment, t, of time we need to keep track of three things –the position, or location, ~r(t), of the projectile, its velocity, ~v(t), and its acceleration, ~a(t).Because we are looking at motion in three dimensions we must keep track of the coordinatesof each of these three things with respect to the x-axis, the y-axis, and the z-axis. We cando this by using three variables for each of position, velocity, and acceleration – that is, atotal of nine variables.

• Variables r

x

(t), r

y

(t), and r

z

(t) for the x-, y-, and z-coordinates of the position.

• Variables v

x

(t), v

y

(t), and v

z

(t) for the x-, y-, and z-coordinates of the velocity.

• Variables a

x

(t), a

y

(t), and a

z

(t) for the x-, y-, and z-coordinates of the acceleration.

or we can use a single three-dimensional vector variable for each: ~r(t) for position, ~v(t) forvelocity, and ~a(t) for acceleration. You can go back-and-forth between these two notationsusing

~r(t) = (rx

(t), ry

(t), rz

(t))~v(t) = (v

x

(t), vy

(t), vz

(t))~a(t) = (a

x

(t), ay

(t), az

(t))

Page 4: Projectile Motion - Appalachian State University · 2012-06-23 · Projectile Motion by Chris Pettit and Frank Wattenberg In this QuickStart tutorial you will learn how to create

CHAPTER 11. PROJECTILE MOTION 81

The velocity of the projectile represents how fast and in what direction it is moving.We call this the rate of change of the position, or the derivative of the position, with respectto time and we write

~v(t) =d~r

dt

(t) = ~r

0(t)

or

v

x

(t) =dr

x

dt

(t) = r

0x

(t)

v

y

(t) =dr

y

dt

(t) = r

0y

(t)

v

z

(t) =dr

z

dt

(t) = r

0z

(t)

The acceleration of the projectile represents how fast and in what direction its velocityis changing. We call this the rate of change of the velocity, or the derivative of the velocity,with respect to time and we write

~a(t) =d~v(t)dt

(t) = ~v

0(t)

or

a

x

(t) =dv

x

dt

(t) = v

0x

(t)

a

y

(t) =dv

y

dt

(t) = v

0y

(t)

a

z

(t) =dv

z

dt

(t) = v

0z

(t)

Notice that we indicate that a variable is a vector variable with a small arrow abovethe letter denoting the variable.

Page 5: Projectile Motion - Appalachian State University · 2012-06-23 · Projectile Motion by Chris Pettit and Frank Wattenberg In this QuickStart tutorial you will learn how to create

CHAPTER 11. PROJECTILE MOTION 82

11.3 The Physics of Projectile Motion

Isaac Newton created a powerful and elegant model that underlies projectile motion andis based on two “laws.”

• Newton’s First Law of Motion – Every object in a state of uniform motion tends toremain in that state unless an external force is applied to it.

• The acceleration produced when an external force acts on an object is given by theequation

~a =✓

1m

◆~

F

where ~

F is the force and m is the mass of the object.

Although these laws seem simple, the first law appears to contradict our everydayexperience. It has two somewhat di↵erent aspects. The first aspect says that when a bodyis still it will remain still in the absence of any external force. That is not surprising – wedo not expect still objects to start moving of their own volition. The first law also saysthat when a body is moving, it will continue moving in the same direction and at the samerate in the absence of any external force. This is the aspect that seems to contradict oureveryday experience. Most of the moving objects we observe slow down and eventuallystop because of the unseen forces of friction and air resistance. Because we can’t see theseforces and they are everywhere around us we have unconsciously been led to believe thatmoving objects slow down in the absence of an external force. The objects we see aroundare slowing down because of unseen external forces.

In DIYModeling you can describe the motion of a projectile in either of two waysand for each way you can use the more compact vector notation with three vector variablesor you can use a total of nine variables, three variables for the three coordinates of eachof position, velocity, and acceleration. You can use either the language of di↵erentialequations that come from Newton’s laws or you can use their closed-form solutions. Eitherway you do not need to know the material that is usually taught in di↵erential equationsclasses. You only need to understand the meaning of the derivative, or the rate of change.The choice is yours. We will cover all four variations.

Our projectile will be launched at time t = 0 with an initial position

~r

0

= (x0

, y

0

, z

0

)

Page 6: Projectile Motion - Appalachian State University · 2012-06-23 · Projectile Motion by Chris Pettit and Frank Wattenberg In this QuickStart tutorial you will learn how to create

CHAPTER 11. PROJECTILE MOTION 83

and an initial velocity1

~v

0

= (vx

0

, vy

0

, vz

0

) .

We will ignore air resistance so that the only force acting on our projectile is the forceof gravity. We will use the y-coordinate for the height, with y = 0 being the ground. Timewill be measured in seconds and distances in feet. Thus the external force acting on ourprojectile is

~

F = m(0,�32, 0)

and the resulting acceleration of the object is

~a(t) = (0,�32, 0) feet per second per second= (0,�32, 0) feet per second2

or

a

x

(t) = 0 feet per second2

a

y

(t) = �32 feet per second2

a

z

(t) = 0 feet per second2

If you’ve taken calculus or a physics course you probably know that this motion can bedescribed by the equation

~r(t) = ~r

0

+ t~v

0

� 16t

2(0, 1, 0),

using vector notation or1The notation vx0, vy0, and vz0 denotes the x-, y-, and z-coordinates of the initial velocity.

Page 7: Projectile Motion - Appalachian State University · 2012-06-23 · Projectile Motion by Chris Pettit and Frank Wattenberg In this QuickStart tutorial you will learn how to create

CHAPTER 11. PROJECTILE MOTION 84

x(t) = x

0

+ vx

0

t

y(t) = y

0

+ vy

0

t� 16t

2

z(t) = z

0

+ vz

0

t,

using three equations for the three coordinates. You may use either of these models whenyou build your simulation but you also have another option. Because DIYModeling hasthe ability to find numerical solutions of di↵erential equations, you can simply use thedi↵erential equations or, more completely, the initial value problem directly. Using vectornotation

~r

0 = ~v, ~r(0) = ~r

0

~v

0 = �(0, 32, 0), ~v(0) = ~v

0

or avoiding vector notation,

x

0 = v

x

, x(0) = x

0

y

0 = v

y

, y(0) = y

0

z

0 = v

z

, z(0) = z

0

v

0x

= 0, v

x

(0) = vx

0

v

0y

= �32, v

y

(0) = vy

0

v

0z

= 0, v

z

(0) = vz

0

Notice that we use systems of first order di↵erential equations rather than second orderdi↵erential equations.

11.3.1 The Initial Velocity

For simplicity we will assume that the initial velocity has only two nonzero components– an upward component (in the positive y-direction) and a component in the positivex-direction. That is, we assume that the initial velocity is of the form

Page 8: Projectile Motion - Appalachian State University · 2012-06-23 · Projectile Motion by Chris Pettit and Frank Wattenberg In this QuickStart tutorial you will learn how to create

CHAPTER 11. PROJECTILE MOTION 85

vx

0

vy

0

~v

0

x

y

Figure 11.2: The Angle of Elevation of the Initial Velocity

~v

0

= (vx

0

, vy

0

, 0) .

The initial velocity is often expressed in terms of its magnitude, or speed, s, and angleof elevation, ✓. See Figure 11.2. Notice that

vx

0

= s cos ✓

vy

0

= s sin ✓

since s is the length of the hypotenuse of the triangle whose vertices are the origin, thepoint (vx

0

, vy

0

), and the point (vx

0

, 0) shown in Figure 11.2.

11.4 Building a Model and Simulation Using DIYModeling

Now we are ready to build a model and simulation using DIYModeling. This section hasfour variations. You may choose to use any one of these variations. You may even want todo more than one. The four variations are:

• Using vectors and di↵erential equations – Subsection 11.4.1.

• Using vectors and equations – Subsection 11.4.2.

• Using di↵erential equations and avoiding vectors – Subsection 11.4.3.

• Using equations and avoiding vectors – Subsection 11.4.4.

Page 9: Projectile Motion - Appalachian State University · 2012-06-23 · Projectile Motion by Chris Pettit and Frank Wattenberg In this QuickStart tutorial you will learn how to create

CHAPTER 11. PROJECTILE MOTION 86

Figure 11.3: Adding a baseball component

Whichever variation you choose begin by launching DIYModeling in the usual wayand opening the simulation skeleton projectile-motion-skeleton.xml. See Section 1.2on page 6. Next go to the Components tab in the Model window and drag a Baseballcomponent from the Component Libraries pane on the left to the larger pane at the rightthat contains the components for this simulation. See Figure 11.3. Click the symbol tothe upper right of the new baseball component to open a pane that enables you to set theparameters for this component. See Figure 11.4.

Edit the following parameters for this component as described below.

• Position [-90, 0, 0]

• Size [10, 10, 10]

Notice that both of these parameters are three-dimensional vectors and that in DIY-Modeling we use square brackets to denote vectors rather than parentheses. After you’ve

Page 10: Projectile Motion - Appalachian State University · 2012-06-23 · Projectile Motion by Chris Pettit and Frank Wattenberg In this QuickStart tutorial you will learn how to create

CHAPTER 11. PROJECTILE MOTION 87

Figure 11.4: The parameters for the baseball component

Page 11: Projectile Motion - Appalachian State University · 2012-06-23 · Projectile Motion by Chris Pettit and Frank Wattenberg In this QuickStart tutorial you will learn how to create

CHAPTER 11. PROJECTILE MOTION 88

Figure 11.5: The new baseball component (half-buried)

edited these parameters choose Simulate and Pause from the Run menu. After you’vechosen the graphics quality in the usual way and if you’ve made no mistakes, you shouldsomething like Figure 11.5. If you don’t see this, check the Error tab in the Model Editor,fix any errors, and try again. Notice that the baseball is half-buried in the football field.The position parameter for the baseball component describes the position of the center ofthe baseball. This baseball has a diameter of 10 feet to make it more visible. Change theposition parameter to [-90, 5, 0] so that the baseball rests on the field.

Next we add two controls, a digital control to enable the player to specify the initialspeed of the baseball and a slider control to enable the player to specify the initial angle ofelevation for the flight of the baseball. In the Components tab of the Model window draga digital control and slider control from the component libraries pane into the larger paneon the right. Rename the digital control speed and the slider control theta by clickingand editing the name below each control. See Figure 11.6. For the digital speed controlset the following component parameters in the usual way.

Page 12: Projectile Motion - Appalachian State University · 2012-06-23 · Projectile Motion by Chris Pettit and Frank Wattenberg In this QuickStart tutorial you will learn how to create

CHAPTER 11. PROJECTILE MOTION 89

Figure 11.6: The new control components

• Label – Speed (feet per second)

• Value – 60

• Minimum – 0

• Maximum – 500

and for the slider angle of elevation control set the following parameters in the usual way

• Label – Angle of Elevation (Radians)

• Value – pi/4

• Minimum – 0

• Maximum – pi/2

Notice that the values of theta are in radians.

After you’ve made all these changes choose Simulate and Pause from the Run menu.After you’ve chosen the graphics quality in the usual way and if you’ve made no mistakes,

Page 13: Projectile Motion - Appalachian State University · 2012-06-23 · Projectile Motion by Chris Pettit and Frank Wattenberg In this QuickStart tutorial you will learn how to create

CHAPTER 11. PROJECTILE MOTION 90

you should something like the top screenshot in Figure 11.1. If you don’t see this, checkthe Error tab in the Model Editor, fix any errors, and try again. Notice the new controlstoward the upper right.

Now continue using the variation of your choice. Recall that you have a choice of fourvariations.

• Using vectors and di↵erential equations – Subsection 11.4.1.

• Using vectors and equations – Subsection 11.4.2.

• Using di↵erential equations and avoiding vectors – Subsection 11.4.3.

• Using equations and avoiding vectors – Subsection 11.4.4.

11.4.1 Using Vectors and Di↵erential Equations

In this subsection we use the di↵erential equations and initial values

~r

0 = ~v, ~r(0) = ~r

0

= (x0

, y

0

, z

0

)~v

0 = �(0, 32, 0), ~v(0) = ~v

0

= (vx

0

, vy

0

, vz

0

)

Using s to denote the initial speed and ✓ to denote the angle of elevation we have

vx

0

= s cos ✓

vy

0

= s sin ✓

vz

0

= 0

In this simulation (see the top of Figure 11.1) the baseball starts at the location(�90, 0, 0). Recall we are using feet as our units for length. So our di↵erential equationsand initial values become

Page 14: Projectile Motion - Appalachian State University · 2012-06-23 · Projectile Motion by Chris Pettit and Frank Wattenberg In this QuickStart tutorial you will learn how to create

CHAPTER 11. PROJECTILE MOTION 91

Figure 11.7: Two di↵erential equation vector variables

~r

0 = ~v, ~r(0) = (�90, 0, 0)~v

0 = �(0, 32, 0), ~v(0) = (s cos ✓, s sin ✓, 0)

In DIYModeling we define these variables in the Model tab of the Editor window.See Figure 11.7. Complete the following steps.

• Click the Add New button twice to create two new variables.

• Name the first variable ball and the second variable velocity by editing the entriesin the Name column.

• Choose diff eq from the pull-down list in the How column for each variable.

• Choose vector from the pull-down list in the What column for each variable.

• Enter 3 in the Dim column for each variable.

• Choose ft from the pull-down list in the Units column for the ball variable andft/sec from the pull-down list in the Units column for the velocity variable.

• Edit the initial value for the ball variable so that it reads [-90, 0, 0]

• Edit the initial value for the velocity variable so that it reads

[speed * cos(theta), speed * sin(theta), 0]

• Edit the entry in the Expression column for the ball variable so that it reads velocity

• Edit the entry in the Expression column for the velocity variable so that it reads

[0, -32, 0]

Page 15: Projectile Motion - Appalachian State University · 2012-06-23 · Projectile Motion by Chris Pettit and Frank Wattenberg In this QuickStart tutorial you will learn how to create

CHAPTER 11. PROJECTILE MOTION 92

The new variable ball specifies the location of the (center of) the baseball, so changethe position parameter of the baseball component to ball + [0, 5, 0].

You should now have a working first version of the simulation. Choose Simulate andPause from the Run menu and then use the Play, Pause, and Restart buttons and thecontrols you’ve created to try it out as described earlier. As usual you may have to correctany errors. Notice that the baseball continues falling below the football field. We need tocorrect this behavior but you can still experiment with this version.

Stopping the ball when it hits the ground

To stop the ball when it hits the ground we need to change its velocity (that is, thederivative of its position) to

r

0(t) =⇢

v(t), if the ball’s height is � 0;(0, 0, 0), otherwise.

This expression has two new elements that occur often in models and DIYModelinghas two functions that enable you to express these two new elements. The first element isa conditional expression – something like

f(x) =⇢

expression 1, if condition;expression 2, otherwise.

This is expressed in DIYModeling by

If(condition, expression 1, expression 2)

The second element is picking the i

th component of a vector. In DIYModeling thisis expressed by

component(vector, i)

Putting these two new elements together change the entry in the Expression column forthe variable ball from

velocity

Page 16: Projectile Motion - Appalachian State University · 2012-06-23 · Projectile Motion by Chris Pettit and Frank Wattenberg In this QuickStart tutorial you will learn how to create

CHAPTER 11. PROJECTILE MOTION 93

to

if(component(ball, 2) >= 0, velocity, [0, 0, 0])

You should now have a working second version of the simulation. Choose Simulateand Pause from the Run menu and then use the Play, Pause, and Restart buttonsand the controls you’ve created to try it out as described earlier. As usual you may haveto correct any errors.

Making the ball roll after it hits the ground

The same ideas we used above to stop the ball when it hits the ground can be used tomake it roll along the field after it hits the ground. Change the Expression column for thevariable ball to

if(component(ball, 2) >= 0, velocity, [component(velocity, 1), 0, component(velocity, 3)])

You should now have a working third version of the simulation. Choose Simulate andPause from the Run menu and then use the Play, Pause, and Restart buttons and thecontrols you’ve created to try it out as described earlier. As usual you may have to correctany errors.

Two balls, one stopping and one rolling, after hitting the ground

To reproduce the target practice simulation we want, simply use two baseballs, controlledby two di↵erent variables – one baseball should stop when it hits the ground and the othershould roll along the field. During the flight you will only see one baseball because the twoare superimposed on each other but after they hit the ground the two will separate.

11.4.2 Using Vectors and Equations

In this section we use the equation

~r(t) =�x

0

+ vx

0

t, y

0

+ vy

0

t� 16t

2

, z

0

+ vz

0

t

Using s to denote the initial speed and ✓ to denote the angle of elevation we have

Page 17: Projectile Motion - Appalachian State University · 2012-06-23 · Projectile Motion by Chris Pettit and Frank Wattenberg In this QuickStart tutorial you will learn how to create

CHAPTER 11. PROJECTILE MOTION 94

Figure 11.8: A single vector variable defined by an equation

vx

0

= s cos ✓

vy

0

= s sin ✓

vz

0

= 0

In this simulation (See the top of Figure 11.1) the baseball starts at the location(�90, 0, 0). Recall we are using feet as our units for length. So our equations become

~r(t) =�ts cos ✓ � 90, ts sin ✓ � 16t

2

, 0�

In DIYModeling we define this variable in the Model tab of the Editor window asfollows. See Figure 11.8.

• Click the Add New button to create a new variable.

• Name the new variable ball by editing the entry in the Name column.

• Notice the default entry function in the How column. Leave this entry as is.

• Choose vector from the pull-down list in the What column.

• Enter 3 in the Dim column.

• Choose ft from the pull-down list in the Units column.

• Enter

[time * speed * cos(theta) - 90, time * speed * sin(theta) - 16 * time^2, 0]

in the Expression column.

Page 18: Projectile Motion - Appalachian State University · 2012-06-23 · Projectile Motion by Chris Pettit and Frank Wattenberg In this QuickStart tutorial you will learn how to create

CHAPTER 11. PROJECTILE MOTION 95

The new variable ball specifies the location of the (center of) the baseball, so changethe position parameter of the baseball component to ball + [0, 5, 0].

You should now have a working first version of the simulation. Choose Simulate andPause from the Run menu and then use the Play, Pause, and Restart buttons and thecontrols you’ve created to try it out as described earlier. As usual you may have to correctany errors. Notice that the baseball continues falling below the football field. We need tocorrect this behavior but you can still experiment with this version.

Making the ball roll when it hits the ground

The model we’re using describes a ball that goes underground. We can change this bychanging the entry in the Expression column to

[time * speed * cos(theta) - 90, max(0, time * speed * sin(theta) - 16 * time^2), 0]

You should now have a working second version of the simulation. Choose Simulateand Pause from the Run menu and then use the Play, Pause, and Restart buttonsand the controls you’ve created to try it out as described earlier. As usual you may haveto correct any errors.

Making the ball stop when it hits the ground

To find out when the baseball hits the ground we solve the equation

ts sin ✓ � 16t

2 = 0t(s sin ✓ � 16t) = 0

This equation has two solutions t

1

= 0 and

t

2

=s sin ✓

16.

the latter solution is the one of interest. At this time

Page 19: Projectile Motion - Appalachian State University · 2012-06-23 · Projectile Motion by Chris Pettit and Frank Wattenberg In this QuickStart tutorial you will learn how to create

CHAPTER 11. PROJECTILE MOTION 96

~r(t2

) =✓

s

2 cos ✓ sin ✓

16� 90, 0, 0

◆.

So we want to use

~r(t) =

(�ts cos ✓ � 90, ts sin ✓ � 16t

2

, 0�, if t s sin ✓

16

;⇣s

2cos ✓ sin ✓

16

� 90, 0, 0⌘

, otherwise.

This expression has a new element that occurs often in models – something like

f(x) =⇢

expression 1, if condition;expression 2, otherwise.

This is expressed in DIYModeling by

If(condition, expression 1, expression 2)

So we can make the ball stop in DIYModeling by editing the entry in the Expressioncolumn to read

If(time <= speed * sin(theta)/16,[time * speed * cos(theta) - 90, time * speed * sin(theta) - 16 * time^2, 0],[speed^2 * cos(theta) * sin(theta)/16 - 90, 0, 0])

Two balls, one stopping and one rolling, after hitting the ground

To reproduce the target practice simulation we want, simply use two baseballs, controlledby two di↵erent variables – one baseball should stop when it hits the ground and the othershould roll along the field. During the flight you will only see one baseball because the twoare superimposed on each other but after they hit the ground the two will separate.

11.4.3 Using Di↵erential Equations and Avoiding Vectors

In this subsection we use the di↵erential equations and initial values

Page 20: Projectile Motion - Appalachian State University · 2012-06-23 · Projectile Motion by Chris Pettit and Frank Wattenberg In this QuickStart tutorial you will learn how to create

CHAPTER 11. PROJECTILE MOTION 97

x

0 = v

x

, x(0) = x

0

y

0 = v

y

, y(0) = y

0

z

0 = v

z

, z(0) = z

0

v

0x

= 0, v

x

(0) = vx

0

v

0y

= �32, v

y

(0) = vy

0

v

0z

= 0, v

z

(0) = vz

0

Using s to denote the initial speed and ✓ to denote the angle of elevation we have

vx

0

= s cos ✓

vy

0

= s sin ✓

vz

0

= 0

In this simulation (See the top of Figure 11.1) the baseball starts at the location(�90, 0, 0). Recall we are using feet as our units for length. So our di↵erential equationsand initial values become

x

0 = v

x

, x(0) = �90y

0 = v

y

, y(0) = 0z

0 = v

z

, z(0) = 0v

0x

= 0, v

x

(0) = s cos ✓

v

0y

= �32, v

y

(0) = s sin ✓

v

0z

= 0, v

z

(0) = 0

In DIYModeling we define these variables in the Model tab of the Editor window.See Figure 11.9. Complete the following steps.

• Click the Add New button six times to create six new variables.

Page 21: Projectile Motion - Appalachian State University · 2012-06-23 · Projectile Motion by Chris Pettit and Frank Wattenberg In this QuickStart tutorial you will learn how to create

CHAPTER 11. PROJECTILE MOTION 98

Figure 11.9: Six di↵erential equation variables

• Name the variables ballx, bally, ballz, velx, vely, and velz by editing the entriesin the Name column.

• Choose diff eq from the pull-down list in the How column for each variable.

• Notice the default entry in the What column is decimal. Leave this entry as is.

• Choose ft from the pull-down list in Units column for the three ball variables andft/sec from the pull-down list in the Units column for the three velocity variables.

• Edit the initial value for the ballx variable so that it reads -90 and the initial valuesfor the bally and ballz variables so that they read 0

• Edit the entries in the Expression columns for the variables ballx, bally, and ballzso that they read velx vely and velz respectively.

• Edit the initial value for the velx variable so that it reads speed * cos(theta)

• Edit the initial value for the vely variable so that it reads speed * sin(theta)

• Edit the initial value for the velz variable so that it reads 0

• Edit the entries in the Expression columns for the velx and velz variables so thatthey read 0

• Edit the entry in the Expression column for the vely variable so that it reads -32

Change the position parameter for the baseball component so that it reads

[ballx, bally + 5, ballz]

Page 22: Projectile Motion - Appalachian State University · 2012-06-23 · Projectile Motion by Chris Pettit and Frank Wattenberg In this QuickStart tutorial you will learn how to create

CHAPTER 11. PROJECTILE MOTION 99

You should now have a working first version of the simulation. Choose Simulate andPause from the Run menu and then use the Play, Pause, and Restart buttons and thecontrols you’ve created to try it out as described earlier. As usual you may have to correctany errors. Notice that the baseball continues falling below the football field. We need tocorrect this behavior but you can still experiment with this version.

Stopping the ball when it hits the ground

To stop the ball when it hits the ground we need to change the derivatives of the positionvariables to

x

0 =⇢

v

x

, if the ball’s height is � 0;0, otherwise

y

0 =⇢

v

y

, if the ball’s height is � 0;0, otherwise

z

0 =⇢

v

z

, if the ball’s height is � 0;0, otherwise

These expressions have a new element that occurs often in models – something like

f(x) =⇢

expression 1, if condition;expression 2, otherwise.

This is expressed in DIYModeling by

If(condition, expression 1, expression 2)

Change the entries in the Expression column for each of the variables ballx, bally,and ballz to

If(bally >= 0, velx, 0)If(bally >= 0, vely, 0)If(bally >= 0, velz, 0)

respectively.

Page 23: Projectile Motion - Appalachian State University · 2012-06-23 · Projectile Motion by Chris Pettit and Frank Wattenberg In this QuickStart tutorial you will learn how to create

CHAPTER 11. PROJECTILE MOTION 100

You should now have a working second version of the simulation. Choose Simulateand Pause from the Run menu and then use the Play, Pause, and Restart buttonsand the controls you’ve created to try it out as described earlier. As usual you may haveto correct any errors.

Making the ball roll after it hits the ground

The same ideas we used above to stop the ball when it hits the ground can be used tomake it roll along the field after it hits the ground. Change the entries in the Expressioncolumn for the variables ballx, bally, and ballz to

If(bally >= 0, vely, 0)

respectively.

You should now have a working third version of the simulation. Choose Simulate andPause from the Run menu and then use the Play, Pause, and Restart buttons and thecontrols you’ve created to try it out as described earlier. As usual you may have to correctany errors.

Two balls, one stopping and one rolling, after hitting the ground

To reproduce the target practice simulation we want, simply use two baseballs, controlledby two di↵erent variables – one baseball should stop when it hits the ground and the othershould roll along the field. During the flight you will only see one baseball because the twoare superimposed on each other but after they hit the ground the two will separate.

11.4.4 Using Equations and Avoiding Vectors

In this subsection we use the equations

x(t) = x

0

+ vx

0

t

y(t) = y

0

+ vy

0

t� 16t

2

z(t) = z

0

+ vz

0

t

Page 24: Projectile Motion - Appalachian State University · 2012-06-23 · Projectile Motion by Chris Pettit and Frank Wattenberg In this QuickStart tutorial you will learn how to create

CHAPTER 11. PROJECTILE MOTION 101

Figure 11.10: Defining three variables

Using s to denote the initial speed and ✓ to denote the angle of elevation we have

vx

0

= s cos ✓

vy

0

= s sin ✓

vz

0

= 0

In this simulation (See the top of Figure 11.1) the baseball starts at the location(�90, 0, 0). Recall we are using feet as our units for length. So our equations become

x(t) = ts cos ✓ � 90y(t) = ts sin ✓ � 16t

2

z(t) = z

0

In DIYModeling we define these variables in the Model tab of the Editor window.See Figure 11.10. Complete the following steps.

• Click the Add New button three times to create three new variables.

• Name the variables ballx, bally, and ballz by editing the entries in the Namecolumn.

• Notice that the default entry in the How column for each variable is function. Leavethis entry as is.

Page 25: Projectile Motion - Appalachian State University · 2012-06-23 · Projectile Motion by Chris Pettit and Frank Wattenberg In this QuickStart tutorial you will learn how to create

CHAPTER 11. PROJECTILE MOTION 102

• Notice that the default entry in the What column for each variable is decimal. Leavethis entry as is.

• Choose ft from the pull-down menu in the Units column for each variable.

• Edit the entry in the Expression column for each of ballx, bally, and ballz to read

time * speed * cos(theta) - 90time * speed * sin(theta) - 16 * time^20

respectively.

Change the position parameter for the baseball component so that it reads

[ballx, bally + 5, ballz]

You should now have a working first version of the simulation. Choose Simulate andPause from the Run menu and then use the Play, Pause, and Restart buttons and thecontrols you’ve created to try it out as described earlier. As usual you may have to correctany errors. Notice that the baseball continues falling below the football field. We need tocorrect this behavior but you can still experiment with this version.

Making the ball roll when it hits the ground

The model we’re using describes a ball that goes underground. We can change this bychanging the entry in the Expression column for bally

max(0, time * speed * sin(theta) - 16 * time^2)

You should now have a working second version of the simulation. Choose Simulateand Pause from the Run menu and then use the Play, Pause, and Restart buttonsand the controls you’ve created to try it out as described earlier. As usual you may haveto correct any errors.

Page 26: Projectile Motion - Appalachian State University · 2012-06-23 · Projectile Motion by Chris Pettit and Frank Wattenberg In this QuickStart tutorial you will learn how to create

CHAPTER 11. PROJECTILE MOTION 103

Making the ball stop when it hits the ground

To find out when the baseball hits the ground we solve the equation

ts sin ✓ � 16t

2 = 0t(s sin ✓ � 16t) = 0

This equation has two solutions t

1

= 0 and

t

2

=s sin ✓

16.

the latter solution is the one of interest. At this time

x(t2

) =s

2 cos ✓ sin ✓

16� 90

and y(t2

) = 0 and z(t2

) = 0. So we want to use

x(t) =

(ts cos ✓ � 90, if t s sin ✓

16

;s

2cos ✓ sin ✓

16

� 90, otherwise.

y(t) =⇢

ts sin ✓, if t s sin ✓

16

;0, otherwise.

z(t) = 0

These expressions have a new element that occurs often in models – something like

f(x) =⇢

expression 1, if condition;expression 2, otherwise.

This is expressed in DIYModeling by

If(condition, expression 1, expression 2)

Page 27: Projectile Motion - Appalachian State University · 2012-06-23 · Projectile Motion by Chris Pettit and Frank Wattenberg In this QuickStart tutorial you will learn how to create

CHAPTER 11. PROJECTILE MOTION 104

So we can make the ball stop in DIYModeling by editing the entries in the Expressioncolumn for ballx, bally, and ballz to read

If(time <= speed*sin(theta)/16, time*speed*cos(theta)-90, speed^2*cos(theta)*sin(theta)/16-90)

If(time <= speed * sin(theta)/16, time * speed * sin(theta) - 16 * time^2, 0)

0

respectively.

Two balls, one stopping and one rolling, after hitting the ground

To reproduce the target practice simulation we want, simply use two baseballs, controlledby two di↵erent variables – one baseball should stop when it hits the ground and the othershould roll along the field. During the flight you will only see one baseball because the twoare superimposed on each other but after they hit the ground the two will separate.