On 15 May 2010 22:09, Robert Bradshaw <rober...@math.washington.edu> wrote: > On May 15, 2010, at 8:54 AM, Simon King wrote: > >> Hi John! >> >> On 15 Mai, 17:34, John Cremona <john.crem...@gmail.com> wrote: >>> >>> ... >>> There's a more general issue here, perhaps. In your R = Z[[x]], you >>> ask for the inverse of x, which is not invertible as an element of R. >>> The conservative response is to return 1/x in the smallest ring >>> containing R in which x has in inverse, which is Laurent series over >>> Z. The simpler response is to say "since R is an integral domain, >>> let's form its field of fractions and do the inversion there". >> >> I think there is already a convention in Sage: a/b should *always* >> live in the fraction field. Therefore, the parent of 1/1 is QQ, not >> ZZ. > > Hmm... I've always found it handy that > > sage: R.<x> = QQ[[]] > sage: 1/(1+x) > 1 - x + x^2 - x^3 + x^4 - x^5 + x^6 - x^7 + x^8 - x^9 + x^10 - x^11 + x^12 - > x^13 + x^14 - x^15 + x^16 - x^17 + x^18 - x^19 + O(x^20) > sage: parent(1/(1+x)) > Power Series Ring in x over Rational Field
Is this a relevant example? 1+x is a unit in QQ[[]] and no fraction fields are required. I think you meant sage: parent(1/x) Laurent Series Ring in x over Rational Field -- but again, this *is* the field of fractions of QQ[[]], so again there is no inconsistency. So perhaps you meant sage: R.<x> = ZZ[[]] sage: parent(1/x) Laurent Series Ring in x over Integer Ring where 1/x does *not* now belong to the fraction field. John John > > but I guess consistency would be nicer. I'm a bit hesitant to see this > change go in without some speed regression testing, particularly in some of > the Monsky-Washnitzer code. > > sage: R.<x> = QQ[[]] > sage: timeit("x*x") > 625 loops, best of 3: 78.2 µs per loop > sage: f = 1/x > sage: timeit("f*f") > 625 loops, best of 3: 190 µs per loop > > - Robert > > -- > 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...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/sage-devel > URL: http://www.sagemath.org > -- 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...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org