import numpy as np
import matplotlib.pyplot as plt
import monedo as mo


N=2000

VN=np.arange(10,N,30)

def f(t,x):
    return 1/t

def y(t):
    return np.log(t)

err1=mo.erreur(mo.euler_all,f,1,2,0,VN,y)
err2=mo.erreur(mo.ptmilieu_all,f,1,2,0,VN,y)
err3=mo.erreur(mo.heun_all,f,1,2,0,VN,y)
err4=mo.erreur(mo.myrk4_all,f,1,2,0,VN,y)
plt.plot(VN,err1,'+',label='Euler')
plt.plot(VN,err2,'*',label='Pt au milieu')
plt.plot(VN,err3,'o',label='Heun')
plt.plot(VN,err4,'x',label='Runge Kutta 4')
plt.plot(VN,1/VN,label="1/N")
plt.plot(VN,1/(VN**2),label="1/N^2")
plt.plot(VN,1/(VN**4),label="1/N^4")
plt.xscale('log')
plt.yscale('log')
plt.legend(loc=3)
plt.show()


