Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- """
- Tracé du graphique quantités de matière en fonction de l'avancement
- version 01 : simple
- @author: Julien Bernon, Lycée Louis Feuillade
- """
- from matplotlib import pyplot as plt #On importe d'abord ce qui permet de tracer des graphiques
- def A(x,a,na):
- return na-a*x
- def B(x,b,nb):
- return nb-b*x
- def C(x,c,nc):
- return nc+c*x
- def av_max(a,na,b,nb):
- xmax1=na/a
- xmax2=nb/b
- xmax=min(xmax1,xmax2)
- return xmax
- def generation(a,na,b,nb,c,nc,ini,fin,nb_pts):
- liste_x,liste_ya,liste_yb,liste_yc=[],[],[],[]
- for i in range(nb_pts):
- x=ini+i*(fin-ini)/nb_pts
- liste_x.append(x)
- liste_ya.append(A(x,a,na))
- liste_yb.append(B(x,b,nb))
- liste_yc.append(C(x,c,nc))
- plt.plot(liste_x,liste_ya)
- plt.plot(liste_x,liste_yb)
- plt.plot(liste_x,liste_yc)
- plt.show()
- return True
- a,b,c,na,nb,nc=1,2,3,0.05,0.03,0.01
- xmax=av_max(a,na,b,nb)
- generation(a,na,b,nb,c,nc,0,xmax,100)
RAW Paste Data