# ------------------------------------------------------------------------- # # PYTHON for DUMMIES # Problème de Lorenz # # Script de test # Vincent Legat # # ------------------------------------------------------------------------- # from numpy import * # ============================================================ # FONCTION A MODIFIER [begin] # # def lorenz(Xstart,Xend,Ustart,n): X = linspace(Xstart,Xend,n+1) U = random.rand(n+1,3) return X,U # # FONCTION A MODIFIER [end] # ============================================================ def main(): # ------------------------------------------------------------------------------------ # # Script de test # # # ------------------------------------------------------------------------------------ from matplotlib import pyplot as plt plt.rcParams['toolbar'] = 'None' plt.rcParams['toolbar'] = 'None' plt.rcParams['figure.facecolor'] = 'lavender' plt.rcParams['axes.facecolor'] = 'lavender' plt.figure("Lorenz Equations") Xstart = 0; Xend = 100; Ustart = [0,1,0] n = 10000; X,U = lorenz(Xstart,Xend,Ustart,n) plt.plot(U[:,0],U[:,2],'-r',linewidth=0.5) plt.show() main()