<< Chapter < Page | Chapter >> Page > |
To repeat the earlier definition, acceleration is the rate of change of velocity.
You learned earlier that velocity is the rate of change of position. Then you learned that we can estimate the velocity of a moving object at a point in timeby determining the slope of a curve that plots the position of the object versus time at that particular point in time.
Positive and negative velocity
Positive slopes indicate positive velocity and negative slopes indicate negative velocity. In the case of ourarrow, the velocity went to zero and switched from positive to negative at the point where the arrow reached its maximum height and began to fall back towardthe earth. In a math class, that point would likely be referred to as an inflection point on the curve of position versus time.
Estimating acceleration
We can extend that procedure to estimate the acceleration of a moving object at a point in time by determining the slope of acurve that plots the velocity of the object versus time at that particular point in time. Positive slopes indicate positive acceleration and negative slopesindicate negative acceleration.
Estimate some velocity values graphically
If you have the velocity curve from Figure 4 plotted on your graph, Irecommend that you estimate and record the slope and hence the acceleration at a few points. That should be easy to do in this case, because the velocity curveshould be a straight line with a negative slope.
A constant acceleration value
If the velocity curve is a straight line with a negative slope, and if the acceleration at any point in time is equal to the slope of the velocity curve, thatmeans that the acceleration has a constant negative value throughout the time interval of interest. In fact, you should find that the value of theacceleration is approximately -32.2 feet/second^2, which is known as the acceleration of gravity .
Create a script
Copy the code from Listing 3 into an html file and open that file in your browser.
Listing 3 . Acceleration of gravity exercise #1.
<!---------------- File JavaScript99.html ---------------------><html><body><script language="JavaScript1.3">document.write("Start Script<br/>");
//Declare and initialize constantsvar g = -32.2;//acceleration of gravity in ft/(sec*sec)
var v0 = 100;//initial velocity in ft/secvar h0 = 6;//initial height in feet
var tInc = 0.25;//calculation interval in seconds//Declare and initialize working variables
var t = .0001;//current time in secondsvar h = h0;//current height in feet
var v = 0;//current velocity in feet/secvar a = 0;//current acceleration in feet/(sec*sec)
var oldT = 0;//previous time in secondsvar delT = 0;//change in time in seconds
var oldH = h0;//previous height in feetvar delH = 0;//change in height in feet
var oldV = 0;//previous velocity in feet/secvar delV = 0;//change in velocity in feet/sec
//The following variable is used to insert spaces in// the output display.
var sp = " ";
//Compute and display various values for as long as the// height of the projectile is above the ground.
while(h>0){
//This is the general equation for the height of a// projectile under the influence of gravity in a
// vacuum.h = h0 + v0*t +0.5*g*t*t;
//Compute and save the time interval since the// previous estimate of height, etc.
delT = t-oldT;oldT = t;//Save the current time for the next iteration.
//Estimate the velocity based on the change in// height since the previous estimate.
delH = h-oldH;v = delH/delT;//compute velocity
oldH = h;//Save the current height for the next iteration.//Estimate the acceleration based on the change in
// velocity once the data pipeline is full.delV = v - oldV;
oldV = v;//Save the current velocity for the next iteration.if(t>2*tInc){
a = delV/delT;//compute acceleration}//end if
//Display the information for this iterationdocument.write(
"t = " + t.toFixed(2) + " sec" + sp +" h = " + h.toFixed(0) + " ft" + sp +
" v = " + v.toFixed(2) + " ft/sec" + sp +" a = " + a.toFixed(2) + " ft/(sec*sec)" +
"<br/>");
//Increment the time for the next iteration.t = t + tInc;
}//end while loopdocument.write("End Script");</script></body></html>
Notification Switch
Would you like to follow the 'Game 2302 - mathematical applications for game development' conversation and receive update notifications?