dt=0.0001 sigma=10 b=8.0/3.0 t1=[0] x1=[1] y1=[0] z1=[0] while t1[-1]<=51: x1.append(x1[-1]+(sigma*(y1[-1]-x1[-1]))*dt) y1.append(y1[-1]-(x1[-1]*z1[-1]-163.8*x1[-1]+y1[-1])*dt) z1.append(z1[-1]+(x1[-1]*y1[-1]-b*z1[-1])*dt) t1.append(t1[-1]+dt) t=[0] x=[1] y=[0] z=[0] while t[-1]<=51: x.append(x[-1]+(sigma*(y[-1]-x[-1]))*dt) y.append(y[-1]-(x[-1]*z[-1]-150*x[-1]+y[-1])*dt) z.append(z[-1]+(x[-1]*y[-1]-b*z[-1])*dt) t.append(t[-1]+dt) t2=[0] x2=[1] y2=[0] z2=[0] while t2[-1]<=51: x2.append(x2[-1]+(sigma*(y2[-1]-x2[-1]))*dt) y2.append(y2[-1]-(x2[-1]*z2[-1]-160*x2[-1]+y2[-1])*dt) z2.append(z2[-1]+(x2[-1]*y2[-1]-b*z2[-1])*dt) t2.append(t2[-1]+dt) pl.figure(figsize=(15,8)) pl.plot(t,z,label="r=150",color="blue",linewidth=2) pl.plot(t1,z1,label="r=163.8",color="green",linewidth=2) pl.plot(t2,z2,label="r=160",color="red",linewidth=2) pl.xlabel("time(s)") pl.ylabel("z") pl.title('Lorenz mode: z versus time') pl.legend() pl.show() pl.figure(figsize=(15,8)) pl.plot(x,z,label="r=150",color="blue",linewidth=2) pl.plot(x1,z1,label="r=163.8",color="green",linewidth=2) pl.plot(x2,z2,label="r=160",color="red",linewidth=2) pl.xlabel("x") pl.ylabel("z") pl.title('Phase space plot: z versus x') pl.legend() pl.show()