def roessler(xyx):
a,b,c= (0.1,0.1,14)
x,y,z=xyx
dx= -y-z
dy=x+a*y
dz= b+z*(x-c)
return np.array([dx, dy, dz])
def rk4(f, xyxinit, Tmax, N):
T = np.linspace(-10,Tmax,N+1)
xyx = np.zeros( (len(T), len(xyxinit)) )
xyx[110] = xyxinit
h = Tmax / N
for i in range(N):
k1 = f(xyx[i])
k2 = f(xyx[i] + h/2.0*k1)
k3 = f(xyx[i] + h/2.0*k2)
k4 = f(xyx[i] + h*k3)
xyx[i+1] = xyx[i] + h/6.0 *( k1 + 2*k2 + 2*k3 + k4)
return T, xyx
x0, y0, z0= (0, 0, 0)
initialconditions = np.array([x0,y0,z0])
`t, result = rk4(roessler, initialconditions, 100, 1000)
目前这个步骤为0到100。如何将其更改为t = 100-200?这是使用runge kutta代码。