import matplotlib.pyplot as plt def F(t,z): return -10*t+10 def euler(F,t0,tf,y0,n): t=t0 y=y0 h=(tf-t0)/float(n) temps=[t0] fonction=[y0] for i in range(n): y=y+h*F(t,y) t=t+h temps.append(t) fonction.append(y) plt.plot(temps,fonction) return fonction print(euler(F,0,3,0,50))
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more