<< Chapter < Page Chapter >> Page >
Figure 6 . Mirror image contained in the file named Phy1070b1.svg
Missing image

JavaScript code

Please copy the code shown in Listing 3 into an html file and open the file in your browser.

Listing 3 . Exercise #1 for a man on a train.
<!---------------- File JavaScript03.html ---------------------><html><body><script language="JavaScript1.3">document.write("Start Script</br>"); //The purpose of this function is to receive the adjacent// and opposite side values for a right triangle and to // return the angle in degrees in the correct quadrant.function getAngle(x,y){ if((x == 0)&&(y == 0)){ //Angle is indeterminate. Just return zero.return 0; }else if((x == 0)&&(y>0)){ //Avoid divide by zero denominator.return 90; }else if((x == 0)&&(y<0)){ //Avoid divide by zero denominator.return -90; }else if((x<0)&&(y>= 0)){ //Correct to second quadrantreturn Math.atan(y/x)*180/Math.PI + 180; }else if((x<0)&&(y<= 0)){ //Correct to third quadrantreturn Math.atan(y/x)*180/Math.PI + 180; }else{//First and fourth quadrants. No correction required. return Math.atan(y/x)*180/Math.PI;}//end else }//end function getAngle//------------------------------------------------------------// //The purpose of this function is to add two vectors, given// the magnitude and angle (in degrees) for each vector. // The magnitude and angle (in degrees) of the resultant// vector is returned in a two-element array, with the // magnitude in the element at index 0 and the angle in the// element at index 1. Note that this function calls the // getAngle function, which must also be provided in the// script. To use this function to subtract one vector from // another, add 180 degrees to the angle for the subtrahend// vector before passing the angle to the function. To use // this function to add more than two vectors, add the first// two vectors as normal, then add the output from this // function to the third vector, etc., until all of the// vectors have been included in the sum. function vectorSum(vecAmag,vecAang,vecBmag,vecBang){var vecResult = new Array(2); //Compute the horizontal and vertical components// of each vector. var vecAh = vecAmag*Math.cos(vecAang*Math.PI/180);var vecAv = vecAmag*Math.sin(vecAang*Math.PI/180); var vecBh = vecBmag*Math.cos(vecBang*Math.PI/180);var vecBv = vecBmag*Math.sin(vecBang*Math.PI/180); //Compute the sums of the horizontal and vertical// components from the two vectors to get the // horizontal and vertical component of the// resultant vector. var vecResultH = vecAh + vecBh;var vecResultV = vecAv + vecBv; //Use the Pythagorean theorem to compute the magnitude of// the resultant vector. vecResult[0]= Math.sqrt(Math.pow(vecResultH,2) + Math.pow(vecResultV,2));//Compute the angle of the resultant vector in degrees. vecResult[1]= getAngle(vecResultH,vecResultV); return vecResult;}//end vectorSum function //------------------------------------------------------------////The main script body begins here. //Establish the magnitude and angle for each vector.var vecTrainMag = 1;//magnitude of velocity of train in miles/hr var vecTrainAng = 0;//angle of velocity of train in degreesvar vecManMag = 2.933*3600*(1/5280);//Magnitude of velocity of // man (ft/sec)*(sec/hr)*(mile/ft)// = miles/hour var vecManAng = 0;//angle of velocity of man in degrees//Add the two vectors var resultant = vectorSum(vecTrainMag,vecTrainAng,vecManMag,vecManAng); //Display the magnitude and direction of the resultant vector.document.write("Velocity magnitude = " + resultant[0].toFixed(2) + " miles/hour</br>"); document.write("Velocity angle = " +resultant[1].toFixed(2) + " degrees</br>"); document.write("End Script");</script></body></html>

Questions & Answers

