differential-equations

Lorenz attractor with Runge-Kutta python

时光怂恿深爱的人放手 提交于 2020-12-15 13:19:23
问题 Hello I have to program a python function to solve Lorenz differential equations using Runge-Kutta 2cond grade sigma=10, r=28 and b=8/3 with initial conditions (x,y,z)=(0,1,0) this is the code i wrote, but it throws me an error saying overflow encountered in double_scalars , and I don't see what is wrong with the program from pylab import * def runge_4(r0,a,b,n,f1,f2,f3): def f(r,t): x=r[0] y=r[1] z=r[2] fx=f1(x,y,z,t) fy=f2(x,y,z,t) fz=f3(x,y,z,t) return array([fx,fy,fz],float) h=(b-a)/n