On Mon, Oct 27, 2014 at 5:55 AM, John Cremona <john.crem...@gmail.com> wrote: > On 27 October 2014 12:37, Nathann Cohen <nathann.co...@gmail.com> wrote: >> Yo ! >> >>> This is good argument to support (only) []-style argument for several >>> elements. Be consistent within same program. Or in Sage terms, "Build a car, >>> don't let it look like bicycle combined to tractor." :=) >>> >>> Btw, why gcd([]) returns zero? At least there is inconsistency with lcm([]) >>> returning one. I guess they should both return one or raise an exception. >> > > It is not inconsistent, any more than this is: > > sage: sum([]) > 0 > sage: prod([]) > 1 > > and the reason is essentially the same. > >> I would say that it is because for guys doing number theory Z/2Z is >> associated with 2 and Z is associated with 0. Think of 0 like the >> infinity, or the product of all integers. > > I don't quite follow that but as a number theorist here is how I would > explain it. If you write a loop to read in integers and output their > sum, you just add each new one to the runing total, after initializing > this total to: 0 > > Same but for products: you have to initialize to 1. > > Same but for gcd: each updated result is the gcd of the running > "total" and the new input. Must be initialised to: 0.
Here's another number theorist's perspective. I think of the gcd(X) as a canonical generator for the ideal generated by X, when defined. The ideal generated by a set X is the smallest ideal that contains it. In case X is the empty set, that ideal is the 0 ideal (not the unit ideal). -- William -- William Stein Professor of Mathematics University of Washington http://wstein.org -- 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...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.