Solved

Posted on 2005-05-13

I am attempting to find the angle of a triangle based on the length of the sides. I have no knowledge of any angles of the triangle.

I am using the equation: b^2 = a^2 + c^2 - 2ac cos B

where ^ denotes power of

B is the angle I am trying to find

b is the length of the side opposite B

a and c are the lengths of th other two sides.

So, if I have the data; b = 5, c = 4, a = 6

25 = 16 + 36 - 2*4*6 cos B

=> 25 = 52 - 48 cos B

=> 48 cos B = 27

=> cos B = 27/48

=> cos B = 0.5625

Is there a method to find B on its own? i.e. inverse of cos B?

I am using the equation: b^2 = a^2 + c^2 - 2ac cos B

where ^ denotes power of

B is the angle I am trying to find

b is the length of the side opposite B

a and c are the lengths of th other two sides.

So, if I have the data; b = 5, c = 4, a = 6

25 = 16 + 36 - 2*4*6 cos B

=> 25 = 52 - 48 cos B

=> 48 cos B = 27

=> cos B = 27/48

=> cos B = 0.5625

Is there a method to find B on its own? i.e. inverse of cos B?

14 Comments

double angle = 45;

double cos;

cos = Math.cos(angle);

angle = Math.acos(cos);

System.out.println(cos);

System.out.println(angle);

The println on angle at the end does not print out 45

The result is given in radians. You need Math.toDegrees

Exactly.

From the docs:

acos returns the arc cosine of an angle, in the range of 0.0 through pi.

But as the doc says:

The conversion from radians to degrees is generally inexact;

Users should not expect cos(toRadians(90.0)) to exactly equal 0.0.

By clicking you are agreeing to Experts Exchange's Terms of Use.

Title | # Comments | Views | Activity |
---|---|---|---|

static method overriding vs normal non static method overriding in child class | 13 | 64 | |

Problem to setup | 18 | 65 | |

Convert ArrayList of custom objects to JSON | 4 | 44 | |

What is JNDI datasource in spring | 1 | 18 |

This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

Join the community of 500,000 technology professionals and ask your questions.

Connect with top rated Experts

**13** Experts available now in Live!