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
    Commented Apr 22, 2017 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$ Commented Apr 22, 2017 at 17:25
  • $\begingroup$ @MichaelE2 Ok, thanks; close as duplicate. $\endgroup$
    – QuantumDot
    Commented Apr 22, 2017 at 23:32

0

Browse other questions tagged or ask your own question.