I noticed that I get the exact error, using midpoint rule error bound formula, but with $f''(\frac{b-a}{2})$ for $K$, i.e. :
$E_m \leq $ $\frac{K(b-a)^3} {24n^2}$
$E_{m2} = $ $\frac{f''(\frac{b-a}{2} ) (b-a)^3} {24n^2}$
See my demonstration here (where $f''(x)$ is $i(x)$) :
https://www.desmos.com/calculator/rsnxcn2yf7
$E_{m2}$ is the exact error (line 14).
How to explain why I get exact error that way ?
Of course it must be related to the fact that the second derivative is a line, but I can't find out why.