I am having some trouble with this question. I am given this system of equations
dx / dt = -y -z
dy / dt = x + a * y
dz / dt = b + z * (x - c)
and default values a=0.1, b=0.1, c=14 and also the Runge-Kutta algorithm:
def rk4(f, xvinit, Tmax, N):
T = np.linspace(0,Tmax,N+1)
xv = np.zeros( (len(T), len(xvinit)) )
xv[0] = xvinit
h = Tmax / N
for i in range(N):
k1 = f(xv[i])
k2 = f(xv[i] + h/2.0*k1)
k3 = f(xv[i] + h/2.0*k2)
k4 = f(xv[i] + h*k3)
xv[i+1] = xv[i] + h/6.0 *( k1 + 2*k2 + 2*k3 + k4)
return T, xv
I need to solve this system from t=0 to t=100 in time steps of 0.1 and using initial conditions (????0,????0,????0)=(0,0,0) at ????=0 I'm not really sure where to begin on this, I've tried defining a function to give the Oscillator:
def roessler(xyx, a=0.1, b=0.1, c=14):
xyx=(x,y,x)
dxdt=-y-z
dydt=x+a*y
dzdt=b+z*(x-c)
return dxdt ,dydt ,dzdt
which returns the right side of the equation with default values, i've then tried to solve by replacing f with roessler and filling in values for xvinit,Tmax and N with values i'm given but it's not working. Any help is appreciated sorry if some of this is formatted wrong i'm new here.