#14164: Error in NumberField.composite_fields()
-------------------------------------+-------------------------------------
Reporter: mmarco | Owner: davidloeffler
Type: defect | Status: positive_review
Priority: major | Milestone: sage-6.9
Component: number fields | Resolution:
Keywords: number field | Merged in:
Authors: Peter Bruin | Reviewers: Vincent Delecroix
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/pbruin/14164-composite_number_fields|
c108b70eb65b6a93c7c45a35998b8ad819874204
Dependencies: #13054, #252 | Stopgaps:
-------------------------------------+-------------------------------------
Changes (by vdelecroix):
* status: needs_review => positive_review
* reviewer: => Vincent Delecroix
* milestone: sage-6.8 => sage-6.9
Old description:
> The method `composite_fields()` of number fields fails when the defining
> polynomials are not monic and integral:
> {{{
> sage: R.<x>=QQ[]
> sage: f=6*x^5+x^4+x^2+5*x+7
> sage: r=f.roots(QQbar,multiplicities=False)
> sage: F1=NumberField(f.monic(),'a',embedding=r[0])
> sage: F2=NumberField(f.monic(),'a',embedding=r[1])
> sage: F1.composite_fields(F2,both_maps=True)
> ---------------------------------------------------------------------------
> TypeError Traceback (most recent call
> last)
> <ipython-input-6-dacb8cbc99b0> in <module>()
> ----> 1 F1.composite_fields(F2,both_maps=True)
>
> /usr/local/src/sage-5.7.beta1/local/lib/python2.7/site-
> packages/sage/rings/number_field/number_field.pyc in
> composite_fields(self, other, names, both_maps, preserve_embedding)
> 3805 i -= 1
> 3806 else:
> -> 3807 self_to_F = self.hom([F(a_in_F)])
> 3808 other_to_F = other.hom([F(b_in_F)])
> 3809 else:
>
> /usr/local/src/sage-5.7.beta1/local/lib/python2.7/site-
> packages/sage/structure/parent.so in
> sage.structure.parent.Parent.__call__ (sage/structure/parent.c:7415)()
>
> /usr/local/src/sage-5.7.beta1/local/lib/python2.7/site-
> packages/sage/structure/coerce_maps.so in
> sage.structure.coerce_maps.DefaultConvertMap_unique._call_
> (sage/structure/coerce_maps.c:3583)()
>
> /usr/local/src/sage-5.7.beta1/local/lib/python2.7/site-
> packages/sage/structure/coerce_maps.so in
> sage.structure.coerce_maps.DefaultConvertMap_unique._call_
> (sage/structure/coerce_maps.c:3485)()
>
> /usr/local/src/sage-5.7.beta1/local/lib/python2.7/site-
> packages/sage/rings/number_field/number_field.pyc in
> _element_constructor_(self, x)
> 1229 result += x[i]*self.gen(0)**i
> 1230 return result
> -> 1231 return self._coerce_non_number_field_element_in(x)
> 1232
> 1233 def _coerce_from_str(self, x):
>
> /usr/local/src/sage-5.7.beta1/local/lib/python2.7/site-
> packages/sage/rings/number_field/number_field.pyc in
> _coerce_non_number_field_element_in(self, x)
> 5732 integer.Integer, pari_gen,
> 5733 list)):
> -> 5734 return self._element_class(self, x)
> 5735
> 5736 if isinstance(x,
> sage.rings.polynomial.polynomial_quotient_ring_element.PolynomialQuotientRingElement)\
>
> /usr/local/src/sage-5.7.beta1/local/lib/python2.7/site-
> packages/sage/rings/number_field/number_field_element.so in
> sage.rings.number_field.number_field_element.NumberFieldElement.__init__
> (sage/rings/number_field/number_field_element.cpp:6018)()
>
> TypeError: Coercion of PARI polmod with modulus 10077696*x^20 -
> 6718464*x^19 - 559872*x^18 - 56173824*x^17 + 728401248*x^16 -
> 2136243456*x^15 + 1038731904*x^14 - 3715874496*x^13 + 21591002400*x^12 -
> 63829125504*x^11 + 414323181024*x^10 - 242460667872*x^9 +
> 573731183904*x^8 - 1417417413120*x^7 - 5375183629440*x^6 +
> 23136669276768*x^5 + 9900813726912*x^4 - 70740914752800*x^3 +
> 237933452109888*x^2 - 479963026372896*x + 500774065215360 into number
> field with defining polynomial 104976*x^20 - 69984*x^19 - 5832*x^18 -
> 585144*x^17 + 7587513*x^16 - 22252536*x^15 + 10820124*x^14 -
> 38707026*x^13 + 224906275*x^12 - 664886724*x^11 + 4315866469*x^10 -
> 2525631957*x^9 + 5976366499*x^8 - 14764764720*x^7 - 55991496140*x^6 +
> 241006971633*x^5 + 103133476322*x^4 - 736884528675*x^3 +
> 2478473459478*x^2 - 4999614858051*x + 5216396512660 failed
> }}}
New description:
The method `composite_fields()` of number fields used to fail when the
defining polynomials were not monic and integral:
{{{
sage: R.<x>=QQ[]
sage: f=6*x^5+x^4+x^2+5*x+7
sage: r=f.roots(QQbar,multiplicities=False)
sage: F1=NumberField(f.monic(),'a',embedding=r[0])
sage: F2=NumberField(f.monic(),'a',embedding=r[1])
sage: F1.composite_fields(F2,both_maps=True)
---------------------------------------------------------------------------
TypeError Traceback (most recent call
last)
<ipython-input-6-dacb8cbc99b0> in <module>()
----> 1 F1.composite_fields(F2,both_maps=True)
/usr/local/src/sage-5.7.beta1/local/lib/python2.7/site-
packages/sage/rings/number_field/number_field.pyc in
composite_fields(self, other, names, both_maps, preserve_embedding)
3805 i -= 1
3806 else:
-> 3807 self_to_F = self.hom([F(a_in_F)])
3808 other_to_F = other.hom([F(b_in_F)])
3809 else:
/usr/local/src/sage-5.7.beta1/local/lib/python2.7/site-
packages/sage/structure/parent.so in sage.structure.parent.Parent.__call__
(sage/structure/parent.c:7415)()
/usr/local/src/sage-5.7.beta1/local/lib/python2.7/site-
packages/sage/structure/coerce_maps.so in
sage.structure.coerce_maps.DefaultConvertMap_unique._call_
(sage/structure/coerce_maps.c:3583)()
/usr/local/src/sage-5.7.beta1/local/lib/python2.7/site-
packages/sage/structure/coerce_maps.so in
sage.structure.coerce_maps.DefaultConvertMap_unique._call_
(sage/structure/coerce_maps.c:3485)()
/usr/local/src/sage-5.7.beta1/local/lib/python2.7/site-
packages/sage/rings/number_field/number_field.pyc in
_element_constructor_(self, x)
1229 result += x[i]*self.gen(0)**i
1230 return result
-> 1231 return self._coerce_non_number_field_element_in(x)
1232
1233 def _coerce_from_str(self, x):
/usr/local/src/sage-5.7.beta1/local/lib/python2.7/site-
packages/sage/rings/number_field/number_field.pyc in
_coerce_non_number_field_element_in(self, x)
5732 integer.Integer, pari_gen,
5733 list)):
-> 5734 return self._element_class(self, x)
5735
5736 if isinstance(x,
sage.rings.polynomial.polynomial_quotient_ring_element.PolynomialQuotientRingElement)\
/usr/local/src/sage-5.7.beta1/local/lib/python2.7/site-
packages/sage/rings/number_field/number_field_element.so in
sage.rings.number_field.number_field_element.NumberFieldElement.__init__
(sage/rings/number_field/number_field_element.cpp:6018)()
TypeError: Coercion of PARI polmod with modulus 10077696*x^20 -
6718464*x^19 - 559872*x^18 - 56173824*x^17 + 728401248*x^16 -
2136243456*x^15 + 1038731904*x^14 - 3715874496*x^13 + 21591002400*x^12 -
63829125504*x^11 + 414323181024*x^10 - 242460667872*x^9 + 573731183904*x^8
- 1417417413120*x^7 - 5375183629440*x^6 + 23136669276768*x^5 +
9900813726912*x^4 - 70740914752800*x^3 + 237933452109888*x^2 -
479963026372896*x + 500774065215360 into number field with defining
polynomial 104976*x^20 - 69984*x^19 - 5832*x^18 - 585144*x^17 +
7587513*x^16 - 22252536*x^15 + 10820124*x^14 - 38707026*x^13 +
224906275*x^12 - 664886724*x^11 + 4315866469*x^10 - 2525631957*x^9 +
5976366499*x^8 - 14764764720*x^7 - 55991496140*x^6 + 241006971633*x^5 +
103133476322*x^4 - 736884528675*x^3 + 2478473459478*x^2 - 4999614858051*x
+ 5216396512660 failed
}}}
See also #18243. The bug is fixed in #252. We just ad add doctests for
both tickets.
--
Comment:
I changed the description a little bit.
--
Ticket URL: <http://trac.sagemath.org/ticket/14164#comment:12>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.