Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.

Thread: Dumb Question (cos^-1)

1. Dumb Question (cos^-1)

I'm just playing with Python 2.3, trying to get re-acquainted, and i've come across an extremely dumb problem, I don't know how to un-cosine (?) an angle on anything other than my calculator

I'm just writing something to solve some simple geometry (yeah, I'm pretty bored...), and when writing something to solve the formula:

cos (angle) = (a.b) / (|a|*|b|)

I can't get the angle because I don't know any function in any language equivalent to what cos^-1 would do on my calculator

Anybody know how to do it?

• Well, I don't know python but I can help you out some. You are trying to do the inverse cosine. If there isn't a inverse cosine function in python, this might help you out some:

x=cos(y) is the same as y=cos^-1(x)

• The "official" name is arccosine. So look for functions like with names like acos(), or arccos() (look also for asin(), atan(), since sometimes the arc-functions aren't complete and only one of the variants exists - because if you know the cosine of an angle you can calculate it's sine and tangent and use one of the other functions to get the angle). Also keep in mind that the result is probably in radians and not degrees.

shmoove

• Also keep in mind that the result is probably in radians and not degrees.
I thought it would be acos(), but I never even thought to check in the function ref whether the output was in degrees or radians :P

Thanks

•

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•