2
$\begingroup$

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?

$\endgroup$
3
  • 2
    $\begingroup$ Or this: mathematica.stackexchange.com/questions/75426/… $\endgroup$
    – Michael E2
    Apr 22 '17 at 17:20
  • 3
    $\begingroup$ Using Anton's answer here: Reap[NIntegrate[Sin[Cos[100 x]], {x, 0, 5}, MaxRecursion -> 0, "IntegrationMonitor" :> Function[{iregs}, Sow[Flatten[Map[Thread[# -> Through[iregs[#]]] &, {"Integral", "Error"}]]]]]] $\endgroup$ Apr 22 '17 at 17:25
  • $\begingroup$ @MichaelE2 Ok, thanks; close as duplicate. $\endgroup$
    – QuantumDot
    Apr 22 '17 at 23:32