Skip to main content
5 of 7
added 57 characters in body
Ruslan
  • 7.3k
  • 2
  • 24
  • 54

Avoiding the suppression of messages by NIntegrate

Consider the following code:

test[x_] := If[1 < x < 2, Message[Test::message]; x^2, x]; NIntegrate[test[x], {x, 0, 3}] 

5.33333333333334

I.e. it gives me the result, suppressing all messages emitted by test. OTOH, this code does emit the messages:

N@Sum[test[x] 1/1000, {x, 0, 3, 1/1000}] 

Test::message: -- Message text not found --
Test::message: -- Message text not found --
Test::message: -- Message text not found --
General::stop: Further output of Test::message will be suppressed during this calculation.

5.3338335

I'd really like to receive the messages from the integrand, because in Mathematica 11 they allow to see stack trace. How can I stop NIntegrate from suppressing the messages?

Ruslan
  • 7.3k
  • 2
  • 24
  • 54