Opened 8 years ago

Closed 8 years ago

# Error in pari when dealing with algebraic numbers

Reported by: Owned by: mmarco davidloeffler major sage-duplicate/invalid/wontfix number fields pari, QQbar, algebraic numbers jdemeyer Jeroen Demeyer N/A

### Description

When doing some computations with algebraic numbers, a pari error appears.

Example:

```sage: R.<x>=QQbar[]
sage: f=x^7-x^3+5*x^2+1
sage: rot=[a[0] for a in f.roots()]
sage: g=(rot[5]-1)*x^5+(rot[3]*rot[1]/rot[2]-7/19)*x^3+x^2-12
sage: g.roots()
[(-1.649909503989884? + 0.4886425174359812?*I, 1), (-1.199661475182448? - 1.295842128063049?*I, 1), (0.0801663732009155? + 1.775631861665457?*I, 1), (1.088620639516355? - 1.373857910797616?*I, 1), (1.680783966455062? + 0.4054256597592278?*I, 1)]
sage: g.roots()[0][0].exactify()
---------------------------------------------------------------------------
PariError                                 Traceback (most recent call last)

/home/mmarco/<ipython console> in <module>()

/usr/lib64/python2.7/site-packages/sage/rings/qqbar.pyc in exactify(self)
3464         od = self._descr
3465         if od.is_exact(): return
-> 3466         self._set_descr(self._descr.exactify())
3467
3468     def _set_descr(self, new_descr):

/usr/lib64/python2.7/site-packages/sage/rings/qqbar.pyc in exactify(self)
6449             x^8 - 5/4*x^4 + 5/16
6450         """
-> 6451         gen = self._poly.generator()
6452
6453         if gen.is_trivial():

/usr/lib64/python2.7/site-packages/sage/rings/qqbar.pyc in generator(self)
5864             Number Field in a with defining polynomial y^4 - 4*y^2 + 1 with a in 1.931851652578137?
5865         """
-> 5866         self.exactify()
5867         return self._gen
5868

/usr/lib64/python2.7/site-packages/sage/rings/qqbar.pyc in exactify(self)
5822
5823         for c in self._poly.list():
-> 5824             c.exactify()
5825             gen = gen.union(c._exact_field())
5826

/usr/lib64/python2.7/site-packages/sage/rings/qqbar.pyc in exactify(self)
3464         od = self._descr
3465         if od.is_exact(): return
-> 3466         self._set_descr(self._descr.exactify())
3467
3468     def _set_descr(self, new_descr):

/usr/lib64/python2.7/site-packages/sage/rings/qqbar.pyc in exactify(self)
7590             right = self._right
7591             left.exactify()
-> 7592             right.exactify()
7593             gen = left._exact_field().union(right._exact_field())
7594             left_value = gen(left._exact_value())

/usr/lib64/python2.7/site-packages/sage/rings/qqbar.pyc in exactify(self)
3464         od = self._descr
3465         if od.is_exact(): return
-> 3466         self._set_descr(self._descr.exactify())
3467
3468     def _set_descr(self, new_descr):

/usr/lib64/python2.7/site-packages/sage/rings/qqbar.pyc in exactify(self)
7589             left = self._left
7590             right = self._right
-> 7591             left.exactify()
7592             right.exactify()
7593             gen = left._exact_field().union(right._exact_field())

/usr/lib64/python2.7/site-packages/sage/rings/qqbar.pyc in exactify(self)
3464         od = self._descr
3465         if od.is_exact(): return
-> 3466         self._set_descr(self._descr.exactify())
3467
3468     def _set_descr(self, new_descr):

/usr/lib64/python2.7/site-packages/sage/rings/qqbar.pyc in exactify(self)
7590             right = self._right
7591             left.exactify()
-> 7592             right.exactify()
7593             gen = left._exact_field().union(right._exact_field())
7594             left_value = gen(left._exact_value())

/usr/lib64/python2.7/site-packages/sage/rings/qqbar.pyc in exactify(self)
3464         od = self._descr
3465         if od.is_exact(): return
-> 3466         self._set_descr(self._descr.exactify())
3467
3468     def _set_descr(self, new_descr):

/usr/lib64/python2.7/site-packages/sage/rings/qqbar.pyc in exactify(self)
7589             left = self._left
7590             right = self._right
-> 7591             left.exactify()
7592             right.exactify()
7593             gen = left._exact_field().union(right._exact_field())

/usr/lib64/python2.7/site-packages/sage/rings/qqbar.pyc in exactify(self)
3464         od = self._descr
3465         if od.is_exact(): return
-> 3466         self._set_descr(self._descr.exactify())
3467
3468     def _set_descr(self, new_descr):

/usr/lib64/python2.7/site-packages/sage/rings/qqbar.pyc in exactify(self)
7324
7325         if op == '-':
-> 7326             arg.exactify()
7327             return arg._descr.neg(None)
7328

/usr/lib64/python2.7/site-packages/sage/rings/qqbar.pyc in exactify(self)
3464         od = self._descr
3465         if od.is_exact(): return
-> 3466         self._set_descr(self._descr.exactify())
3467
3468     def _set_descr(self, new_descr):

/usr/lib64/python2.7/site-packages/sage/rings/qqbar.pyc in exactify(self)
7589             left = self._left
7590             right = self._right
-> 7591             left.exactify()
7592             right.exactify()
7593             gen = left._exact_field().union(right._exact_field())

/usr/lib64/python2.7/site-packages/sage/rings/qqbar.pyc in exactify(self)
3464         od = self._descr
3465         if od.is_exact(): return
-> 3466         self._set_descr(self._descr.exactify())
3467
3468     def _set_descr(self, new_descr):

/usr/lib64/python2.7/site-packages/sage/rings/qqbar.pyc in exactify(self)
7589             left = self._left
7590             right = self._right
-> 7591             left.exactify()
7592             right.exactify()
7593             gen = left._exact_field().union(right._exact_field())

/usr/lib64/python2.7/site-packages/sage/rings/qqbar.pyc in exactify(self)
3464         od = self._descr
3465         if od.is_exact(): return
-> 3466         self._set_descr(self._descr.exactify())
3467
3468     def _set_descr(self, new_descr):

/usr/lib64/python2.7/site-packages/sage/rings/qqbar.pyc in exactify(self)
7324
7325         if op == '-':
-> 7326             arg.exactify()
7327             return arg._descr.neg(None)
7328

/usr/lib64/python2.7/site-packages/sage/rings/qqbar.pyc in exactify(self)
3464         od = self._descr
3465         if od.is_exact(): return
-> 3466         self._set_descr(self._descr.exactify())
3467
3468     def _set_descr(self, new_descr):

/usr/lib64/python2.7/site-packages/sage/rings/qqbar.pyc in exactify(self)
7589             left = self._left
7590             right = self._right
-> 7591             left.exactify()
7592             right.exactify()
7593             gen = left._exact_field().union(right._exact_field())

/usr/lib64/python2.7/site-packages/sage/rings/qqbar.pyc in exactify(self)
3464         od = self._descr
3465         if od.is_exact(): return
-> 3466         self._set_descr(self._descr.exactify())
3467
3468     def _set_descr(self, new_descr):

/usr/lib64/python2.7/site-packages/sage/rings/qqbar.pyc in exactify(self)
7590             right = self._right
7591             left.exactify()
-> 7592             right.exactify()
7593             gen = left._exact_field().union(right._exact_field())
7594             left_value = gen(left._exact_value())

/usr/lib64/python2.7/site-packages/sage/rings/qqbar.pyc in exactify(self)
3464         od = self._descr
3465         if od.is_exact(): return
-> 3466         self._set_descr(self._descr.exactify())
3467
3468     def _set_descr(self, new_descr):

/usr/lib64/python2.7/site-packages/sage/rings/qqbar.pyc in exactify(self)
7589             left = self._left
7590             right = self._right
-> 7591             left.exactify()
7592             right.exactify()
7593             gen = left._exact_field().union(right._exact_field())

/usr/lib64/python2.7/site-packages/sage/rings/qqbar.pyc in exactify(self)
3464         od = self._descr
3465         if od.is_exact(): return
-> 3466         self._set_descr(self._descr.exactify())
3467
3468     def _set_descr(self, new_descr):

/usr/lib64/python2.7/site-packages/sage/rings/qqbar.pyc in exactify(self)
7589             left = self._left
7590             right = self._right
-> 7591             left.exactify()
7592             right.exactify()
7593             gen = left._exact_field().union(right._exact_field())

/usr/lib64/python2.7/site-packages/sage/rings/qqbar.pyc in exactify(self)
3464         od = self._descr
3465         if od.is_exact(): return
-> 3466         self._set_descr(self._descr.exactify())
3467
3468     def _set_descr(self, new_descr):

/usr/lib64/python2.7/site-packages/sage/rings/qqbar.pyc in exactify(self)
7589             left = self._left
7590             right = self._right
-> 7591             left.exactify()
7592             right.exactify()
7593             gen = left._exact_field().union(right._exact_field())

/usr/lib64/python2.7/site-packages/sage/rings/qqbar.pyc in exactify(self)
3464         od = self._descr
3465         if od.is_exact(): return
-> 3466         self._set_descr(self._descr.exactify())
3467
3468     def _set_descr(self, new_descr):

/usr/lib64/python2.7/site-packages/sage/rings/qqbar.pyc in exactify(self)
7589             left = self._left
7590             right = self._right
-> 7591             left.exactify()
7592             right.exactify()
7593             gen = left._exact_field().union(right._exact_field())

/usr/lib64/python2.7/site-packages/sage/rings/qqbar.pyc in exactify(self)
3464         od = self._descr
3465         if od.is_exact(): return
-> 3466         self._set_descr(self._descr.exactify())
3467
3468     def _set_descr(self, new_descr):

/usr/lib64/python2.7/site-packages/sage/rings/qqbar.pyc in exactify(self)
7591             left.exactify()
7592             right.exactify()
-> 7593             gen = left._exact_field().union(right._exact_field())
7594             left_value = gen(left._exact_value())
7595             right_value = gen(right._exact_value())

/usr/lib64/python2.7/site-packages/sage/rings/qqbar.pyc in union(self, other)
2280         newpol_sage_y = QQy(newpol_sage)
2281
-> 2282         red_elt, red_back, red_pol = do_polred(newpol_sage_y)
2283
2284         red_back_x = QQx(red_back)

/usr/lib64/python2.7/site-packages/sage/rings/qqbar.pyc in do_polred(poly)
1561     assert(best is not None)
1562     parent = poly.parent()
-> 1563     rev = parent(best_elt.Mod(pari_poly).modreverse().lift())
1564     return parent(best_elt), rev, parent(best)
1565

/usr/lib64/python2.7/site-packages/sage/libs/pari/gen.so in sage.libs.pari.gen._pari_trap (sage/libs/pari/gen.c:54863)()

PariError:  (5)

```

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

• Authors mmarco deleted
• Milestone changed from sage-5.8 to sage-duplicate/invalid/wontfix
• Reviewers set to Jeroen Demeyer
• Status changed from new to needs_review

This looks like a duplicate of #13054.

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

• Status changed from needs_review to positive_review

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

The Galois group of the polynomial `x^7-x^3+5*x^2+1` is S_7, so the computation is never going to finish: the field defined by 4 roots has degree 840.

### comment:4 Changed 8 years ago by jdemeyer

• Resolution set to duplicate
• Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.