C # and scientific calculation

at http://www.teacherschoice.com.au/Maths_Library/Trigonometry/solve_trig_SSS.htm There is "Find inverse cos -0.25 using scientific calculator ... C = cos-1 (-0.25) = 104.478ΒΊ" and "Find Reverse Sin 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 the DegreeToRadian function?

Using the net science-calculator.html calculator

0.484123 asin is 28.955029723
-0.25 acos is 104.47751219

So what's missing in C # calc please?

thank

+2


source to share


3 answers


  • cos

    -1 means inverse function cos

    . It doesn't mean cos

    raised to power -1

    . (similar thing to sin

    ) ( more )
  • Asin

    and Acos

    return the angle to Radians , you must convert it to Degrees .

You must use:



double mycalcInRadians = Math.Asin(0.484123);
double mycalcInDegrees = mycalcInRadians * 180 / Math.PI;

      

+19


source


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.

+7


source


Yes, after sleeping it became obvious. I need RadianToDegree.

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

      

Thank you for your help.

0


source







All Articles