# Quiet doesn't work with FindRoot when using Brent method

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)?

-
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
Quiet and ; together stop the message too. Could also use Off[FindRoot::bbrac] – Sjoerd C. de Vries Feb 24 '13 at 14:41
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
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
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

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[{##}] &;
InternalAddHandler["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]

-