<< Chapter < Page Chapter >> Page >

Display the results

Finally Listing 2 calls the document.write method several times in succession to display the values stored in some of the variables mentioned above in thebrowser window as shown in Figure 12 . As you can see, the magnitude and angle of the resultant agrees with the estimate that I made using the graphic methodearlier.

Subtracting vectors

To subtract one vector from another using the mathematical approach, simply reverse the algebraic sign on the horizontal and vertical components for thesubtrahend vector and perform the addition shown in Listing 2 .

Adding more than two vectors

Let's work through a problem that requires the addition of four vectors.

A graphical solution

First I would like for you to lay out the vectors, tail-to-head on your graph board to create a solution to this problem.

Pretend that you take a walk consisting of the following sequential segments. Angles are specified relative to east with east being zero degrees. Positiveangles are counter-clockwise and negative angles are clockwise.

The segments are as follows:

  • 12 meters at 20 degrees
  • 8 meters at 120 degrees
  • 10.5 meters at -74 degrees
  • 12.5 meters at 145 degrees

What is your final displacement?

When you reach the end of the walk, what is your displacement (distance and direction) relative to the location at which you began the walk. You shouldbe able to do a reasonable job of measuring the displacement using your graph board.

A mathematical solution

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

Listing 3 . The sum of four vectors.
<!-- File JavaScript03.html --><html><body><script language="JavaScript1.3">//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//Specify the magnitudes and angles of four vectors. //Convert the angles from degrees to radians.var vecAmag = 12; var vecAang = 20*Math.PI/180;//degrees*radians/degrees=radiansvar vecBmag = 8; var vecBang = 120*Math.PI/180;//degrees*radians/degrees=radiansvar vecCmag = 10.5; var vecCang = -74*Math.PI/180;//degrees*radians/degrees=radiansvar vecDmag = 12.5; var vecDang = 145*Math.PI/180;//degrees*radians/degrees=radians//Compute the horizontal and vertical components of each vector. var vecAh = vecAmag*Math.cos(vecAang);var vecAv = vecAmag*Math.sin(vecAang); var vecBh = vecBmag*Math.cos(vecBang);var vecBv = vecBmag*Math.sin(vecBang); var vecCh = vecCmag*Math.cos(vecCang);var vecCv = vecCmag*Math.sin(vecCang); var vecDh = vecDmag*Math.cos(vecDang);var vecDv = vecDmag*Math.sin(vecDang); //Compute the sums of the horizontal and vertical components from// the four vectors to get the horizontal and vertical component // of the resultant vector.var vecResultH = vecAh + vecBh + vecCh + vecDh; var vecResultV = vecAv + vecBv + vecCv + vecDv;//Use the Pythagorean theorem to compute the magnitude of the// resultant vector. var vecResultMag = Math.sqrt(Math.pow(vecResultH,2) +Math.pow(vecResultV,2)); //Compute the angle of the resultant vector.vecResultAng = getAngle(vecResultH,vecResultV); document.write("Hello from JavaScript" + "</br>") document.write("vecResultMag = " + vecResultMag.toFixed(2) + "</br>"); document.write("vecResultAng = " + vecResultAng.toFixed(2) + "</br>"); document.write("The End")</script></body></html>

Questions & Answers

how does Neisseria cause meningitis
Nyibol Reply
what is microbiologist
Muhammad Reply
what is errata
Muhammad
is the branch of biology that deals with the study of microorganisms.
Ntefuni Reply
What is microbiology
Mercy Reply
studies of microbes
Louisiaste
when we takee the specimen which lumbar,spin,
Ziyad Reply
How bacteria create energy to survive?
Muhamad Reply
Bacteria doesn't produce energy they are dependent upon their substrate in case of lack of nutrients they are able to make spores which helps them to sustain in harsh environments
_Adnan
But not all bacteria make spores, l mean Eukaryotic cells have Mitochondria which acts as powerhouse for them, since bacteria don't have it, what is the substitution for it?
Muhamad
they make spores
Louisiaste
what is sporadic nd endemic, epidemic
Aminu Reply
the significance of food webs for disease transmission
Abreham
food webs brings about an infection as an individual depends on number of diseased foods or carriers dully.
Mark
explain assimilatory nitrate reduction
Esinniobiwa Reply
Assimilatory nitrate reduction is a process that occurs in some microorganisms, such as bacteria and archaea, in which nitrate (NO3-) is reduced to nitrite (NO2-), and then further reduced to ammonia (NH3).
Elkana
This process is called assimilatory nitrate reduction because the nitrogen that is produced is incorporated in the cells of microorganisms where it can be used in the synthesis of amino acids and other nitrogen products
Elkana
Examples of thermophilic organisms
Shu Reply
Give Examples of thermophilic organisms
Shu
advantages of normal Flora to the host
Micheal Reply
Prevent foreign microbes to the host
Abubakar
they provide healthier benefits to their hosts
ayesha
They are friends to host only when Host immune system is strong and become enemies when the host immune system is weakened . very bad relationship!
Mark
what is cell
faisal Reply
cell is the smallest unit of life
Fauziya
cell is the smallest unit of life
Akanni
ok
Innocent
cell is the structural and functional unit of life
Hasan
is the fundamental units of Life
Musa
what are emergency diseases
Micheal Reply
There are nothing like emergency disease but there are some common medical emergency which can occur simultaneously like Bleeding,heart attack,Breathing difficulties,severe pain heart stock.Hope you will get my point .Have a nice day ❣️
_Adnan
define infection ,prevention and control
Innocent
I think infection prevention and control is the avoidance of all things we do that gives out break of infections and promotion of health practices that promote life
Lubega
Heyy Lubega hussein where are u from?
_Adnan
en français
Adama
which site have a normal flora
ESTHER Reply
Many sites of the body have it Skin Nasal cavity Oral cavity Gastro intestinal tract
Safaa
skin
Asiina
skin,Oral,Nasal,GIt
Sadik
How can Commensal can Bacteria change into pathogen?
Sadik
How can Commensal Bacteria change into pathogen?
Sadik
all
Tesfaye
by fussion
Asiina
what are the advantages of normal Flora to the host
Micheal
what are the ways of control and prevention of nosocomial infection in the hospital
Micheal
what is inflammation
Shelly Reply
part of a tissue or an organ being wounded or bruised.
Wilfred
what term is used to name and classify microorganisms?
Micheal Reply
Binomial nomenclature
adeolu
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