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