我一直在尝试为这个函数编写代码,但我无法asin
在 python 2.7 中工作。任何想法为什么?
import math
from decimal import *
def main():
H = raw_input ("Please enter hight:")
H = int(float(H))
m = raw_input ("Please enter crest thickness:")
m = int(float(m))
n = raw_input ("Please enter base thikness:")
n = int(float(n))
Fx = 0.0
Fy = 0.0
Magnitude = 0.0
Direction = 0.0
p = 1000 #dencity
g = 9.81 #gravity
R = math.sqrt(H*H + n*n)
#Force in x direction
Fx = (-p*g*m*(H*H))/2.0
#Force in y direction
Fy = -p*g*R*(((math.asin(n/H))/2.0)-sin((2*math.asin(n/H))/4.0))
#Overall force
Direction = math.atan(Fy/Fx)
Magnitude = sqrt(Fx*Fy + Fy*Fy)
print ("The force magnitude is", Magnitude)
print ("The force direction is", Direction)