Ok, I am supposed to calculate the angle of a right triangle using Java. The measurements of the sides are a = 3 and b = 4 with the hypotenuse being c = 5. If I use Math.sin, it does not calculate the angle created by a and c. Is there another Math function I am not aware of? I have spent a long time trying to figure this out to no avail. Thanks in advance.
-
First calculate the angle by hand (with a scientific calculator). If you don't know how, you should ask a question on our sister site Mathematics.Code-Apprentice– Code-Apprentice2013-09-29 22:55:45 +00:00Commented Sep 29, 2013 at 22:55
-
1It is NOT 90 degrees.Dawood ibn Kareem– Dawood ibn Kareem2013-09-29 23:34:23 +00:00Commented Sep 29, 2013 at 23:34
Add a comment
|
2 Answers
To find the angle bounded by the side a and the side c, try using Math.toDegrees(Math.acos((double)a/c)). The passed value d to Math.acos(d) will have to be double.'Math.acos(d)' will give the arc cos in radian. Go through Math documentation
5 Comments
ajb
It depends on exactly which angle he wants, which isn't clear. If "the angle created by a and c" means "the angle bounded by the side a and the side c", then I think he needs
acos, not asin. But the wording isn't clear.user2829091
Yes, I meant I need to find the angle created by a and c.
Sage
@ajb Actually my intention was to respond for the question: If I use Math.sin, it does not calculate the angle created by a and c. Is there another Math function I am not aware of? so to create angle we use Math.asin(d) instead of Math.sin(d). His wording wasn't clear to me either.
user2829091
See, I thought asin was used to find the length of the arc created by the angle and radius. If asin is used to find the angle, what is used to find the arc?
Sage
it is ok. We caught your drift.:)