<< Chapter < Page | Chapter >> Page > |
The arccosine of an angle -- sample computation
Enter the following into the Google search box:
arccos(3/5) in degrees
The following will appear immediately below the search box:
arccos(3/5) = 53.1301024 degrees
This is the angle that corresponds to a ratio of the adjacent side to the hypotenuse of 3/5.
As you should expect. the computed angle is the same as before. We didn't change the angle, we simply computed it using a different approach.
Getting the angle using JavaScript
Please create an html file containing the code shown in Listing 4 and open it in your browser.
Listing 4 . Arccosine of 3-4-5 triangle. |
---|
<!-- File JavaScript04.html --><html><body><script language="JavaScript1.3">function toRadians(degrees){
return degrees*Math.PI/180}//end function toRadians
//============================================//function toDegrees(radians){
return radians*180/Math.PI}//end function toDegrees
//============================================//var adj = 3
var hyp = 5var ratio = adj/hyp
var angRad = Math.acos(ratio)var angDeg = toDegrees(angRad)
document.write("radians = " + angRad + "</br>")
document.write("degrees = " + angDeg)</script></body></html> |
Similar to a previous script
If you examine the code in Listing 4 carefully, you will see that it is very similar to the code in Listing 2 with a couple of exceptions:
The output
When you load your html file into your browser, it should produce the output shown earlier in Figure 5 . In other words, we know that the angle at the origin didn't change. What changed was the manner in which we computed the value ofthat angle.
Different approaches to the same solution
In Listing 2 , we used the length of the hypotenuse and the length of the opposite side, along with the arcsine method to compute the angle.
In Listing 4 , we used the length of the hypotenuse and the length of the adjacent side, along with the arccosine method to compute the angle.
Which approach should you use?
As would be expected, since the angle didn't change, both approaches produced the same result. Deciding which approach to use often depends onthe values that are available to use in the computation.
Sometimes you only have the lengths of the hypotenuse and the opposite side available, in which caseyou could use the arcsine. Sometimes you only have the lengths of the hypotenuse and the adjacent side available, in which case youcould use the arccosine. Sometimes you have the lengths of both the opposite side and the adjacent side in addition to thelength of the hypotenuse, in which case you can use either approach.
Both approaches use the length of the hypotenuse
It is important to note however that both of these approaches require you to have the length of the hypotenuse. Later in this module we will discuss thetangent and arctangent for an angle, which allows us to work with the opposite side and the adjacent side devoid of the length of the hypotenuse. (Of course, ifyou have the lengths of the opposite side and the adjacent side, you can always find the length of the hypotenuse using the Pythagorean theorem.)
Notification Switch
Would you like to follow the 'Contemporary math applications' conversation and receive update notifications?