For CalculusWithJulia, is there Riemann' Midpoint method?

The formula used to add the terms us: sum(M(f,a,b) * (b-a) for (a,b) in zip(as, bs)) has a factor h in the (b-a) term, so you only have one h in the formula, not h^2. Try

ct = (f,a,b)-> (c = a/2+b/2; (f(a)+f(b))/2 + 1/12 * (f'(b)-f'(a))*(b-a))
1 Like