from numpy import * from scipy.integrate import odeint import matplotlib.pyplot as plt ########### parameters ############ sigma, beta, rho = 10, 8/3., 28 Xin = [0, 1, 1.05] # Initial conditions tmax= 100 # max time value N = 10000 # number of time steps de points en temps def Lorenz(X,t,sigma, beta, rho): """The Lorenz equations.""" x,y,z = X F1= sigma*(y-x) F2= rho*x-y-x*z F3= -beta*z+x*y return F1,F2,F3 t = linspace(0, tmax, N) # array of N time values from t = 0 to t=tmax y = odeint(Lorenz, Xin, t, args=(sigma, beta, rho)) fig = plt.figure() ax = fig.gca(projection='3d') ax.plot(y.T[0], y.T[1], y.T[2]) #plt.show() # rotate the axes and update for angle in range(0, 360): ax.view_init(30, angle) plt.draw() plt.pause(.001) #