Inverse Sine Calculation

G

Guest

*
32 * * .5
* X *
***********

I have a triangle with a Hypotenuse of 32 and height of .5. I am trying to
determine what angle X is. On a calculator I take .5/32 = .015625
The inverse sine on a calculator gives the angle of X at .895282987.
How do I replicate this in C# code?

Thanks in advance - Dan
 
O

Oliver Sturm

Dan said:
*
32 * * .5
* X *
***********

I have a triangle with a Hypotenuse of 32 and height of .5. I am trying to
determine what angle X is. On a calculator I take .5/32 = .015625
The inverse sine on a calculator gives the angle of X at .895282987.
How do I replicate this in C# code?

My maths is a bit rusty :) But I'm sure it should work like this:

double radians = Math.ASin(0.5/32);
double degrees = radiansASine * 180 / Math.PI;

The reason is that the .NET Math functions calculate in radians, so you
have to convert the values. Most calculators have "Deg" and "Rad" modes,
so they do this automatically.


Oliver Sturm
 
J

Jon Skeet [C# MVP]

Dan said:
*
32 * * .5
* X *
***********

I have a triangle with a Hypotenuse of 32 and height of .5. I am trying to
determine what angle X is. On a calculator I take .5/32 = .015625
The inverse sine on a calculator gives the angle of X at .895282987.
How do I replicate this in C# code?

See Math.Asin.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top