Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Implementing Trigonometric Inverse Functions in c#

I'm trying to implement inverse trigonometric functions in a C# application. Obviously I'm not talking about simple inverse sin, cos and tan seeing as those are all provided by the Math class. What I'm looking for is the inverses for sec, cosec and cotan:

Func<double,double> secant = (d => (1 / Math.Cos(d)));
Func<double,double> cosecant = (d => (1 / Math.Sin(d)));
Func<double,double> cotangent = (d => (Math.Cos(d) / Math.Sin(d)));

Now my problem is that I want to implement the inverses of each of these but I can't seem to find a simple definition of the appropriate inverses - arcsec, arccsc and arccot - which I can turn into C# code.

So my question is can you either (a) point me in the direction of a good resource or (b) show me some example code for this?

like image 378
RobV Avatar asked Jan 06 '10 17:01

RobV


People also ask

How do you use inverse trig functions in C?

C acos() The acos() function returns the arc cosine (inverse cosine) of a number in radians. The acos() function takes a single argument (1 ≥ x ≥ -1), and returns the arc cosine in radians. Mathematically, acos(x) = cos-1(x) .

How do you write sin inverse in C?

The asin() function returns the arc sine (inverse sine) of a number in radians. The asin() function takes a single argument (1 ≥ x ≥ -1), and returns the arc sine in radians. Mathematically, asin(x) = sin-1(x) .


1 Answers

Surely you jest:

asec(x) = acos(1 / x)
acsc(x) = asin(1 / x)
acot(x) = atan(1 / x)

:-P

like image 82
Chris Jester-Young Avatar answered Sep 19 '22 18:09

Chris Jester-Young