# 2.8 Game 2302-0380 motion -- variable velocity and acceleration  (Page 7/17)

 Page 7 / 17

When the test at the top of the while loop determines that the previously-computed value for height was negative,

• the body of the loop is skipped,
• the "End Script" message is displayed, and
• the script terminates.

This is not a complicated script in comparison with some of the scripts that were presented in earlier modules.

Given the output shown in Figure 2 , you should be able to estimate and plot the velocity of the arrow on the same graph bydividing the displacement during each time interval by the value of the time interval.

## Variable velocity exercise #2

Estimating variable velocity with a computer model

Let's write a script that approximates the graphic procedure that I described above.

Copy the code from Listing 2 into an html file and open the file in your browser.

Listing 2 . Variable velocity exercise #2.

```<!---------------- File JavaScript2.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 oldT = 0;//previous time in seconds var delT = 0;//change in time in secondsvar oldH = h0;//previous height in feet var delH = 0;//change in height in feet//The following variable is used to insert spaces in // the output display.var sp = "&nbsp;&nbsp;&nbsp;&nbsp;" //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.//Display the information for this iteration document.write("t = " + t.toFixed(2) + " seconds" + sp + " h = " + h.toFixed(1) + " feet" + sp +" v = " + v.toFixed(2) + " feet/second" + sp + "<br/>"); //Increment the time for the next iteration.t = t + tInc; }//end while loopdocument.write("End Script");</script></body></html>```

Screen output

The text shown in Figure 4 should appear in your browser window when the html file opens in your browser.

Figure 4 . Screen output for Listing #2.
```Start Script t = 0.00 seconds h = 6.0 feet v = 100.00 feet/secondt = 0.25 seconds h = 30.0 feet v = 95.97 feet/second t = 0.50 seconds h = 52.0 feet v = 87.92 feet/secondt = 0.75 seconds h = 72.0 feet v = 79.87 feet/second t = 1.00 seconds h = 89.9 feet v = 71.82 feet/secondt = 1.25 seconds h = 105.8 feet v = 63.77 feet/second t = 1.50 seconds h = 119.8 feet v = 55.72 feet/secondt = 1.75 seconds h = 131.7 feet v = 47.67 feet/second t = 2.00 seconds h = 141.6 feet v = 39.62 feet/secondt = 2.25 seconds h = 149.5 feet v = 31.57 feet/second t = 2.50 seconds h = 155.4 feet v = 23.52 feet/secondt = 2.75 seconds h = 159.2 feet v = 15.47 feet/second t = 3.00 seconds h = 161.1 feet v = 7.42 feet/secondt = 3.25 seconds h = 160.9 feet v = -0.63 feet/second t = 3.50 seconds h = 158.8 feet v = -8.68 feet/secondt = 3.75 seconds h = 154.6 feet v = -16.73 feet/second t = 4.00 seconds h = 148.4 feet v = -24.78 feet/secondt = 4.25 seconds h = 140.2 feet v = -32.83 feet/second t = 4.50 seconds h = 130.0 feet v = -40.88 feet/secondt = 4.75 seconds h = 117.7 feet v = -48.93 feet/second t = 5.00 seconds h = 103.5 feet v = -56.98 feet/secondt = 5.25 seconds h = 87.2 feet v = -65.03 feet/second t = 5.50 seconds h = 69.0 feet v = -73.08 feet/secondt = 5.75 seconds h = 48.7 feet v = -81.13 feet/second t = 6.00 seconds h = 26.4 feet v = -89.18 feet/secondt = 6.25 seconds h = 2.1 feet v = -97.23 feet/second t = 6.50 seconds h = -24.2 feet v = -105.28 feet/secondEnd Script```

where we get a research paper on Nano chemistry....?
nanopartical of organic/inorganic / physical chemistry , pdf / thesis / review
Ali
what are the products of Nano chemistry?
There are lots of products of nano chemistry... Like nano coatings.....carbon fiber.. And lots of others..
learn
Even nanotechnology is pretty much all about chemistry... Its the chemistry on quantum or atomic level
learn
da
no nanotechnology is also a part of physics and maths it requires angle formulas and some pressure regarding concepts
Bhagvanji
hey
Giriraj
Preparation and Applications of Nanomaterial for Drug Delivery
revolt
da
Application of nanotechnology in medicine
what is variations in raman spectra for nanomaterials
ya I also want to know the raman spectra
Bhagvanji
I only see partial conversation and what's the question here!
what about nanotechnology for water purification
please someone correct me if I'm wrong but I think one can use nanoparticles, specially silver nanoparticles for water treatment.
Damian
yes that's correct
Professor
I think
Professor
Nasa has use it in the 60's, copper as water purification in the moon travel.
Alexandre
nanocopper obvius
Alexandre
what is the stm
is there industrial application of fullrenes. What is the method to prepare fullrene on large scale.?
Rafiq
industrial application...? mmm I think on the medical side as drug carrier, but you should go deeper on your research, I may be wrong
Damian
How we are making nano material?
what is a peer
What is meant by 'nano scale'?
What is STMs full form?
LITNING
scanning tunneling microscope
Sahil
how nano science is used for hydrophobicity
Santosh
Do u think that Graphene and Fullrene fiber can be used to make Air Plane body structure the lightest and strongest. Rafiq
Rafiq
what is differents between GO and RGO?
Mahi
what is simplest way to understand the applications of nano robots used to detect the cancer affected cell of human body.? How this robot is carried to required site of body cell.? what will be the carrier material and how can be detected that correct delivery of drug is done Rafiq
Rafiq
if virus is killing to make ARTIFICIAL DNA OF GRAPHENE FOR KILLED THE VIRUS .THIS IS OUR ASSUMPTION
Anam
analytical skills graphene is prepared to kill any type viruses .
Anam
Any one who tell me about Preparation and application of Nanomaterial for drug Delivery
Hafiz
what is Nano technology ?
write examples of Nano molecule?
Bob
The nanotechnology is as new science, to scale nanometric
brayan
nanotechnology is the study, desing, synthesis, manipulation and application of materials and functional systems through control of matter at nanoscale
Damian
Is there any normative that regulates the use of silver nanoparticles?
what king of growth are you checking .?
Renato
What fields keep nano created devices from performing or assimulating ? Magnetic fields ? Are do they assimilate ?
why we need to study biomolecules, molecular biology in nanotechnology?
?
Kyle
yes I'm doing my masters in nanotechnology, we are being studying all these domains as well..
why?
what school?
Kyle
biomolecules are e building blocks of every organics and inorganic materials.
Joe
Got questions? Join the online conversation and get instant answers!