[Date Index] [Thread Index] [Author Index]
Re: Solve never calls Equal?
On 07/18/2011 05:13 AM, Andrzej Kozlowski wrote: >> >> >> I think it is hard to claim that these test could be done only with > Significance arithmetic. However, DanL has indicated that tracing Equal > may not be effective if the system programs utilize some internal call > to a system entry into PossibleZeroQ. The point remains that >> redefining Equal as done here does not seem to adversely affect > NSolve, Reduce, NIntegrate. Nor does it seem to take much time. >> >> RJF > > As usual, your reply avoids the only important thing, which is the > example that I posted. > > Reduce[Exp[x] - x == 1/2&& Abs[x]< 1, x] > > > Try it again yourself, with Equal replaced by SameQ and without. What do > you see? > [...] > Hint: this equation is being solved *exactly* and yet your "improvement" > breaks it. > [...] I think a minor variant of the Equal-->SameQ might be safer. One needs to restrict to cases where both arguments have finite precision. Unprotect[Equal]; Equal[a_?NumericQ, b_?NumericQ] /; (Precision[a] =!= Infinity && Precision[b] =!= Infinity) := SameQ[a, b] With this version the Reduce example will work. Not sure what will be the effect in gerneral though. Daniel Lichtblau Wolfram Research