Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

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

Search the Archive

Re: comparing implicit 0 with machine floats

  • To: mathgroup at smc.vnet.net
  • Subject: [mg71139] Re: [mg71108] comparing implicit 0 with machine floats
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Thu, 9 Nov 2006 03:37:57 -0500 (EST)
  • Reply-to: hanlonr at cox.net

Using Simplify will force the comparison

Sqrt[2] + Sqrt[3] - Sqrt[5 + 2*Sqrt[6]] == 2.//Simplify

False

Sqrt[2] + Sqrt[3] - Sqrt[5 + 2*Sqrt[6]] == N[10^3]//Simplify

False


Bob Hanlon

---- Andrzej Kozlowski <akoz at mimuw.edu.pl> wrote: 
> Consider the following:
> 
> 
> Sqrt[2] + Sqrt[3] - Sqrt[4 + 2*Sqrt[6]] == 2.
> 
> False
> 
> No problem here. Now let's make a small change
> 
> In[17]:=
> Sqrt[2] + Sqrt[3] - Sqrt[5 + 2*Sqrt[6]] == 2.
> 
> Out[17]=
> 
> Sqrt[2] + Sqrt[3] - Sqrt[5 + 2*Sqrt[6]] == 2.
> 
> In fact the expression on the LHS  is exactly 0:
> 
> In[19]:=
> RootReduce[Sqrt[2]+Sqrt[3]-Sqrt[5+2*Sqrt[6]]]
> 
> Out[19]=
> 
> The curious thing is that if you try a comparison between a zero of  
> this kind and any machine float, however large, Mathematica 5.1 will  
> return the original input:
> 
> In[20]:=
> Sqrt[2] + Sqrt[3] - Sqrt[5 + 2*Sqrt[6]] == N[10^3]
> 
> Out[20]=
> Sqrt[2] + Sqrt[3] - Sqrt[5 + 2*Sqrt[6]] == 1000.
> 
> yet if the number of the left hand side is altered, however slightly,  
> the comparison will be made:
> 
> 
> Sqrt[2] + Sqrt[3] - Sqrt[5 + 2*Sqrt[6+1/10^20]] == 2.
> 
> False
> 
> This suggests that Mathematica actually did perform a computation of  
> the left hand side in the examples where it just returned the input  
> and having discovered that it could not determine if the LHS is an  
> exact zero decided "not to answer the question". But this seems quite  
> unreasonable; after all it is not being asked if the LHS is an exact  
> 0, or even an approximate 0, but if it is an approximate large number  
> like 1000., and this it certainly can decide.
> 
> I believe this used to be handled differently (better?) in older  
> versions of Mathematica but I no longer have any installed to check.
> 
> Andrzej Kozlowski
> 


  • Prev by Date: Re: Plotting multi-column data
  • Next by Date: RE: Plotting multi-column data
  • Previous by thread: comparing implicit 0 with machine floats
  • Next by thread: Re: comparing implicit 0 with machine floats