Re: [sage-devel] Should a // b really be the same as a / b in fields?

2016-01-20 Thread Jeroen Demeyer
On 2016-01-20 15:49, William Stein wrote: All that said, without history in the way, making floordiv agree with float floor div would be nice. For the record, this is #15260. -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from t

Re: [sage-devel] Should a // b really be the same as a / b in fields?

2016-01-20 Thread William Stein
On Wed, Jan 20, 2016 at 6:38 AM, Volker Braun wrote: > So we have never kept with the Python semantics for > division. Not that Python has rationals out of the box anyways. Whatever > implementation we chose, people will trip over that. > The only thing more > confusing than having two different b

Re: [sage-devel] Should a // b really be the same as a / b in fields?

2016-01-20 Thread Volker Braun
Python 2.x also decided that integer division is C division, which we totally violate. So we have never kept with the Python semantics for division. Not that Python has rationals out of the box anyways. Whatever implementation we chose, people will trip over that. The only thing more confusing

Re: [sage-devel] Should a // b really be the same as a / b in fields?

2016-01-20 Thread William Stein
When lurking and reading this thread, I keep being reminded of Justin Walker's remarks that a "principle of least surprise" can be useful in such design decisions. In this particular case, there's two things that argue for what Jeroen suggests: - If you have integers a and b, and write a//b th

Re: [sage-devel] Should a // b really be the same as a / b in fields?

2016-01-20 Thread Jeroen Demeyer
On 2016-01-20 12:32, Volker Braun wrote: Of course you can define as ZZ-floor division as the above operation in QQ, but thats doesn't generalize to other rings. True, this doesn't work in full mathematical generality. But that's not a good reason to just throw everything away. Many useful E

Re: [sage-devel] Should a // b really be the same as a / b in fields?

2016-01-20 Thread Volker Braun
On Wednesday, January 20, 2016 at 10:22:55 AM UTC, Jeroen Demeyer wrote: > > In QQ, I would define a//b = floor(a/b). > Why do you consider this not "really consistent with the division > operation on ZZ."? Neither your previous post nor this one explains that. > That definition doesn't work fo

Re: [sage-devel] Should a // b really be the same as a / b in fields?

2016-01-20 Thread Jeroen Demeyer
On 2016-01-20 11:17, Volker Braun wrote: On Wednesday, January 20, 2016 at 8:28:23 AM UTC, Jeroen Demeyer wrote: Well, you cannot have a fully consistent floor division in any case: Either you make floor division on QQ consistent with ZZ or with QQ[x] but you cannot have both. Person

Re: [sage-devel] Should a // b really be the same as a / b in fields?

2016-01-20 Thread Volker Braun
On Wednesday, January 20, 2016 at 8:28:23 AM UTC, Jeroen Demeyer wrote: > > Well, you cannot have a fully consistent floor division in any case: > Either you make floor division on QQ consistent with ZZ or with QQ[x] > but you cannot have both. Personally, I would prefer making it > consistent w

Re: [sage-devel] Should a // b really be the same as a / b in fields?

2016-01-20 Thread Jeroen Demeyer
On 2016-01-19 22:50, Volker Braun wrote: Presumably nobody has a problem with sage: R. = QQ[] sage: (3*x^2+1) // (2*x) 3/2*x and it would be rather strange if the binary operations on the scalars behave different in QQ vs degree-0-part(QQ[x]). Well, you cannot have a fully consistent floor di

Re: [sage-devel] Should a // b really be the same as a / b in fields?

2016-01-19 Thread Volker Braun
Presumably nobody has a problem with sage: R. = QQ[] sage: (3*x^2+1) // (2*x) 3/2*x and it would be rather strange if the binary operations on the scalars behave different in QQ vs degree-0-part(QQ[x]). Whereas it shouldn't come as too much of a surprise that division-related operations behave

Re: [sage-devel] Should a // b really be the same as a / b in fields?

2016-01-19 Thread Jeroen Demeyer
On 2016-01-19 13:31, John Cremona wrote: This would only make sense if ZZ was the only ring of which QQ was the field of fractions. Similarly with rational function fields, in my opinion. Well, you are thinking too mathematical. Of course, defining a//b = a/b makes any field into a Euclidean

Re: [sage-devel] Should a // b really be the same as a / b in fields?

2016-01-19 Thread Jeroen Demeyer
On 2016-01-19 12:49, Vincent Delecroix wrote: 1. Should we always have a == a//b + a%b I guess you mean a == (a//b)*b + a%b Buy yes, this invariant is very important and should always be satisfied. -- You received this message because you are subscribed to the Google Groups "sage-devel"

[sage-devel] Should a // b really be the same as a / b in fields?

2016-01-19 Thread Johan S . R . Nielsen
The behaviour for ZZ--QQ--RR decided in that other thread are taking quotients over the sub-ring ZZ. More specifically: if a,b are in ZZ, QQ or RR then it was decided that a % b should implicitly satisfy: a == (a//b) * b + a%b and a//b in ZZ and a%b has norm smaller than b (norm as in euclidea

Re: [sage-devel] Should a // b really be the same as a / b in fields?

2016-01-19 Thread John Cremona
On 19 January 2016 at 12:37, Vincent Delecroix <20100.delecr...@gmail.com> wrote: > On 19/01/16 09:31, John Cremona wrote: >> >> On 19 January 2016 at 11:49, Vincent Delecroix >> <20100.delecr...@gmail.com> wrote: >>> >>> As far as I know we do not have any specifications for //. In euclidean >>> r

Re: [sage-devel] Should a // b really be the same as a / b in fields?

2016-01-19 Thread Vincent Delecroix
On 19/01/16 09:31, John Cremona wrote: On 19 January 2016 at 11:49, Vincent Delecroix <20100.delecr...@gmail.com> wrote: As far as I know we do not have any specifications for //. In euclidean ring it would be natural for it to be the quotient. But in other situations? 1. Should we always have

Re: [sage-devel] Should a // b really be the same as a / b in fields?

2016-01-19 Thread John Cremona
On 19 January 2016 at 11:49, Vincent Delecroix <20100.delecr...@gmail.com> wrote: > As far as I know we do not have any specifications for //. In euclidean ring > it would be natural for it to be the quotient. But in other situations? > > 1. Should we always have > > a == a//b + a%b > > 2. Should

Re: [sage-devel] Should a // b really be the same as a / b in fields?

2016-01-19 Thread Vincent Delecroix
As far as I know we do not have any specifications for //. In euclidean ring it would be natural for it to be the quotient. But in other situations? 1. Should we always have a == a//b + a%b 2. Should // always be internal? Vincent On 19/01/16 08:28, Jeroen Demeyer wrote: Feature or bug?

[sage-devel] Should a // b really be the same as a / b in fields?

2016-01-19 Thread Jeroen Demeyer
Feature or bug? sage: QQ(7) // QQ(2) 7/2 I would expect sage: QQ(7) // QQ(2) 3 -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegrou