wanna make a function which solve a differential equation which only implies first and second derivative so I solved for the the first derivative with odeint and then take the integral with trapeze method but my code is not running and python shows up "setting an array element with a sequence" error :
here is my code :
def trapeze (tableau,a,b) :
S=0
for k in range (1,b) :
S+= (tableau[k])
return((S+((tableau[0]+tableau[b-1])/2))/b)
def position (i,f) :
values= []
arg=30
for k in range (0,1000) :
temps=np.linspace(i+0.001*k ,i+0.001*(k+1) , 1000)
sol = odeint(F,[arg,0,0], temps)
resx = sol[ :, 0]
values.append (trapeze(resx,0,1000))
arg = sol[999]
return(values)
Any help to solve this issue would be very helpful for me !
I expect the function to return an Array which contain numeric values of the differential equation.