How to calculate sin(alpha) = a in Python?

时间:2019-01-23 01:00:35

标签: python-3.x math

How can I calculated the angle in formula: sin(alpha) = a if I known a before.

Like example: sin(alpha) = 0.021 => alpha ?

Anybody can help me code the script to find out alpha value (angle)?

Thanks!

1 个答案:

答案 0 :(得分:1)

这可以通过Math模块完成。这是代码:

import math
# To calculate 90 radian
a = math.sin(90*(math.pi)/180)
print(a)
# 1.0
b = math.asin(1.0)*180/(math.pi)
print(b)
# 90.0

有效。