Inverse of Tan in python (tan-1)

user1294592 picture user1294592 · Apr 7, 2012 · Viewed 81k times · Source

I am trying to calculate the inverse of tan in python, but it does not give me the correct value, for example, if I were to do the inverse tan of 1.18, math.atan(1.18)

>>>math.atan(1.18)
0.8677

However, the correct answer is 49.720136931. What is the correct way to do than?

Answer

George picture George · Apr 7, 2012

math.atan(x) returned in radian, if you want degree, convert it using math.degrees(x)

Converts angle x from radians to degrees.

>>> import math
>>> math.degrees(math.atan(1.18))
49.720136931043555