python - "AttributeError: 'list' object has no attribute 'ravel'" -
i have system of differential equations , need calculate jacobian. code below throws attributeerror: 'list' object has no attribute 'ravel'. missing?
import numpy np import numdifftools ndt def rhs(z, t=0): x,y = z xdot = (x/5 + y)*(-x**2+1) ydot = -x*(-y**2+1) return [xdot, ydot] jfun = ndt.jacobian(rhs) jfun([1,1])
just do:
return np.array([xdot, ydot]) instead. should work...
Comments
Post a Comment