import matplotlib.pyplot as plt
from numpy import sqrt

a=sqrt(2)-1
b=2-sqrt(2)

def fun(p):
    z,y = p[0],p[1]
    return [a*z-(a+1)*z**3-b*y,z+y]

x=[[0.1,0.1]]
for h in range(1,5000):
    x.append(fun(x[-1]))

Z=[n[0] for n in x[-40:]]
Y=[n[1] for n in x[-40:]]

print(Y)

plt.plot(Z, label='Z')
plt.plot(Y, '-', label='Y')
plt.legend()
plt.show()
