[sage-devel] Re: GiNaC and Python disagree on arithmetic

2011-09-13 Thread rjf
Since python is merely a programming language and not an authority on all of mathematics, I don't see why its choice should be given special consideration. I suppose Ginac has a broader view, but not especially as broad as Sage is supposed to have. It is possible to come to some conclusions of wh

[sage-devel] Re: GiNaC and Python disagree on arithmetic

2011-09-13 Thread Marco Streng
I'd say we should stick with Python's convention 0^0 = 1. Some additional information: on sage-nt http://groups.google.com/group/sage-nt/browse_thread/thread/67e53f8e5d5061d2/ we chose to follow Python's convention 0^0 = 1 through a bit further. As for Maarten's examples, there are some more in E

[sage-devel] Re: GiNaC and Python disagree on arithmetic

2011-09-13 Thread Nils Bruin
On Sep 12, 2:50 pm, Maarten Derickx wrote: > sage: a=GF(7)(0) > sage: a^a > ... > ArithmeticError: 0^0 is undefined. > > sage: a=Integers(7)(0) > sage: a^a > ... > ArithmeticError: 0^0 is undefined. I think something else is going wrong here. It's not so much that the exponent is 0, it's that the

Re: [sage-devel] Re: GiNaC and Python disagree on arithmetic

2011-09-12 Thread Tom Boothby
On Mon, Sep 12, 2011 at 10:18 PM, Dima Pasechnik wrote: > I guess this all boils down to the point made by William - that _pow_ needs > to be integrated into the coersion framework (currently it is not). +1. Also, I should point out that I didn't make the decision myself back then; I was sitting

Re: [sage-devel] Re: GiNaC and Python disagree on arithmetic

2011-09-12 Thread Tom Boothby
I uniformized the behavior of 0^0 a long time ago (though I make no claim about what has happened between then and now -- just that it was uniform for a few precious minutes). The decision back then (which I still stand behind) is that while it is mathematically unjustifiable, it's Python's conven

[sage-devel] Re: GiNaC and Python disagree on arithmetic

2011-09-12 Thread Dima Pasechnik
I guess this all boils down to the point made by William - that _pow_ needs to be integrated into the coersion framework (currently it is not). -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegr

[sage-devel] Re: GiNaC and Python disagree on arithmetic

2011-09-12 Thread Maarten Derickx
Here some random examples of wich I find the first one the strangest sage: CC(0)^CC(0) NaN - NaN*I sage: a=GF(7)(0) sage: a^a ... ArithmeticError: 0^0 is undefined. sage: a=Integers(7)(0) sage: a^a ... ArithmeticError: 0^0 is undefined. sage: K.=QQ[] sage: K(0)^K(0) 1 sage: K.=QQ[sqrt(2)] sag

[sage-devel] Re: GiNaC and Python disagree on arithmetic

2011-09-12 Thread kcrisman
> sage: SR(0^0) > 1 Well, this is a red herring since 0^0 will evaluate, and SR(1) should be 1. What about CDF or other more bizarre rings? But I agree with you in principle. -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email t

[sage-devel] Re: GiNaC and Python disagree on arithmetic

2011-09-12 Thread Nils Bruin
If one puts it this way: sage: 0^0 1 sage: RDF(0)^RDF(0) #this one is the most dubious 1.0 sage: SR(0^0) 1 sage: SR(0)^SR(0) RuntimeError: power::eval(): pow(0,0) is undefined I think it's pretty clear that the error should go away unless there are very convincing technical reasons. -- To post

[sage-devel] Re: GiNaC and Python disagree on arithmetic

2011-09-12 Thread kcrisman
On Sep 12, 12:45 pm, Keshav Kini wrote: > Hey Burcin, > > I guess that means you think that pynac should return 1 for 0^0, then? As > opposed to making Sage throw a ValueError or something at > Integer(0)^Integer(0) ? > I think that Sage has had 0^0 return 1 for quite some time now? On the oth

Re: [sage-devel] Re: GiNaC and Python disagree on arithmetic

2011-09-12 Thread Keshav Kini
Hey Burcin, I guess that means you think that pynac should return 1 for 0^0, then? As opposed to making Sage throw a ValueError or something at Integer(0)^Integer(0) ? I'll poke around :) -Keshav -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this

Re: [sage-devel] Re: GiNaC and Python disagree on arithmetic

2011-09-12 Thread Burcin Erocal
Hi Keshav, On Mon, 12 Sep 2011 03:16:27 -0700 (PDT) Keshav Kini wrote: > I believe that error message is propagated from GiNaC. See line 523 > of src/ginac/power.cpp in the pynac spkg. The error message is > hard-coded and doesn't refer to python's eval() function. This should be fixed in pynac

[sage-devel] Re: GiNaC and Python disagree on arithmetic

2011-09-12 Thread Jean-Pierre Flori
On 12 sep, 12:16, Keshav Kini wrote: > Hi Simon, > > I believe that error message is propagated from GiNaC. See line 523 of > src/ginac/power.cpp in the pynac spkg. The error message is hard-coded and > doesn't refer to python's eval() function. You're definitely right. > > -Keshav -- To post

[sage-devel] Re: GiNaC and Python disagree on arithmetic

2011-09-12 Thread Keshav Kini
Hi Simon, I believe that error message is propagated from GiNaC. See line 523 of src/ginac/power.cpp in the pynac spkg. The error message is hard-coded and doesn't refer to python's eval() function. -Keshav -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe

[sage-devel] Re: GiNaC and Python disagree on arithmetic

2011-09-12 Thread Simon King
Hi Keshav, On 12 Sep., 11:30, Keshav Kini wrote: > RuntimeError: power::eval(): pow(0,0) is undefined That error message is an interesting statement, because it is wrong, even in pure Python: >>> pow(0,0) 1 The error message mentions "eval", but it doesn't seem to be eval's fault either: >>> e