def methode_milieux(f,a,b,n): h=(b-a)/n L=0 for i in range(n): L+=f(a+(i+0.5)*h) return L*h