Dans la cadre de mon TIPE j'ai besoin de tracer la courbe d'une fonction, voici mon code :
vtm=sqrt((2*m*g)/rho*S) # je défini les variables
tap=to+(vtm/g)*atan(vo/vtm)
hap=ho+((vtm**2)/2*g)*log(1+(vo/vtm)**2)
def position(t):
return hap-((vtm**2)/g)*log(cosh(g*(tap-t)/vtm))
x=np.linspace(0,a,1000)
y=position(x)
plt.plot(x,y)
plt.show()
et à chaque fois ça me renvoit :
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "G:\TIPE\Optimisation fusée à eau.py", line 50, in position
return hap-((vtm**2)/g)*log(cosh(g*(tap-t)/vtm))
TypeError: only length-1 arrays can be converted to Python scalars
J'ai remarqué que c'est la ligne " y=position2(x)" qui faisait planter le code mais je ne comprend pas pourquoi :/