MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Why does Mathematica change the precision of an expression to check equality?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg69419] Re: [mg69386] Why does Mathematica change the precision of an expression to check equality?
  • From: Daniel Lichtblau <danl at wolfram.com>
  • Date: Tue, 12 Sep 2006 06:52:17 -0400 (EDT)
  • References: <200609101119.HAA11181@smc.vnet.net>

Jean-Marc Gulliet wrote:
> These thoughts come after answering a similar question in a forum 
> dedicated to anther CAS. Having ran the following code, I am a little 
> perplexed by the behavior of Mathematica.
> 
> y = (Sqrt[5] - 2)*(Sqrt[5] + 2);
> y == 1
> 
> --> N::"meprec" : "Internal precision limit $MaxExtraPrecision = 
> (49.99999999999999) reached while evaluating -1 + (-2 + Sqrt[5])*(2 + 
> Sqrt[5]). More...
> 
> --> (-2 + Sqrt[5])*(2 + Sqrt[5]) == 1
> 
> At least Mathematica returns a warning message in addition to the 
> unevaluated expression
> 
> I used to thought that Mathematica was not attempting to do any 
> algebraic simplifications when testing, say, equality, and that one have 
> to request explicitly such transformations.

Mathematica is not performing any algebraic simplifications in 
processing the example above.


> However, it is pretty clear that Mathematica transforms the expression 
> in some way, in this case changing infinite precision -- that is exact 
> numbers -- into arbitrary precision -- that is better precision that 
> hardware but still not exact.
>
> So the question is, "Why, when an expression is only written with exact 
> numbers, Mathematica would "downgrade" the precision to a lower and 
> inexact one before attempting to answer a boolean question?"
> 
> I do not see the rational behind this design choice...

The purpose of the numerical evaluation is to determine if the two sides 
are NOT equal, in which case Simplify will return False.


> Best regards,
> Jean-Marc
> 
> P.S. I know that one can get the correct answer by using Simplify.

A future release will in fact attempt rudimentary alggraic manipulation, 
the purpose being to determine if a putative equality is true. This 
cannot be done with numeric evaluation (which only establishes falsity).


Daniel Lichtblau
Wolfram Research


  • Prev by Date: Known recursion link to Hermite polynomials not solved in Mathematica
  • Next by Date: General--Different Results
  • Previous by thread: Re: Why does Mathematica change the precision of an expression to check equality?
  • Next by thread: Re: Why does Mathematica change the precision of an expression to check equality?