Site de Jean-Michel RICHER

Maître de Conférences en Informatique à l'Université d'Angers

Ce site est en cours de reconstruction certains liens peuvent ne pas fonctionner ou certaines images peuvent ne pas s'afficher.


Code

Fichier : ens/l1/python1/cc/chaos.py




Warning: Undefined variable $highlight in /home/jeanmichel.richer/public_html/rendu_code.php on line 43
import matplotlib.pyplot as plt

def chaos(x,r):
   
    sequence = [x]
   
    for i in range(100):
        x = r * x * (1 - x)
        sequence.append(x)
   
    return sequence

def main():
    l1 = chaos(0.1,3.69)
    # l2 = chaos(0.1,3.89)
   
    x = range(len(l1))
    plt.plot(x, l1)
    #plt.plot(x, l2)
    plt.show()

if __name__ == "__main__":
    main()