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