【发布时间】:2017-03-27 13:01:40
【问题描述】:
我正在为我的大学期末作业制定一个计划。这是一种计算无人机手臂厚度的算法。 我在 SageMath 上做了表达式,用 Python 开发
import math
import matplotlib.pyplot as plt
import pylab
F=float((2*9.81)/4)
S=float(1.5) #coeficiente de segurança
Tensrup=float(4.1575e+7) #Tensão de ruptura
T=Tensrup/S #Tensão adm (que foi multiplicada por 1.1)
r=float(0.75*10**-3) #raio interior
b=range(1, 1000)
L=[x*10**-3 for x in b] #*10**⁻3 is a unity conversion
R=[]
for l in L:
R.append(1/10000*math.sqrt(1/3)*math.sqrt((75000000*(6050000000/98695877281*F**2*L**2*S**2/T**2 + 1/37010953980375000000000*math.sqrt(5147226562500000000000000000000000000000000*F**4*L**4*S**4 + 9740876192266211952961/3*T**4)/T**2)**(2/3) - 1)/(6050000000/98695877281*F**2*L**2*S**2/T**2 + 1/37010953980375000000000*math.sqrt(5147226562500000000000000000000000000000000*F**4*L**4*S**4 + 9740876192266211952961/3*T**4)/T**2)**(1/3)) + 1/2*math.sqrt(3300000000/314159*math.sqrt(1/3)*F*L*S/(T*math.sqrt((75000000*(6050000000/98695877281*F**2*L**2*S**2/T**2 + 1/37010953980375000000000*math.sqrt(5147226562500000000000000000000000000000000*F**4*L**4*S**4 + 9740876192266211952961/3*T**4)/T**2)**(2/3) - 1)/(6050000000/98695877281*F**2*L**2*S**2/T**2 + 1/37010953980375000000000*math.sqrt(5147226562500000000000000000000000000000000*F**4*L**4*S**4 + 9740876192266211952961/3*T**4)/T**2)**(1/3))) - (6050000000/98695877281*F**2*L**2*S**2/T**2 + 1/37010953980375000000000*math.sqrt(5147226562500000000000000000000000000000000*F**4*L**4*S**4 + 9740876192266211952961/3*T**4)/T**2)**(1/3) + 1/75000000/(6050000000/98695877281*F**2*L**2*S**2/T**2 + 1/37010953980375000000000*math.sqrt(5147226562500000000000000000000000000000000*F**4*L**4*S**4 + 9740876192266211952961/3*T**4)/T**2)**(1/3)))
plot = plt.figure(1)
plt.plot(L,R)
plt.ylabel("Raio exterior (m)")
plt.xlabel("Largura do braço (m)")
plt.title("Dimensionamento dos braços", fontweight='bold')
plt.grid(True)
plt.tight_layout()
pylab.show()
我想创建一个在 1 和 1000 之间变化的长度 (L)(然后我乘以 10⁻3 以转换为毫米)并逐点计算以查看手臂的最佳长度。 当我运行它时,我收到此错误
The debugged program raised the exception unhandled TypeError
"unsupported operand type(s) for ** or pow(): 'list' and 'int'" File:
/home/zanetti/Documents/Python/DRone.py, Line: 14
我是一名爱好者和代码初学者。我已经用列表和数组尝试了一些东西,但事实是我几乎什么都不懂=/
【问题讨论】:
标签: list python-3.x int