it is the relatively stable flow of income
Chidubem Reply
what is circular flow of income
Divine Reply
branches of macroeconomics
SHEDRACK Reply
what is Flexible exchang rate?
poudel Reply
is gdp a reliable measurement of wealth
Atega Reply
introduction to econometrics
Husseini Reply
Hi
mostafa
hi
LEMLEM
hello
Sammol
hi
Mahesh
bi
Ruqayat
hi
Ruqayat
Hi fellas
Nyawa
hey
Sammol
hi
God
hello
Jahara
Good morning
Jorge
hi
abubakar
hi
Nmesoma
hi
Mahesh
Hi
Tom
Why is unemployment rate never zero at full employment?
Priyanka Reply
bcoz of existence of frictional unemployment in our economy.
Umashankar
what is flexible exchang rate?
poudel
due to existence of the pple with disabilities
Abdulraufu
the demand of a good rises, causing the demand for another good to fall
Rushawn Reply
is it possible to leave every good at the same level
Joseph
I don't think so. because check it, if the demand for chicken increases, people will no longer consume fish like they used to causing a fall in the demand for fish
Anuolu
is not really possible to let the value of a goods to be same at the same time.....
Salome
Suppose the inflation rate is 6%, does it mean that all the goods you purchase will cost 6% more than previous year? Provide with reasoning.
Geetha Reply
Not necessarily. To measure the inflation rate economists normally use an averaged price index of a basket of certain goods. So if you purchase goods included in the basket, you will notice that you pay 6% more, otherwise not necessarily.
Waeth
discus major problems of macroeconomics
Alii Reply
what is the problem of macroeconomics
Yoal
Economic growth Stable prices and low unemployment
Ephraim
explain inflationcause and itis degre
Miresa Reply
what is inflation
Getu
increase in general price levels
WEETO
Good day How do I calculate this question: C= 100+5yd G= 2000 T= 2000 I(planned)=200. Suppose the actual output is 3000. What is the level of planned expenditures at this level of output?
Chisomo Reply
how to calculate actual output?
Chisomo
how to calculate the equilibrium income
Beshir
Criteria for determining money supply
Thapase Reply
who we can define macroeconomics in one line
Muhammad
Aggregate demand
Mohammed
C=k100 +9y and i=k50.calculate the equilibrium level of output
Mercy Reply
Hi
Isiaka
Hi
Geli
hy
Man
👋
Bahunda
hy how are you?
Man
ys
Amisha
how are you guys
Sekou
f9 guys
Amisha
how are you guys
Sekou
ys am also fine
Amisha
fine and you guys
Geli
from Nepal
Amisha
nawalparasi district from belatari
Amisha
nd u
Amisha
I am Camara from Guinea west Africa... happy to meet you guys here
Sekou
ma management ho
Amisha
ahile becheclor ho
Amisha
hjr ktm bta ho ani k kaam grnu hunxa tw
Amisha
belatari
Amisha
1st year ho
Amisha
nd u
Amisha
ahh
Amisha
kaha biratnagar
Amisha
ys
Amisha
kina k vo
Amisha
money as unit of account means what?
Kalombe
A unit of account is something that can be used to value goods and services and make calculations
Jim
all of you please speak in English I can't understand you're language
Muhammad
I want to know how can we define macroeconomics in one line
Muhammad
it must be .9 or 0.9 no Mpc is greater than 1 Y=100+.9Y+50 Y-.9Y=150 0.1Y/0.1=150/0.1 Y=1500
Kalombe
Mercy is it clear?😋
Kalombe
hi can someone help me on this question If a negative shocks shifts the IS curve to the left, what type of policy do you suggest so as to stabilize the level of output? discuss your answer using appropriate graph.
Galge Reply
if interest rate is increased this will will reduce the level of income shifting the curve to the left ◀️
Kalombe
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Accessible physics concepts for blind students. OpenStax CNX. Oct 02, 2015 Download for free at https://legacy.cnx.org/content/col11294/1.36
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Accessible physics concepts for blind students' conversation and receive update notifications?

Ask