python - solving autonomous ODE -
i trying solve autonomous ode system using scipy ode. code has no syntax mistake cannot give correct answer. gives,
/users/daoyuan/library/enthought/canopy_64bit/user/lib/python2.7/site-packages/scipy/integrate/_ode.py:741: userwarning: vode: illegal input detected. (see printed message. 'unexpected istate=%s' % istate))
here code
from numpy import* scipy.integrate import ode def autonomous_function(y,t): y1=y[0] y2=y[1] dy1=y1**2*y2-4*y1+1 dy2=3*y1-y1**2*y2 return [y1,y2] t0=0 y10=0 y20=0 t_final=1 dt=1/10 solver=ode(autonomous_function) solver.set_integrator('vode') solver.set_initial_value([y10,y20],t0) y_result=[] t_output=[] y_result.append([y10,y20]) t_output.append(t0) while solver.successful() , solver.t<t_final: solver.integrate(solver.t+dt) y_result.append(solver.y) t_output.append(t_output) y_result=array(y_result) t_output=array(t_output) y_result
Comments
Post a Comment