Python 数学模块显示完全错误的结果?
Python math module shows completely wrong results?
我不知道我做错了什么。
from math import *
# triangle Law of Sines test:
a = float(3)
b = float(3)
c = 4.24264
A = float(45)
B = float(45)
C = float(90)
# it should be equal to the diameter of the triangle's
# ...circumcircle when convert radians to degrees (2.12132) :
print a /sin(A)
print c /sin(C)
# and just test angles :
print degrees( sin( float(45) ) ) # 'SHOULD BE 2.8284'
print degrees( sin( float(90) ) ) # 'SHOULD BE 1'
...以及打印输出:
>> 3.52566408941
>> 4.74570003753
>> 48.7531807286
>> 51.2222357231
您应该执行以下操作:
sin(radians(90))
radians
将给定的角度从度数转换为 弧度 ,并且由于 sin
需要 radians
,现在它应该像您一样打印 1预期。
我不知道我做错了什么。
from math import *
# triangle Law of Sines test:
a = float(3)
b = float(3)
c = 4.24264
A = float(45)
B = float(45)
C = float(90)
# it should be equal to the diameter of the triangle's
# ...circumcircle when convert radians to degrees (2.12132) :
print a /sin(A)
print c /sin(C)
# and just test angles :
print degrees( sin( float(45) ) ) # 'SHOULD BE 2.8284'
print degrees( sin( float(90) ) ) # 'SHOULD BE 1'
...以及打印输出:
>> 3.52566408941
>> 4.74570003753
>> 48.7531807286
>> 51.2222357231
您应该执行以下操作:
sin(radians(90))
radians
将给定的角度从度数转换为 弧度 ,并且由于 sin
需要 radians
,现在它应该像您一样打印 1预期。