Reputation: 3
I'm working on an program to my final work on college. It is a algorithm to calculate the thickness of an drone arm. I done the expression on SageMath and developed in 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()
I want to creat a lenght (L) that varies btween 1 and 1000 (then I multiply for 10⁻3 to transform in mm) and avaliate point by point to see the optimal lenght of the arm. When I run it, I recieve this error
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
I'm an enthusiast and a code beginner. I've have already tried something with lists and arrays, but the truth is that I didn't understand almost nothing =/
Upvotes: 0
Views: 4393
Reputation: 140186
you're looping on elements of L
as l
but you're using L
in your big compulation line, whereas you should use l
Which means that at some point the interpreter stumbles on L**2
which is a list elevated to 2nd power, which has no meaning in python.
Advice: avoid variables bearing the same name and which only differ by case. Improving the naming your variables will save you a lot of trouble.
Upvotes: 1