Ask Your Question

Revision history [back]

Mapping between isomorphic NumberFields

If I set up two NumberFields that differ only in the variable used in their defining polynomials, they don't report equal:

sage: a=QQ['a'].0
sage: aRing = NumberField(a^2 + 1, 'a')
sage: 
sage: b=QQ['b'].0
sage: bRing = NumberField(b^2 + 1, 'a')
sage: 
sage: aRing is bRing
False

This I can live with. But shouldn't I be able to convert elements between them?

sage: aa=aRing.0
sage: bb=bRing.0
sage: bRing(aa)
TypeError: No compatible natural embeddings found for Number Field in a with defining polynomial b^2 + 1 and Number Field in a with defining polynomial a^2 + 1

I can convert like this:

sage: bbb = aa.polynomial()(bb)
sage: bbb.parent() == bRing
True

...but this seems awkward, and requires defining an auxilary function if you want to pass it to map or map_coefficients.

Is this a bug? Should I report it on Sage's Trac, or is there a good reason for this?