Skip to main content
2 of 7
edited tags
m_goldberg
  • 108.6k
  • 16
  • 107
  • 263

How to avoid suppressing 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. How can I stop NIntegrate from suppressing the messages?

Ruslan
  • 7.3k
  • 2
  • 24
  • 54