inverse of cosine

G

Guest

How do I get the inverse of a cosine, that is, cos(a) = x, I have x and I need to know a? I don't
need the hyperbolic inverse, unless I can use it to get the cosine inverse.

Greetings,
Mario
 
G

Guest

The confusing part is that acos(x) = a returns in the range [0,pi]. But a is in [0,2*pi]! Is acos really the
inverse of cos? The circle has 360 degrees - not 180.

Greetings,
Mario
 
C

Carl Daniel [VC++ MVP]

Mario said:
The confusing part is that acos(x) = a returns in the range [0,pi].
But a is in [0,2*pi]! Is acos really the inverse of cos? The circle
has 360 degrees - not 180.

No, it's not really the inverse, since there really isn't an inverse of cos
(or any of the trigonometric transcendentals) over an unbounded range of
theta. acos returns an angle in the 1st or 2nd quadrant that satisfies the
relationship cos(acos(x)) == x. (Of course, being floating point, it may
not be exactly equal). If your angle is in the 3rd or 4th quadrants, you
need to make the necessary adjustment yourself. For instance, if you know
both the sine and the cosine of the original angle, you can use
atan2(sin_theta,cos_theta) to recover an angle in the full circle.

-cd
 
G

Guest

Makes no sense. acos takes input in the full output range of cos(a) [-1,1]. How can acos take the full range, satisfy your equality (subject to floating point errors) and only be a "partial" two-quadrant solution? Can an angle be negative? No. Why would acos return angles in the 3rd and 4th quadrant? a in cos(a) is always positive. So [0,pi] makes sense to be the
range of the inverse?

Greetings,
Mario
 
C

Carl Daniel [VC++ MVP]

Mario said:
Makes no sense. acos takes input in the full output range of cos(a)
[-1,1]. How can acos take the full range, satisfy your equality
(subject to floating point errors) and only be a "partial"
two-quadrant solution?

Because cos varies from 1 to -1 in quadrants 1 and 2, and from -1 to 1 in
quadrants 3 and 4.
Can an angle be negative?

Yes, absolutely.
No. Why would acos
return angles in the 3rd and 4th quadrant? a in cos(a) is always
positive. So [0,pi] makes sense to be the range of the inverse?

Think about it more. In the full circle there are two angles with any given
value of cos (except for 1 and -1 which only occur at 0 and pi) therefore
cos in the mathematical sense is not inversible.

Think about a cosine wave along the y-axis. What's Y as a function of X?
Clearly there is no such function since there are an infinite number of Y's
for any given X.

So, there's no complete inverse for cos (or sin), but any interval of pi
radians defines the entire function (in fact, an interval of pi/2 radians
defines the entire relationship due to symmetry). The designers of acos
could just as well have picked -pi/2 .. pi/2 as the interval rather than 0
... pi.

In fact, if you look at hardware implementations of sin/cos, it's typical
that they only implement the first-quadrant and rely on software to compute
the other quadrants using symmetry.

-cd
 

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

Similar Threads

inverse cosine 4
Excel Inverse Fft 0
Calculator in C# 1
Trigonometry 1
Cosine of 90 degrees 6
Cosine Function Returns Wrong Answer! 15
FINDING INVERSE TANGENT 1
Inverse DFT 2

Top