T
Typpo
Hi,
Maybe I'm missing something:
<begin code>
MessageBox.Show("a = " + a + ", b = " + c + ", c = " + c); //message 1
double top = (Math.Pow(a, 2) + Math.Pow(b, 2) - Math.Pow(c, 2));
double bottom = (2.0 * a * b);
MessageBox.Show("top = " + top + ", bottom = " + bottom); //message 2
return Math.Acos(top / bottom);
</end code>
Message 1 displays, "a = 15, b = 18.027..., c = 10".
Message 2 displays, "top = 450, bottom = 540.832...".
Which is all correct. The method itself returns 0.588, which leads me
to believe that Math.Acos is the wrong way to go about finding the
answer. On a TI-83 calculator, the functionality I'm looking for is
marked as cos^-1 (inverse cosine), which is right above the cos button.
The angle in question should be calculated as roughly 33.7 degrees.
What's wrong with the math?
Thanks.
Maybe I'm missing something:
<begin code>
MessageBox.Show("a = " + a + ", b = " + c + ", c = " + c); //message 1
double top = (Math.Pow(a, 2) + Math.Pow(b, 2) - Math.Pow(c, 2));
double bottom = (2.0 * a * b);
MessageBox.Show("top = " + top + ", bottom = " + bottom); //message 2
return Math.Acos(top / bottom);
</end code>
Message 1 displays, "a = 15, b = 18.027..., c = 10".
Message 2 displays, "top = 450, bottom = 540.832...".
Which is all correct. The method itself returns 0.588, which leads me
to believe that Math.Acos is the wrong way to go about finding the
answer. On a TI-83 calculator, the functionality I'm looking for is
marked as cos^-1 (inverse cosine), which is right above the cos button.
The angle in question should be calculated as roughly 33.7 degrees.
What's wrong with the math?
Thanks.