Python 不支持的操作数类型';非类型';

Python 不支持的操作数类型';非类型';,python,math,Python,Math,我对Python非常陌生,我正在尝试创建一个计算一系列方程式的软件,但我一直遇到一个错误 代码如下: import math x_i = 1 dt = 0.01 k = 11.5 r_out = 0.889 w = 0.03175 dL = 30 m = float(input("Enter m: ")) v_i = float(input("Enter v_i: ")) t = [0] x = [x_i] v = [v_i] Fc = [] whi

我对Python非常陌生,我正在尝试创建一个计算一系列方程式的软件,但我一直遇到一个错误

代码如下:

import math

x_i = 1
dt = 0.01
k = 11.5
r_out = 0.889
w = 0.03175
dL = 30
m = float(input("Enter m: "))
v_i = float(input("Enter v_i: "))

t = [0]
x = [x_i]
v = [v_i]
Fc = []

while (v_i > 0):
 
    Fc.append(k*v_i**2*math.cos(math.atan(30/x_i)))/2*(math.sqrt(r_out**2-(w/math.pi)*math.sqrt(x_i**2+dL**2)))
    x.append(x_i+v_i*Dr+0.5*(-Fc_I/m)*dt)
    v.append(v_i-(k*v_i**2*math.cos(math.atan(30/x_i)))/2*(math.sqrt(r_out**2-(w/math.pi)*math.sqrt(x_i**2+dL**2))))
    v_i = v_i + 1
    t.append(dt*(t+1))
我的目标是,代码运行这些方程,直到
v_i
等于
0
,同时用相关结果填充列表,然后在while循环完成后将所有信息放入图形中

但是,在插入
m
v_i
之后,我得到一个错误,上面写着:

line 19, in <module>
    FC.append(k*v_i**2*math.cos(math.atan(30/x_i)))/2*(math.sqrt(r_out**2-(w/math.pi)*math.sqrt(x_i**2+dL**2)))
TypeError: unsupported operand type(s) for /: 'NoneType' and 'int'
第19行,在
FC.追加(k*v_i**2*math.cos(math.atan(30/x_i)))/2*(math.sqrt(r_out**2-(w/math.pi)*math.sqrt(x_i**2+dL**2)))
TypeError:/:“NoneType”和“int”的操作数类型不受支持
我现在有点卡住了,我似乎不知道如何修复这个错误。

这行:

C.append(k*v_i**2*math.cos(math.atan(30/x_i)))/2*(math.sqrt(r_out**2-(w/math.pi)*math.sqrt(x_i**2+dL**2)))
您将向
C
追加一个值,然后在
append()
调用中使用
/
运算符

list.append()
返回
None
,因此出现错误。请尝试以下方法:

C.append(k*v_i**2*math.cos(math.atan(30/x_i))/2*(math.sqrt(r_out**2-(w/math.pi)*math.sqrt(x_i**2+dL**2))))

建议注意:

这一行:

C.append(k*v_i**2*math.cos(math.atan(30/x_i)))/2*(math.sqrt(r_out**2-(w/math.pi)*math.sqrt(x_i**2+dL**2)))
您将向
C
追加一个值,然后在
append()
调用中使用
/
运算符

list.append()
返回
None
,因此出现错误。请尝试以下方法:

C.append(k*v_i**2*math.cos(math.atan(30/x_i))/2*(math.sqrt(r_out**2-(w/math.pi)*math.sqrt(x_i**2+dL**2))))

建议注意:


在将圆括号除以2之前关闭圆括号,这将导致
NoneType

将线路更换为-

Fc.append(k*v_i**2*math.cos(math.atan(30/x_i))/2*(math.sqrt(r_out**2-(w/math.pi)*math.sqrt(x_i**2+dL**2)))

在将圆括号除以2之前关闭圆括号,这将导致
NoneType

将线路更换为-

Fc.append(k*v_i**2*math.cos(math.atan(30/x_i))/2*(math.sqrt(r_out**2-(w/math.pi)*math.sqrt(x_i**2+dL**2)))

t
为列表时,变量
Dr
Fc_I
未定义且
t+1
为语法错误当
t
为列表时,变量
Dr
Fc_I
未定义且
t+1
为语法错误