Sometimes NIntegrate
issues a warning stating that the desired accuracy wasn't reached.
NIntegrate[Sin[Cos[100 x]], {x, 0, 5}, MaxRecursion -> 0]
NIntegrate failed to converge to prescribed accuracy after 0 recursive bisections in x near {x} = {4.9602...}. NIntegrate obtained 0.4780... and 0.3486... for the integral and error estimates. >>
How do I reap this error estimate (of 0.3486... in this case) from NIntegrate
even when this warning is not issued?
Reap[NIntegrate[Sin[Cos[100 x]], {x, 0, 5}, MaxRecursion -> 0, "IntegrationMonitor" :> Function[{iregs}, Sow[Flatten[Map[Thread[# -> Through[iregs[#]]] &, {"Integral", "Error"}]]]]]]
$\endgroup$