Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

The following has no solution:

FindRoot[x == 1, {x, 0.25, 0, 0.5}]

And Mathematica correctly warns us:

FindRoot::reged: The point {0.5} is at the edge of the search region {0.,0.5} in coordinate 1 and the computed search direction points outside the region.

If we use Quiet, we correctly suppress the message.

The following is exactly the same system, but here we ask for a specific numerical method

FindRoot[x == 1, {x, 0, 0.5}, Method -> "Brent"]

And we receive a similar warning:

FindRoot::bbrac: Method -> Brent is only applicable to univariate real functions and requires two real starting values that bracket the root.

But this time, if we add Quiet, we still receive the same warning.

Why isn't Quiet working (is it a bug)?

share|improve this question
1  
I'd say it's a bug. It's possible to shut it up by using both Check and Quiet: Quiet@Check[FindRoot[x == 1, {x, 0.25, 0, 0.5}, Method -> "Brent"], foo] –  Szabolcs Feb 24 '13 at 13:56
1  
Quiet and ; together stop the message too. Could also use Off[FindRoot::bbrac] –  Sjoerd C. de Vries Feb 24 '13 at 14:41
2  
I'd say it's a bug. TracePrint reveals two calls to Message[FindRoot::bbrac]. –  Sjoerd C. de Vries Feb 24 '13 at 14:49
1  
Yep, two calls to Message, and one suppressed, but only if Quiet is used. Here's a way to check: messageHandler = Print[{##}] &; InternalAddHandler["Message", messageHandler];` It'll show things like Hold[Message[FindRoot::bbrac],True] where True means not suppressed using Quiet. –  Szabolcs Feb 24 '13 at 14:54
1  
Looks to me like this is figured out. Why not write it up as an answer and get this question off the 'unanswered questions' list? –  WalkingRandomly Oct 1 '13 at 8:24

1 Answer 1

up vote 3 down vote accepted

It's a bug: there are more than one call to Message[FindRoot::bbrac], and some of them are suppressed, but only if Quiet is used. Here's a way to check suggested by Szabolcs:

messageHandler = Print[{##}] &;
Internal`AddHandler["Message", messageHandler];
Quiet@FindRoot[x == 1, {x, 0, 0.5}, Method -> "Brent"]

<...>

{Hold[Message[FindRoot::bbrac],False]}

{Hold[Message[FindRoot::bbrac],False]}

{Hold[Message[FindRoot::bbrac],True]}

{Hold[Message[FindRoot::bbrac],True]}

When the last argument is True it means that the call was not suppressed by Quiet.

The suggested workarounds follow.

As already stated in the comments by Sjoerd, Quiet and ; together stop the message:

Quiet[FindRoot[x == 1, {x, 0, 0.5}, Method -> "Brent"];]

Another solution is to swith Off this message globally:

Off[FindRoot::bbrac]

Szabolcs noticed that Check with Quiet together suppress the message too:

Quiet@Check[FindRoot[x == 1, {x, 0.25, 0, 0.5}, Method -> "Brent"], foo]
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.