Opened 9 years ago

Closed 7 years ago

# Error in NumberField.composite_fields()

Reported by: Owned by: mmarco davidloeffler major sage-6.9 number fields number field wstein, robertwb, jdemeyer Peter Bruin Vincent Delecroix N/A c108b70 c108b70eb65b6a93c7c45a35998b8ad819874204

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
```

### comment:1 Changed 9 years ago by jdemeyer

This is at least partially a duplicate of #13054, in the sense that #13054 changes the error message to

```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
```

### comment:2 Changed 9 years ago by jdemeyer

• Dependencies set to #13054
• Description modified (diff)

### comment:3 Changed 9 years ago by jdemeyer

• Cc changed from wstein,robertwb,jdemeyer to wstein, robertwb, jdemeyer
• Milestone changed from sage-5.11 to sage-5.12

### comment:4 Changed 9 years ago by vbraun_spam

• Milestone changed from sage-6.1 to sage-6.2

### comment:5 Changed 8 years ago by vbraun_spam

• Milestone changed from sage-6.2 to sage-6.3

### comment:6 Changed 8 years ago by vbraun_spam

• Milestone changed from sage-6.3 to sage-6.4

### comment:7 Changed 7 years ago by pbruin

• Dependencies changed from #13054 to #13054, #252
• Description modified (diff)
• Milestone changed from sage-6.4 to sage-6.8

See also #18243. The bug should soon be fixed by #252; let's use this ticket to add doctests for both tickets.

### comment:8 Changed 7 years ago by pbruin

• Branch set to u/pbruin/14164-composite_number_fields
• Commit set to 47790f45d458c4b8bc6138a7309ab548e0ebe145
• Status changed from new to needs_review

### comment:9 Changed 7 years ago by pbruin

• Authors set to Peter Bruin

### comment:10 Changed 7 years ago by git

• Commit changed from 47790f45d458c4b8bc6138a7309ab548e0ebe145 to 688f8fa50b32cdec702e9638f41bf56ce4121790

Branch pushed to git repo; I updated commit sha1. New commits:

 ​688f8fa `Trac 14164: check degree of composite fields in doctests`

### comment:11 Changed 7 years ago by git

• Commit changed from 688f8fa50b32cdec702e9638f41bf56ce4121790 to c108b70eb65b6a93c7c45a35998b8ad819874204

Branch pushed to git repo; I updated commit sha1. New commits:

 ​c108b70 `Merge branch 'develop' into ticket/14164-composite_number_fields`

### comment:12 Changed 7 years ago by vdelecroix

• Description modified (diff)
• Milestone changed from sage-6.8 to sage-6.9
• Reviewers set to Vincent Delecroix
• Status changed from needs_review to positive_review

I changed the description a little bit.

### comment:13 Changed 7 years ago by vbraun

• Dependencies changed from #13054, #252 to #13054

### comment:14 Changed 7 years ago by vbraun

• Dependencies #13054 deleted

### comment:15 Changed 7 years ago by vbraun

• Status changed from positive_review to needs_work

On some 32-bit machines I get now

```sage -t --long src/sage/modular/modform/ambient.py
**********************************************************************
File "src/sage/modular/modform/ambient.py", line 812, in sage.modular.modform.ambient.?._compute_hecke_matrix
Failed example:
f = t.charpoly()                   # long time (4s)
Exception raised:
Traceback (most recent call last):
File "/home/buildbot/slave/sage_git/build/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 496, in _run
self.compile_and_execute(example, compiler, test.globs)
File "/home/buildbot/slave/sage_git/build/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 858, in compile_and_execute
exec(compiled, globs)
File "<doctest sage.modular.modform.ambient.?._compute_hecke_matrix[4]>", line 1, in <module>
f = t.charpoly()                   # long time (4s)
File "sage/matrix/matrix_integer_dense.pyx", line 1251, in sage.matrix.matrix_integer_dense.Matrix_integer_dense.charpoly (/home/buildbot/slave/sage_git/build/src/build/cythonized/sage/matrix/matrix_integer_dense.c:12808)
g = self._charpoly_linbox(var)
File "sage/matrix/matrix_integer_dense.pyx", line 1304, in sage.matrix.matrix_integer_dense.Matrix_integer_dense._charpoly_linbox (/home/buildbot/slave/sage_git/build/src/build/cythonized/sage/matrix/matrix_integer_dense.c:13608)
return self._poly_linbox(var=var, typ='charpoly')
File "sage/matrix/matrix_integer_dense.pyx", line 1327, in sage.matrix.matrix_integer_dense.Matrix_integer_dense._poly_linbox (/home/buildbot/slave/sage_git/build/src/build/cythonized/sage/matrix/matrix_integer_dense.c:13967)
sig_on()
File "sage/libs/ntl/error.pyx", line 42, in sage.libs.ntl.error.NTL_error_callback (/home/buildbot/slave/sage_git/build/src/build/cythonized/sage/libs/ntl/error.cpp:756)
raise NTLError(s)
NTLError: FFT prime index too large
**********************************************************************
```

### comment:16 Changed 7 years ago by vbraun

• Status changed from needs_work to positive_review

Hmm must be a different ticket...

### comment:17 Changed 7 years ago by vbraun

• Branch changed from u/pbruin/14164-composite_number_fields to c108b70eb65b6a93c7c45a35998b8ad819874204
• Resolution set to fixed
• Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.