# Tag Info

10

One possible solution is using Quiet: ds[All, Quiet[#a/#b]&] Another possible solution is using the FailureAction option: ds[All, #a/#b, FailureAction -> None]

5

We can use Hold to prevent message names from being evaluated until the time is right: g[a_, verbose_:False] := Module[{messageList} , messageList = If[verbose, {}, Hold[FindRoot::lstol]] ; messageList /. _[m___] :> Quiet[FindRoot[x^2 + x + a, {x, 3}], {m}] ]

4

I have found a workaround which works for my purposes, though it is not particularly pretty, and the weird behaviour of Evaluate on error messages remains a mystery to me. It is possible to switch between different Quiet behaviours by setting a custom message group and then switching that within the logic. The following code works, as far as I can tell. ...

4

NDSolve has already detected the largest such intervals for you, which is why the resulting InterpolatingFunctions have restricted domains. You can use InterpolatingFunctionDomain to extract those domains. I'd do something like so Clear[x1, x2, y] eqn = {x1'[t] == -x1[t]^2 - x2[t] + y[t]^3, x2'[t] == x1[t] - x2[t] + x1[t]^2 x2[t]^2, y'[t] == x2[t]^2 ...

4

Why not something a little simpler? g[a_, verbose_: False] /; ! verbose := Quiet[g[a, True], FindRoot::lstol] g[a_, True] := FindRoot[x^2 + x + a, {x, 3}] Now: g[1] (* no message *) g[1, True] (* FindRoot::lstol: printed *) This has the advantage of separating the primary definition from the one that controls Message printing, making both ...

3

It's been a day and no has posted a truly elegant, natural, and general solution, so I'll post a narrow one. By default, a message is stopped when it occurs three times in $MessageList. One can reduce the number of times a message is printed by pre-loading$MessageList with it. Block[{$MessageList}, Unprotect[$MessageList]; $MessageList = ... 2 Here is a method using Off and On triggered by the first appearance of the message. I avoid unprotecting any System Symbols by using TagSetDelayed. I use$Post to turn the message back on. Modification of your function is not required; this operates via the low-level Message system. Code: badness::oops = "Watch out! Result could be ...

1

another workaround example: problem msg = {General::argx, Power::infy} Quiet[1/0 + Sqrt[], Evaluate@msg] example: workaround msg = {General::argx::English, Power::infy} Quiet[1/0 + Sqrt[], Evaluate@msg] it seems: messages, which take arguments are problematic

1

This seems to work for me: thisstep = 0; laststep = 0; eqn = {x1'[t] == -x1[t]^2 - x2[t] + y[t]^3, x2'[t] == x1[t] - x2[t] + x1[t]^2 x2[t]^2, y'[t] == x2[t]^2 + y[t] + x1[t]^2 y[t]^2 + 0.5` y[t]^3, x1[0] == 1, x2[0] == 1, y[0] == 1}; {tmin, tmax} = {-1,1}; First@NDSolve[eqn, {x1[t], x2[t], y[t]}, {t, tmin, tmax}, MaxStepFraction -> 1/150, ...

Only top voted, non community-wiki answers of a minimum length are eligible