I’m currently trying to get something to run involving trigonometry but I’ve run across a hitch involving the math.asin function (it also applies to acos and atan but in those cases it less affects what I’m trying to do). The issue is best summarised by two posts from a help thread I found about it elsewhere;
Sorry, I have just tried it again and
found thata = sin(2)
b = asin(a)
b doesnt = 2but
a = cos(2)
b = acos(a)
b DOES= 2Because y = sin(x) is a repetitive
function, there is more than one value
of x for every value of y. ie sin(2) =
sin(1.14) = 0.909Therefore, when you do x = asin(y),
you will only ever get a value between
-PI/2 <= x <= PI/2
I understand mathematically why this is but I was wondering if anyone could give me a hand in finding all the solutions within a range rather than just the one it gives automatically. Thanks =]
Let’s consider the range [0, 2π).
For
acos, each value x also has another possible value at 2π – x. (Picture the cosine graph and you’ll see it.)For
asin, each positive value x has another possible value at π – x; each negative value has a possible value at 3π – x.Feel free to draw further graphs to generalise to greater ranges. 🙂