Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

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

Search the Archive

Re: Does Mathematica think Sqrt[2] is rational?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg86677] Re: [mg86668] Does Mathematica think Sqrt[2] is rational?
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Tue, 18 Mar 2008 04:49:08 -0500 (EST)
  • References: <200803170522.AAA01050@smc.vnet.net>

On 17 Mar 2008, at 06:22, magma wrote:

> This might be already well known, but...
>
> Consider the following expression
>
> expr = ForAll[{x, y}, x^2 != 2 y^2]
>
> If we test it over the Reals, it should be false, since x=Sqrt[2] and
> y=1 falsify it.
> Mathematica agrees with us
>
> Reduce[expr, {x, y}, Reals]
>
> However if we test it over the Integers or the Rationals it should be
> true, as a demonstration that Sqrt[2] is not rational.
> Mathematica , unfortunately,  does not agree with us
>
> Reduce[expr, {x, y}, Integers]
>
> Reduce[expr, {x, y}, Rationals]
>
> So it appears that Mathematica thinks that there are 2 integers x, y
> such that x^2 = 2 y^2.
> Let's consider the negation of the previous expression
>
> expr2 = Exists[{x, y}, x^2 == 2 y^2]
>
> Mathematica correctly finds out that expr is true over the reals
>
> Reduce[expr2, {x, y}, Reals]
>
>
> But gives a wrong answer over the integers or the rationals
>
> Reduce[expr2, {x, y}, Integers]
>
> Reduce[expr2, {x, y}, Rationals]
>
> Finally, if we try the inequality without the quantifiers, the results
> are not very illuminating with the Reals, but still correct
>
> Reduce[x^2 != 2 y^2, {x, y}, Reals]
>
> While with Integers Mathematica misses the point entirely
>
> Reduce[x^2 != 2 y^2, {x, y}, Integers]
>
> Conclusion : Mathematica does not seem to realize that Sqrt[2] is
> irrational.
>
> Am I missing something or WRI has been infiltrated by
> Pythagoreans :-)  ?
>
>

You are missing a lot...

First of all, consider the expression:

  Reduce[ForAll[{x, y}, Element[x | y, Integers], x^2 != 2 y^2]]
False

this is correct, because

FindInstance[Element[x | y, Integers] && x^2 == 2 y^2, {x, y}]
{{x -> 0, y -> 0}}

On the other hand:

Reduce[ForAll[{x, y}, x != 0 && Element[x | y, Integers], x^2 != 2 y^2]]
True

as it should be.

Note also, that I write everywhere Element[x|y,Integers] , which menas  
both x and y are assumed to be integers. In general this is what you  
have to do. Writing only Reduce[expr, {x, y}, Integers],  Reduce[expr,  
{x, y}, Reals]  actually means something quite different - it involves  
the assumption that all the subexpressions occuring in the expression  
exp are Reals or Integers and can produce very surprising results.

Finally, as I have already poitnted out, general quantifier  
elimination works only over the Reals so it's easy to find very simple  
formulas over which Mathematica will not resolve over the integers.


Andrzej Kozlowski



  • Prev by Date: Re: V.6.0.2 gripes...
  • Next by Date: Re: V.6.0.2 gripes...
  • Previous by thread: Does Mathematica think Sqrt[2] is rational?
  • Next by thread: Re: Does Mathematica think Sqrt[2] is rational?