math.sin() 没有返回正确的值
math.sin() not returning proper value
你好,我有一个方程式,我正在尝试使用 python 来计算。在哪里
我正在寻找的所需输出是 1.71528
下面是我当前的代码,其中所有当前值 d 应等于 100,theta 应等于 60。
import math
m = 0.065
g = 9.8
print("Input the distance to professor")
d = 100 # float(input())
k = 25
print("Now input the value for theta")
theta = 60 # float(input())
x = math.sqrt(m*g*d/k*math.sin(2 * theta))
print(x, 'meters')
我 运行 这段代码得到的输出是 1.2163047715819324 meters
我认为我的问题是 math.sin 任何帮助将不胜感激。
将 theta 转换为弧度并将分母括起来。
x = math.sqrt(m*g*d/(k*math.sin(2 * math.radians(theta))))
print(f"{x:.5f} meters")
将导致
Input the distance to professor
100
Now input the value for theta
60
1.71528 meters
你好,我有一个方程式,我正在尝试使用 python 来计算。在哪里
我正在寻找的所需输出是 1.71528
下面是我当前的代码,其中所有当前值 d 应等于 100,theta 应等于 60。
import math
m = 0.065
g = 9.8
print("Input the distance to professor")
d = 100 # float(input())
k = 25
print("Now input the value for theta")
theta = 60 # float(input())
x = math.sqrt(m*g*d/k*math.sin(2 * theta))
print(x, 'meters')
我 运行 这段代码得到的输出是 1.2163047715819324 meters
我认为我的问题是 math.sin 任何帮助将不胜感激。
将 theta 转换为弧度并将分母括起来。
x = math.sqrt(m*g*d/(k*math.sin(2 * math.radians(theta))))
print(f"{x:.5f} meters")
将导致
Input the distance to professor
100
Now input the value for theta
60
1.71528 meters