I want to generate Chen's hyperchaotic sequence. Formulas are given as:Chen's hyperchaotic sequence equations
Code I have written is attached.
import math
a = 36
b = 3
c = 28
d = 16
k = 0.2
def chen(x0, y0, z0, q0):
xdot = a * (y0 - x0)
ydot = (-x0 * z0) + (d * x0) + (c * y0) - q0
zdot = (x0 * y0) - (b * z0)
qdot = x0 + k
return xdot, ydot, zdot, qdot
def chaotic_seq(x0, y0, z0, q0, length):
for i in range(length):
xdot, ydot, zdot, qdot = chen(x0, y0, z0, q0)
if math.isnan(xdot) or math.isnan(ydot) or math.isnan(zdot) or math.isnan(qdot):
print(i)
x0 = xdot
y0 = ydot
z0 = zdot
q0 = qdot
if __name__ == '__main__':
x0 = 0.3
y0 = -0.4
z0 = 1.2
q0 = 1
length = 2048
chaotic_seq(x0=x0, y0=y0, z0=z0, q0=q0, length=length)
Problem I am facing is, after 'i=11' all the values (xdot, ydot, zdot, qdot) are NaN.