While solving a simple puzzle that asked for a few calculations in plane geometry, I ended up with this expression:
$-\frac{55}{2}+\frac{\sqrt{27233}}{2}+\frac{1}{2}(55-\sqrt{27233})$
Or, in InputForm:
-55/2 + Sqrt[27233]/2 + (55 - Sqrt[27233])/2
Obviously, the result is an exact 0. But the expression just sits there (Mathematica 10.1.0 64-bit, Win7) and looks at me challengingly instead of being evaluated to zero. Let's help it along a little:
-55/2 + Sqrt[27233]/2 + (55 - Sqrt[27233])/2 // Apart
(* 0 *)
Good. Together, Simplify and probably a bunch of other functions deliver the same small incentive that Mathematica needs to get cracking. But the original expression that I encountered was larger, and the relevant portion was this (note the absolute-value function):
$\left|{-\frac{55}{2}+\frac{\sqrt{27233}}{2}+\frac{1}{2}(55-\sqrt{27233})}\right|$
Or, in InputForm:
Abs[-55/2 + Sqrt[27233]/2 + (55 - Sqrt[27233])/2]
Expected result: Still 0, of course. Actual result:
N::meprec: "Internal precision limit $MaxExtraPrecision = 50.` reached while evaluating -(55/2)+Sqrt[27233]/2+1/2 (55-Sqrt[27233])."
Clearly, applying Simplify, Together or any other operation to the expression inside Abs[] will make this work, as long as the expression's structure is changed in some way, as that will collapse the expression to zero.
What puzzles me is why Mathematica wouldn't evaluate it on its own? I always thought that Mathematica does an automatic "light-weight Simplify", so to speak, which would cover such a simple case.
The real question is, though, whether this is a bug. After all, unless I manually start editing intermediate results, this perfectly good evaluatable expression remains unevaluated, botching the rest of my puzzle solution. :)
1-1evaluates to zero, but also that more complicated expressions require "user intervention" such asSimplify. So what's the question here? – yohbs Sep 20 '15 at 06:51Sqrt[27233]is not a rational. – m_goldberg Sep 20 '15 at 06:59Abs[], the subexpression is suddenly evaluated numerically, when the subexpression evaluator is (cf. example outsideAbs[]) quite capable of recognising and eliminating the common subexpressions, leaving an exact0instead of scratching its head about the number of bits it will need to figure out an irrational root. – Felix Kasza Sep 20 '15 at 07:06EuclideanDistance[p1,p2]. I wouldn't know how to slip aSimplifyinto the result;Hold[EuclideanDistance[…]]will not let anything happen, andInactivate[EuclideanDistance[…],Abs]will only inactivateAbsif it is explicitly present in the input, not if it is generated in the output. And when I think about it, that makes the entire result wrong, not just mildly inconvenient, because there is no way to correct it. – Felix Kasza Sep 20 '15 at 07:25EuclideanDistance-- why can you not useEuclideanDistance[p1,p2] // Simplifyor something similar? – Mr.Wizard Sep 20 '15 at 09:24Absissue is listed in the Possible Issues section of its help page: "Abs can stay unevaluated for some complicated numeric arguments:". The example include the error message you list in your question. – Sjoerd C. de Vries Sep 20 '15 at 11:06EuclideanDistance[]comes down to $\sqrt{(x1-x0)^2+(y1-y0)^2}$. Squaring makes nasty little minus signs go away, but Mathematica wraps the argument to be squared inAbs[], which fails to evaluate symbolically beforeSimplify[]ever has a chance to do its thing. Since this is simple planar geometry, I just apply Mr. Pythagoras myself now. That still leaves open whyEuclideanDistance[]forces numericization instead of returning theAbs[]unevaluated, which I would have preferred. – Felix Kasza Sep 21 '15 at 10:29Out[188]= True`. Even that much was a not-very-simple undertaking.
– Daniel Lichtblau Sep 21 '15 at 15:34