hmm it's not mathematical, it's just that IMHO n should belong to
QQ[x], not ZZ[x]. I do see your point though, in that the coefficients
should be mathematical integers (or "may as well be"). And I do see
now that it is intentional.
Think about it : if i wanted to use your metaphor, over QQ the
numerator of a fraction ought to be in ZZ, not in NN, even if it is
positive ! and it should not be in the group {1 ; -1} with two
elements even if it is equal to 1... I guess i'm trying to say that
when k= R.fraction_field(), and when x is in k, then x.numerator()
should be in R. Not in some subset of R. You may well disagree and say
that we can take a convention for numerators such that they always lie
in some subset of R, but I don't think it's a good idea.
Also think about my nightmare when i ask for the prime divisors of the
numerator of a fraction, expecting polynomials, and getting things
like 2 and 3... I know I can use numerator().change_ring(QQ) but then
my code wouldn't be as general (if I apply 'numerator' to something in
QQ, i find an element of ZZ which doesn't have a change_ring()
method... etc).
pierre
On 1 mar, 19:37, Robert Bradshaw <[email protected]> wrote:
> On Mar 1, 2010, at 7:50 AM, Pierre wrote:
>
> > hi all,
>
> > is this a bug or intentional ?
>
> > sage: x= QQ['x'].gen()
> > sage: n= x.numerator()
> > sage: x.parent()
> > Q[x]
> > sage: n.parent()
> > Z[x]
>
> > what about this Z popping out of nowhere ? (well...) It's certainly
> > making my like (a little) more complicated (i have a more involved
> > example of course, and i proceed to look for prime divisors of the
> > numerator).
>
> This is just the general definition of numerator and denominator
> extended from Q to Q[x]. I don't see any other definition of numerator
> that would make more sense here...
>
> - Robert
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org