0
我正在研究一個項目,以完成我在大學的最終工作。這是計算無人機手臂厚度的算法。 我做了SageMath表達和在Python「不支持的操作數類型爲**或pow():'list'和'int'」
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()
我想創造該btween 1和1000(然後我乘以用於10⁻3在毫米到變換)而變化的lenght(L)和avaliate點所開發指出看到手臂的最佳長度。 當我運行它,我收到此錯誤
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
我是一個愛好者和初學者的代碼。我已經嘗試使用列表和數組的東西,但事實是,我不明白幾乎沒有=/
+1表示最後一部分。認真。命名是困難的,但任何事情都比單字母的名字更好(除非也許我會編寫通用的,功能性的HOF)。具有描述性! – Carcigenicate
謝謝。我在回答「簡單」問題時嘗試添加一些內容。 –