[sage-devel] Re: sqrt(2) is real or not

2009-11-04 Thread Gonzalo Tornaria
On Wed, Nov 4, 2009 at 2:43 PM, William Stein wrote: >            sage: Integers(7)(3) in ZZ >            True I found this one funny: sage: a = Integers(7)(3) sage: a in ZZ True sage: a in QQ False In the same vein: sage: b = Integers(11)(3) sage: a in ZZ True sage: b in ZZ True sage: a + b

[sage-devel] Re: sqrt(2) is real or not

2009-11-04 Thread William Stein
On Wed, Nov 4, 2009 at 8:35 AM, Vincent D <20100.delecr...@gmail.com> wrote: > > I understand now (and agree on) the design: sqrt(2) is symbolic and > any sage expression containing a symbolic expression is also symbolic. > But, considering the non comparison, it seems to give a set theoritic > co

[sage-devel] Re: sqrt(2) is real or not

2009-11-04 Thread Vincent D
I understand now (and agree on) the design: sqrt(2) is symbolic and any sage expression containing a symbolic expression is also symbolic. But, considering the non comparison, it seems to give a set theoritic contradiction: sage: sqrt(2) in RR True And RR is an ordered field. I think it goes in

[sage-devel] Re: sqrt(2) is real or not

2009-11-04 Thread Ralf Hemmecke
> Should I expect > > sage: SR(1) + SR(2) > 1 + 2 > > just because > > sage: SR(x) + SR(2) > x + 2 And why would "1 + 2" be wrong/bad or whatever? Can you give a suggestion what I must input to sage to exacly get an expression 1+2 in sage, i.e. an expression tree + / \ 1 2 ? It all

[sage-devel] Re: sqrt(2) is real or not

2009-11-03 Thread Ralf Hemmecke
> Symbolic Ring > sage: SR(1) > SR(2) > 1 > 2 > because it returns: > sage: x > 2 > x > 2 > if x is symbolic. Right. And of course it doesn't say whether that is true or false. That's just an expression. Only when one asks to transform that into a boolean value, computation is started. Challen

[sage-devel] Re: sqrt(2) is real or not

2009-11-03 Thread Florent Hivert
Dear William, > This is completely orthogonal to the real question, which is about > design. You've replaced the question of whether or not sqrt(2) > 1 > should be *simplified* automatically, by the question of how to do > such simplifications. How to do them, is a black box that can cha

[sage-devel] Re: sqrt(2) is real or not

2009-11-03 Thread Gonzalo Tornaria
On Tue, Nov 3, 2009 at 3:22 PM, Florent Hivert wrote: > +1 to no simplification... > > Rationale: I think indeed that it is very important that the type of the > result of an operator depends only of the type of the operands and not of > their actual values. If > is a constructor for symbolic equ

[sage-devel] Re: sqrt(2) is real or not

2009-11-03 Thread Gonzalo Tornaria
On Tue, Nov 3, 2009 at 3:05 PM, William Stein wrote: > This reminds me of / being a constructor for elements of QQ, no matter > what, i.e., a/b for a and b both integers (with b!=0) is a rational, > no matter what: > > sage: type(2/3) > > sage: type(2/1) > > > This was an important design decis

[sage-devel] Re: sqrt(2) is real or not

2009-11-03 Thread Jason Grout
Burcin Erocal wrote: > Hi Jason, > > On Sat, 31 Oct 2009 19:58:56 -0500 > Jason Grout wrote: > >> I think it's kind of weird that: >> >> sqrt(2)>1 >> >> does not return True automatically. I realize it's because symbolic >> expressions do not automatically do comparisons, but maybe we ought >

[sage-devel] Re: sqrt(2) is real or not

2009-11-03 Thread Burcin Erocal
Hi, On Sun, 1 Nov 2009 03:54:05 -0800 (PST) Vincent Delecroix <20100.delecr...@gmail.com> wrote: > I agree that sqrt(2) > 1 ;) the problem is the one Jason has > developed : the comparison returns a symbolic expression ! > > Morever, It works well for min and max functions : > {{{ > sage: max(

[sage-devel] Re: sqrt(2) is real or not

2009-11-03 Thread Burcin Erocal
Hi Jason, On Sat, 31 Oct 2009 19:58:56 -0500 Jason Grout wrote: > I think it's kind of weird that: > > sqrt(2)>1 > > does not return True automatically. I realize it's because symbolic > expressions do not automatically do comparisons, but maybe we ought > to make an exception for symbolic

[sage-devel] Re: sqrt(2) is real or not

2009-11-01 Thread Vincent Delecroix
Hi, I agree that sqrt(2) > 1 ;) the problem is the one Jason has developed : the comparison returns a symbolic expression ! Morever, It works well for min and max functions : {{{ sage: max(sqrt(2), 1) sqrt(2) sage: min(sqrt(2), 1) 1 }}} Why max(sqrt(2), 1) not a symbolic expression ? Vincent

[sage-devel] Re: sqrt(2) is real or not

2009-10-31 Thread Jason Grout
Florent Hivert wrote: > sage: x = sqrt(2) > sage: x in RR > True > sage: x > 1 > sqrt(2) > 1 > sage: bool(x > 1) > True I think it's kind of weird that: sqrt(2)>1 does not return True automatically. I realize it's because symbolic expressions do not automatically do comparisons, but maybe we

[sage-devel] Re: sqrt(2) is real or not

2009-10-31 Thread Florent Hivert
Hi Vincent, > I'm just in trouble with the behavior of sqrt(n) when n is an integer, > because of the following: > {{{ > sage: x = sqrt(2) > sage: x in RR > True > sage: x > 1 # a boolean expected > x > 1 # a symbolic expression obtained > }}} > > It could be avoided by forcing the