views:

631

answers:

3

at http://www.teacherschoice.com.au/Maths%5FLibrary/Trigonometry/solve%5Ftrig%5FSSS.htm there is "Find the inverse cos of -0.25 using a scientific calculator...C = cos-1(-0.25)= 104.478º " and "Find the inverse sin of 0.484123 using a scientific calculator...A = sin-1(0.484123)= 28.955º "

I am trying to do this in c# , so i am trying the following

        double mycalc =   Math.Asin(0.484123)  ;
        double mycalc2 = Math.Acos(-0.25);
        double mycalc99 = Math.Pow(Math.Acos(-0.25), -1);  // or Math.Cos
        double mycalc66 =  Math.Pow(Math.Asin(0.484123), -1) ;  // or Math.Sin

What steps am I missing?
Should I use DegreeToRadian function ?

Using calculator net scientific-calculator.html

0.484123 asin does equal 28.955029723
-0.25 acos does equal 104.47751219

So what is missing in c# calc, please ?

Thanks

+5  A: 

According to the documentation, Asin and Acos definitely return in radians.

Multiply the return value by 180/ Math.PI to convert from radians to degrees.

Greg
+12  A: 
  • cos-1 means the inverse function of cos. It does not mean cos raised to the power -1. (similar thing with sin) (more info)
  • Asin and Acos return the angle in Radians, you have to convert it to Degrees.

You should use :

double mycalcInRadians = Math.Asin(0.484123);
double mycalcInDegrees = mycalcInRadians * 180 / Math.PI;
Aziz
+1 for pointing out the conceptual mistake shown by use of Pow()
JeffH
A: 

Yes, After a sleep it became obvious. I needed RadianToDegree.

    private double DegreeToRadian(double angle)
    {
        return Math.PI * angle / 180.0;
    }
    private double RadianToDegree(double angle)
    {
        return angle * (180.0 / Math.PI);
    }

Thankyou for your help.

john
I think you should mark Aziz answer as Accepted Answer.
Salamander2007