# Tag Info

0

You may use Check and $MessageList. x = MapThread[Check[#1/#2, Last@$MessageList] &, {a, b}] (* {1/2, HoldForm[Power::infy], 3/40, 4/5, HoldForm[Power::infy]} *) Indices of errors can be obtained by: errs = Position[x, HoldForm[MessageName[__]]] (* {{2}, {5}} *) and extracted by: Extract[x, errs] (* {HoldForm[Power::infy], HoldForm[Power::infy]} *)...

3

Another way (see How to catch complete error message information for more ways to hack messages): This works because i is effectively Block[]-ed by Do[]. badindices = {}; $MessagePrePrint = (AppendTo[badindices, i]; #) &; Do[Append[x, a[[i]]/b[[i]]], {i, 1, 5}]$MessagePrePrint = Automatic; badindices (* {2, 5} *) As function for running code: ...

3

In case you want to use Quiet and need to know which error messages were generated during the evaluation, you can use $MessageList. Starting from your code: Module[{errors = Internal`Bag[{}], mess, a, b, x}, a = {1, 2, 3, 4, 5}; b = {2, 0, 40, 5, 0}; x = {}; Block[{$MessageList = {}}, Do[ Quiet[ AppendTo[x, a[...

2

Check is the function supplied with Mathematica for doing what you request. Here is how it can be used in your situation. a = {1, 2, 3, 4, 5}; b = {2, 0, 40, 5, 0}; Quiet @ Module[{errs = {}, vals}, vals = Table[Check[a[[i]]/b[[i]], AppendTo[errs, i]; Nothing], {i, 5}]; {vals, errs}] {{1/2, 3/40, 4/5}, {2, 5}}

6

Here's one way to do it: a = {1, 2, 3, 4, 5}; b = {2, 0, 40, 5, 0}; x = Quiet[Table[a[[i]]/b[[i]], {i, 1, 5}]]; Position[x, ComplexInfinity] {{2}, {5}} Basically, ans contains the values plus the errors, which in this case are ComplexInfinity. You can locate the errors using Position, in this case, at positions 2 and 5. If you want to check for any old ...

5

I think that that the key feature is to use the MaxExtraConditions option for the Solve command. In elaborate answer of Artes in here, a very very nice presentation is referred. It is entitled as Getting the Most from Algebraic Solvers in Mathematica by Adam Strzeboński. You can download the .cdf file of the presentation which is really helpful. Slide $10$ ...

3

Try the following: eq = Eliminate[{A*ra^B == fa, A*rb^B == fb}, A] Solve[eq, B] (* {{B->-(Log[fb/fa]/(Log[ra]-Log[rb]))}} *) and as you repeat this or do it by hand, please note that there are certain restrictions on the values. If you want to know what Maple did not tell you, try this Reduce[eq, B] and look at the conditions that need to be ...

Top 50 recent answers are included