Bonjour à tous,

J'ai fais un petit srcipt pour simuler le chaos à partir d'un exemple trouvé dans un livre. Pour visualiser j'ai créé un graphique, le tout fonctionne très bien, cependant je souhaiterai avoir un affichage au fur et à mesure du calcul des points et non un affichage de tous les points à la fin des calculs.

Voici le code !

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 
import matplotlib
import  matplotlib.pyplot  as  plt
import  numpy  as  np
from pylab import *
from math import *
 
 
matplotlib.rcParams['axes.unicode_minus'] = False
fig = plt.figure()
ax = fig.add_subplot(111)
x= 0.4
b = 4
for i in range (100):
        y  =  x*b*(1-x)
        ax.plot(i,y, 'o')
        x = y
 
ax.set_title('Chaos : x(t+1) = x(t) * b(1-x(t))')
grid(True)
plt.show()
Merci de votre aide