Inverse of Tan in python (tan-1)

断了今生、忘了曾经 提交于 2019-12-19 05:03:49

问题


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?


回答1:


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



回答2:


you can simply multiply the radians by 180/pi. No need of importing ;)




回答3:


>>>from math import *
>>>degrees(atan(1.18))
>>>49.720136931043555


来源:https://stackoverflow.com/questions/10057854/inverse-of-tan-in-python-tan-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!