Opened 16 months ago

Last modified 3 months ago

#28599 new defect

RecursionError and AssertionError with regular_polygon

Reported by: jipilab Owned by:
Priority: major Milestone: sage-9.3
Component: geometry Keywords: polytopes
Cc: gh-LaisRast, gh-kliem, chapoton Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: public/28599 (Commits) Commit: 631b94b7ed3fd8da9ba96991991e80427f0dd0a6
Dependencies: Stopgaps:

Description

On sage 8.9 with python3, we get:

sage: polytopes.regular_polygon(16)
Traceback (most recent call last):
...
RecursionError: maximum recursion depth exceeded while calling a Python object

and

sage: polytopes.regular_polygon(20)
Traceback (most recent call last):
...
AssertionError:

The full traceback of the AssertionError? is in the first comment.

Change History (10)

comment:1 Changed 16 months ago by jipilab

sage: polytopes.regular_polygon(20)
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-2-9e11e60403ce> in <module>()
----> 1 polytopes.regular_polygon(Integer(20))

/home/jplabbe/sage/local/lib/python3.7/site-packages/sage/geometry/polyhedron/library.py in regular_polygon(self, n, exact, base_ring, backend)
    267             verts = [(base_ring((z**k).imag()), base_ring((z**k).real())) for k in range(n)]
    268 
--> 269         return Polyhedron(vertices=verts, base_ring=base_ring, backend=backend)
    270 
    271     def Birkhoff_polytope(self, n, backend=None):

/home/jplabbe/sage/local/lib/python3.7/site-packages/sage/geometry/polyhedron/constructor.py in Polyhedron(vertices, rays, lines, ieqs, eqns, ambient_dim, base_ring, minimize, verbose, backend)
    624     if got_Vrep:
    625         Vrep = [vertices, rays, lines]
--> 626     return parent(Vrep, Hrep, convert=convert, verbose=verbose)

/home/jplabbe/sage/local/lib/python3.7/site-packages/sage/structure/parent.pyx in sage.structure.parent.Parent.__call__ (build/cythonized/sage/structure/parent.c:9224)()
    900                 return mor._call_(x)
    901             else:
--> 902                 return mor._call_with_args(x, args, kwds)
    903 
    904         raise TypeError(_LazyString(_lazy_format, ("No conversion defined from %s to %s", R, self), {}))

/home/jplabbe/sage/local/lib/python3.7/site-packages/sage/structure/coerce_maps.pyx in sage.structure.coerce_maps.DefaultConvertMap_unique._call_with_args (build/cythonized/sage/structure/coerce_maps.c:5081)()
    179                 print(type(C), C)
    180                 print(type(C._element_constructor), C._element_constructor)
--> 181             raise
    182 
    183 

/home/jplabbe/sage/local/lib/python3.7/site-packages/sage/structure/coerce_maps.pyx in sage.structure.coerce_maps.DefaultConvertMap_unique._call_with_args (build/cythonized/sage/structure/coerce_maps.c:4969)()
    174                     return C._element_constructor(x, *args)
    175                 else:
--> 176                     return C._element_constructor(x, *args, **kwds)
    177         except Exception:
    178             if print_warnings:

/home/jplabbe/sage/local/lib/python3.7/site-packages/sage/geometry/polyhedron/parent.py in _element_constructor_(self, *args, **kwds)
    523             if convert and Vrep:
    524                 Vrep = [convert_base_ring(_) for _ in Vrep]
--> 525             return self.element_class(self, Vrep, Hrep, **kwds)
    526         if nargs == 1 and is_Polyhedron(args[0]):
    527             polyhedron = args[0]

/home/jplabbe/sage/local/lib/python3.7/site-packages/sage/geometry/polyhedron/backend_field.py in __init__(self, parent, Vrep, Hrep, Vrep_minimal, Hrep_minimal, **kwds)
    174             self._init_Hrepresentation(*Hrep)
    175         else:
--> 176             super(Polyhedron_field, self).__init__(parent, Vrep, Hrep, **kwds)
    177 
    178     def _init_from_Vrepresentation(self, vertices, rays, lines,

/home/jplabbe/sage/local/lib/python3.7/site-packages/sage/geometry/polyhedron/base.py in __init__(self, parent, Vrep, Hrep, **kwds)
    123         if Vrep is not None:
    124             vertices, rays, lines = Vrep
--> 125             self._init_from_Vrepresentation(vertices, rays, lines, **kwds)
    126         elif Hrep is not None:
    127             ieqs, eqns = Hrep

/home/jplabbe/sage/local/lib/python3.7/site-packages/sage/geometry/polyhedron/backend_field.py in _init_from_Vrepresentation(self, vertices, rays, lines, minimize, verbose)
    207         H = Vrep2Hrep(self.base_ring(), self.ambient_dim(), vertices, rays, lines)
    208         V = Hrep2Vrep(self.base_ring(), self.ambient_dim(),
--> 209                       H.inequalities, H.equations)
    210         self._init_Vrepresentation_backend(V)
    211         self._init_Hrepresentation_backend(H)

/home/jplabbe/sage/local/lib/python3.7/site-packages/sage/geometry/polyhedron/double_description_inhomogeneous.py in __init__(self, base_ring, dim, inequalities, equations)
    204         equations = [list(x) for x in equations]
    205         A = self._init_Vrep(inequalities, equations)
--> 206         DD = Algorithm(A).run()
    207         self._extract_Vrep(DD)
    208         if VERIFY_RESULT:

/home/jplabbe/sage/local/lib/python3.7/site-packages/sage/geometry/polyhedron/double_description.py in run(self)
    761         DD, remaining = self.initial_pair()
    762         for a in remaining:
--> 763             DD.add_inequality(a)
    764             if VERIFY_RESULT:
    765                 DD.verify()

/home/jplabbe/sage/local/lib/python3.7/site-packages/sage/geometry/polyhedron/double_description.py in add_inequality(self, a)
    712         R_new = []
    713         for rp, rn in itertools.product(R_pos, R_neg):
--> 714             if not self.are_adjacent(rp, rn):
    715                 continue
    716             r = a.inner_product(rp) * rn - a.inner_product(rn) * rp

/home/jplabbe/sage/local/lib/python3.7/site-packages/sage/geometry/polyhedron/double_description.py in are_adjacent(self, r1, r2)
    444             False
    445         """
--> 446         Z = self.zero_set(r1).intersection(self.zero_set(r2))
    447         if not Z:
    448             return self.problem.dim() == 2

/home/jplabbe/sage/local/lib/python3.7/site-packages/sage/geometry/polyhedron/double_description.py in zero_set(self, ray)
    373         n, t = self.zero_set_cache[ray]
    374         if n != len(self.A):
--> 375             t.update(self.A[i] for i in range(n,len(self.A)) if self.A[i].inner_product(ray) == self.zero)
    376             self.zero_set_cache[ray] = (len(self.A), t)
    377         return t

/home/jplabbe/sage/local/lib/python3.7/site-packages/sage/geometry/polyhedron/double_description.py in <genexpr>(.0)
    373         n, t = self.zero_set_cache[ray]
    374         if n != len(self.A):
--> 375             t.update(self.A[i] for i in range(n,len(self.A)) if self.A[i].inner_product(ray) == self.zero)
    376             self.zero_set_cache[ray] = (len(self.A), t)
    377         return t

/home/jplabbe/sage/local/lib/python3.7/site-packages/sage/structure/element.pyx in sage.structure.element.Element.__richcmp__ (build/cythonized/sage/structure/element.c:9922)()
   1089             # an instance of Element. The explicit casts below make
   1090             # Cython generate optimized code for this call.
-> 1091             return (<Element>self)._richcmp_(other, op)
   1092         else:
   1093             return coercion_model.richcmp(self, other, op)

/home/jplabbe/sage/local/lib/python3.7/site-packages/sage/structure/element.pyx in sage.structure.element.Element._richcmp_ (build/cythonized/sage/structure/element.c:10029)()
   1093             return coercion_model.richcmp(self, other, op)
   1094 
-> 1095     cpdef _richcmp_(left, right, int op):
   1096         r"""
   1097         Default implementation of rich comparisons for elements with

/home/jplabbe/sage/local/lib/python3.7/site-packages/sage/rings/qqbar.py in _richcmp_(self, other, op)
   4835                 return bool(other) == (op == op_NE)
   4836             elif type(od) is ANRational and not od._value:
-> 4837                 return bool(self) == (op == op_NE)
   4838             elif (type(sd) is ANExtensionElement and
   4839                   type(od) is ANExtensionElement and

/home/jplabbe/sage/local/lib/python3.7/site-packages/sage/rings/qqbar.py in __bool__(self)
   3523                 return True
   3524 
-> 3525             c = cmp_elements_with_same_minpoly(left, right, left.minpoly())
   3526             if c is not None:
   3527                 if c == 0:

/home/jplabbe/sage/local/lib/python3.7/site-packages/sage/rings/qqbar.py in cmp_elements_with_same_minpoly(a, b, p)
   2360     else:
   2361         ring = QQbar
-> 2362     roots = p.roots(ring, False)
   2363 
   2364     real = ar.union(br)

/home/jplabbe/sage/local/lib/python3.7/site-packages/sage/rings/polynomial/polynomial_element.pyx in sage.rings.polynomial.polynomial_element.Polynomial.roots (build/cythonized/sage/rings/polynomial/polynomial_element.c:61165)()
   7731 
   7732                 if is_AlgebraicRealField(L):
-> 7733                     rts = real_roots(self, retval='algebraic_real')
   7734                 else:
   7735                     diam = ~(ZZ(1) << L.prec())

/home/jplabbe/sage/local/lib/python3.7/site-packages/sage/rings/polynomial/real_roots.pyx in sage.rings.polynomial.real_roots.real_roots (build/cythonized/sage/rings/polynomial/real_roots.c:44073)()
   4053 
   4054             oc = ocean(ctx, bernstein_polynomial_factory_ratlist(b), linear_map(left, right))
-> 4055             oc.find_roots()
   4056             oceans.append((oc, factor, exp))
   4057 

/home/jplabbe/sage/local/lib/python3.7/site-packages/sage/rings/polynomial/real_roots.pyx in sage.rings.polynomial.real_roots.ocean.find_roots (build/cythonized/sage/rings/polynomial/real_roots.c:32942)()
   3069         """
   3070         while not self.all_done():
-> 3071             self.refine_all()
   3072             self.increase_precision()
   3073 

/home/jplabbe/sage/local/lib/python3.7/site-packages/sage/rings/polynomial/real_roots.pyx in sage.rings.polynomial.real_roots.ocean.refine_all (build/cythonized/sage/rings/polynomial/real_roots.c:33237)()
   3114         while isle is not self.endpoint:
   3115             if not isle.done(self.ctx):
-> 3116                 isle.refine(self.ctx)
   3117             isle = isle.rgap.risland
   3118 

/home/jplabbe/sage/local/lib/python3.7/site-packages/sage/rings/polynomial/real_roots.pyx in sage.rings.polynomial.real_roots.island.refine (build/cythonized/sage/rings/polynomial/real_roots.c:35552)()
   3367         self.shrink_bp(ctx)
   3368         try:
-> 3369             self.refine_recurse(ctx, self.bp, self.ancestors, [], True)
   3370         except PrecisionError:
   3371             pass

/home/jplabbe/sage/local/lib/python3.7/site-packages/sage/rings/polynomial/real_roots.pyx in sage.rings.polynomial.real_roots.island.refine_recurse (build/cythonized/sage/rings/polynomial/real_roots.c:36491)()
   3471                     rv = bp.try_rand_split(ctx, [])
   3472                 if rv is None:
-> 3473                     (ancestors, bp) = self.more_bits(ctx, ancestors, bp, rightmost)
   3474                     if rv is None:
   3475                         rv = bp.try_split(ctx, [])

/home/jplabbe/sage/local/lib/python3.7/site-packages/sage/rings/polynomial/real_roots.pyx in sage.rings.polynomial.real_roots.island.more_bits (build/cythonized/sage/rings/polynomial/real_roots.c:39047)()
   3617                     assert(rel_bounds[1] == 1)
   3618 
-> 3619                 ancestor_val = split_for_targets(ctx, ancestor_val, [(self.lgap, maybe_rgap, target_lsb_h)])[0]
   3620 #                 if rel_lbounds[1] > 0:
   3621 #                     left_split = -exact_rational(simple_wordsize_float(-rel_lbounds[1], -rel_lbounds[0]))

/home/jplabbe/sage/local/lib/python3.7/site-packages/sage/rings/polynomial/real_roots.pyx in sage.rings.polynomial.real_roots.split_for_targets (build/cythonized/sage/rings/polynomial/real_roots.c:31786)()
   2910             max_lsb = max([t[2] for t in tl1])
   2911             p1 = p1.down_degree_iter(ctx, max_lsb)
-> 2912         r1 = split_for_targets(ctx, p1, tl1)
   2913     else:
   2914         r1 = []

/home/jplabbe/sage/local/lib/python3.7/site-packages/sage/rings/polynomial/real_roots.pyx in sage.rings.polynomial.real_roots.split_for_targets (build/cythonized/sage/rings/polynomial/real_roots.c:30999)()
   2880     split = wordsize_rational(split_targets[best_index][0], split_targets[best_index][1], ctx.wordsize)
   2881 
-> 2882     (p1_, p2_, ok) = bp.de_casteljau(ctx, split, msign=split_targets[best_index][2])
   2883     assert(ok)
   2884 

/home/jplabbe/sage/local/lib/python3.7/site-packages/sage/rings/polynomial/real_roots.pyx in sage.rings.polynomial.real_roots.interval_bernstein_polynomial_integer.de_casteljau (build/cythonized/sage/rings/polynomial/real_roots.c:9100)()
    728             msign = sign
    729         elif sign != 0:
--> 730             assert(msign == sign)
    731 
    732         cdef Rational absolute_mid = self.lower + mid * (self.upper - self.lower)

AssertionError: 

comment:2 Changed 16 months ago by jipilab

  • Cc chapoton added

comment:3 Changed 14 months ago by gh-kliem

Minkowski sum of 3-gon and 8-gon fails for the same reason (it seems).

comment:4 Changed 14 months ago by gh-kliem

At least one of the problems, is the following polynomial:

sage: x = polygen(ZZ)
sage: p = x^4 - 953242354297818724703752509373294008993273880281503307750881459277750989380210829785430344332714372666685310888689163811627075803785878367343692267581868674262355536461240142664284693519394320653419989280981931805310642862110901030273756885722766438135722802125006982946730724089134972591648337179521335895506775892738040105250933785771678155298317930004572772706441205753132338170152805126505944177047591555414048614851799823325762040314246803785681217733628382625000/284661951904002202872640993073205372416085601*x^3 - 30712408728906837824436007395092863393836220556802908122405411503081893159534141046069917986518336650545184126375010296928998481657806406857280482570044966602970260824315388496271886156173475632228775359363070522704917567091005272564855859697539608132911947005950096833560245019249568419051453764745401260372146567432451459223482349455309387869128311408655626767098132057167066233264536886082536577749189845977342878132470579789445774525718429978750519923342579434950186624065140771232331860100535974716501530945373865273425252510527953175579253592022574532890542167552861231034786647165904068730166174154795302005807689993179771568339570525442184834458807496917824671504027310965100488346287613993408253136785746604795218431006804536475561431339093750000000/61119530504912696648935481199357970727*x^2 + 150921795442076031594623634352258246928488601400691240728540852473716672256682293428050838677947801687982699333615624718673041296948797660444940045131964082794334457693026029279281277048105532811535029576642684802051588919579838547672743504092642260363727743689262032542903034987995250319363859289381240034229894990128060909169794469573280531854720460953346200798634612581776964357250718226442893373286570213966569630517443223997021564703857421875000000/4657463*x + 422747915860318694374364472032237141148264052306702220749481741945894045574142738635283553650690525693771951595075694700927009281158447265625000000
sage: p.roots(QQbar)
[(-1.500582791467851?e296, 1),
 (-1.304604660101746?e-299, 1),
 (6.44864813030324?e-275, 1),
 (3.348681999550417?e423, 1)]

This works and it produces 4 real roots, as far as I can see. However, in AA it leads to the above type error.

Now on sage 8.9 with python2, it produces one root with AA and four roots with QQbar. So it didn't exactly work perfectly, but just good enough.

Last edited 14 months ago by gh-kliem (previous) (diff)

comment:5 Changed 14 months ago by gh-kliem

  • Branch set to public/28599
  • Commit set to 631b94b7ed3fd8da9ba96991991e80427f0dd0a6

I attached a very rough fix of the AssertionError.

It seems there is a random splitting that sometimes suceeds and sometimes not.

Even in python2 the following fails (it usually fails on one of the first tries, range(20) is just for good measure).

sage: from sage.rings.polynomial.real_roots import *
sage: x = polygen(ZZ)
sage: p = x^4 - 953242354297818724703752509373294008993273880281503307750881459277750989380210829785430344332714372666685310888689163811627075803785878367343692267581868674262355536461240142664284693519394320653419989280981931805310642862110901030273756885722766438135722802125006982946730724089134972591648337179521335895506775892738040105250933785771678155298317930004572772706441205753132338170152805126505944177047591555414048614851799823325762040314246803785681217733628382625000/284661951904002202872640993073205372416085601*x^3 - 30712408728906837824436007395092863393836220556802908122405411503081893159534141046069917986518336650545184126375010296928998481657806406857280482570044966602970260824315388496271886156173475632228775359363070522704917567091005272564855859697539608132911947005950096833560245019249568419051453764745401260372146567432451459223482349455309387869128311408655626767098132057167066233264536886082536577749189845977342878132470579789445774525718429978750519923342579434950186624065140771232331860100535974716501530945373865273425252510527953175579253592022574532890542167552861231034786647165904068730166174154795302005807689993179771568339570525442184834458807496917824671504027310965100488346287613993408253136785746604795218431006804536475561431339093750000000/61119530504912696648935481199357970727*x^2 + 150921795442076031594623634352258246928488601400691240728540852473716672256682293428050838677947801687982699333615624718673041296948797660444940045131964082794334457693026029279281277048105532811535029576642684802051588919579838547672743504092642260363727743689262032542903034987995250319363859289381240034229894990128060909169794469573280531854720460953346200798634612581776964357250718226442893373286570213966569630517443223997021564703857421875000000/4657463*x + 422747915860318694374364472032237141148264052306702220749481741945894045574142738635283553650690525693771951595075694700927009281158447265625000000
sage: factor, left, right = (284661951904002202872640993073205372416085601*x^4 - 953242354297818724703752509373294008993273880281503307750881459277750989380210829785430344332714372666685310888689163811627075803785878367343692267581868674262355536461240142664284693519394320653419989280981931805310642862110901030273756885722766438135722802125006982946730724089134972591648337179521335895506775892738040105250933785771678155298317930004572772706441205753132338170152805126505944177047591555414048614851799823325762040314246803785681217733628382625000*x^3 - 143041907295760627614311200310371392820846625303148942872502675075378303360483359158851938435243651771458124896778934582565824055377412001100730128192129340289569679889598422252011947712590184338507128771545204525888813486776374689775731266874481915913536475438173355848723999448089152677700641005512410790336638868393647670629377773741173627553113952638291461409569167425369495799978949759064629057013474987615173293215490823957891485359876136044121332773730900042841401044678302731806050042139422582411041369821433798677962996833441052380992877172462236051679983195317251727678970522069253061660205939977515391665875101258705038427993521158137534505653020941017382448017161551809449815754765749532581182879213553739209352419332244876867077770688869594156250000000*x^2 + 9224269280378159995086175956599156896246052775964623781473039459314278625189639357821542855810535420201241102250640064464729153254638828194214182633761289776904830148558523602353033080183173926606667803263737366192099310316607083404573347178766118989259952930345144406752496177427851926390971866913094192923444722805841141305928789763257595182877391253154218411290329529480038030212118404992939819004238133784189703469017999758183942287839221428776394999468692651292391209137939453125000000*x + 120340246892147210219925300245948427935624593297607357599380720896699146352972193191072575586572678017171737630079862986465889308813652352169438608150972047865521402530851444244384765625000000, -300116558293571858482887344849275704852462363716019298869701069535049699520357009140806578533610775590465036648456421628927951845701119829826990780533505317207095422744616966278783897429699030687513847719851964893907284704084454895267147108732448327646270701568981710607368843500980539555936468992, 6697363999101269501879270474853023006070891635062527574088015888493332207497411312232478630319160871182105545664990115586397447784674611836869069877381887649421512272089736918413918361100105903569317442150105716914981851659214570137801851169316697850787303236156131820593525165861969674761404545709833999974365728934357748559327296686364108483990990732078449920377271073812649747385445940616777427079802648444067616380682240)
sage: b, _ = to_bernstein(factor, left, right)
sage: for _ in range(20):
....:     oc = ocean(ctx, bernstein_polynomial_factory_ratlist(b), linear_map(left, right))
....:     oc.find_roots()

The RecursionError is not due to python3. I can confirm it on 8.9 with python2.


New commits:

631b94bfixed assertion error

comment:6 Changed 13 months ago by embray

  • Milestone changed from sage-9.0 to sage-9.1

Ticket retargeted after milestone closed

comment:7 Changed 12 months ago by jipilab

Ok, sorry for the code below: it is really absurd, but this is a minimal example that reproduces the assertion error in qqbar.py:

sage: R.<y> = QQ[]
....: v = QQbar.polynomial_root(AA.common_polynomial(y^8 - y^6 + y^4 - y^2 + 1), CIF(RIF(RR(0.95105651629515353), RR(0.95105651629515364)), RIF(-RR(0.30901699437494745), -RR(0.3090169943749474))))
....: a_number = AA(-1773771227584385815111706893900949861104891064242305307966022333822496428028500035508902583036959204537264766688321220890672517171823317808444268672562745271414504003966433029471689554196791
....: 5196235296422815147978121107870040525130223651405219411067699495095272994455972342474052940895134978233663383602877952342919741122636119080859978049638078126779759346806919160609037291355471699756013044209
....: 5483312355231935640717206940736751368480492837953720652079332615152682064295095556319063104680015601631633229123069680423355253651835771389161420669292788796852682051422632099371271239353524132124196618633
....: 2160000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*v^7 - 12887202317923319885943420189176756357017971481590243494049948312127392394950104866911220670604451981908195
....: 8371080579394652756244399575137821254432548212435032939204787697691800132061253609371701669030357778863333316506044361636419736535751486490104132379200110340372244885858365012832634472573036026206878368127
....: 4403312308602332477387245462097752958540406894753567138144162162830699381430715772140638003750075504753961256023217632033417260215017516961209975697136152079055069133883360478756682301727586481082919679927
....: 346903746616198168008384223379509077316072155415326731906073506029658642131621102223360000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*v^6 + 109625090691377547730317
....: 5525461587798537717289790603520304664538731755281336113088133438052235985811711264623428593477576263418689317982595042012576163465389907461365436265806375130916851598442483541901104806315869307809855562740
....: 6445672120427286487049790216349623417313217054330667097678476903242997891805602152830197407775897647700836990651946532719071456891625597407900569788677899489585009768054349575473650811338764570104063140021
....: 2125979916738435487238216764650063240891980812637635866900695826461943011019456949752340956493135510291161033135835062005451967614863014799283888581011579510801276338176000000000000000000000000000000000000
....: 0000000000000000000000000000000000000000000000000000*v^5 + 12887202317923319885943420189176756357017971481590243494049948312127392394950104866911220670604451981908195837108057939465275624439957513782125443
....: 2548212435032939204787697691800132061253609371701669030357778863333316506044361636419736535751486490104132379200110340372244885858365012832634472573036026206878368127440331230860233247738724546209775295854
....: 0406894753567138144162162830699381430715772140638003750075504753961256023217632033417260215017516961209975697136152079055069133883360478756682301727586481082919679927346903746616198168008384223379509077316
....: 072155415326731906073506029658642131621102223360000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*v^4 - 418730586243165139494644157022225735970543515338901732643306743
....: 6410141346437261407579735214350124188852644801688657342618543202068126473816397564797641855084004187269060985832785722795064053653435541599280978339265048327070729682667692835635161906400085337426252378654
....: 0916346083933002219755728226121807332519627406536929156762145416959316658149386583835669763320342067638482218840992231569753265603679154241080586058084461344511431943759121879756218895143818376618062186688
....: 4053062121670537857900212906568989692334761494282611504996314209013969788813271582218838070939302272965378084990268974059340431360000000000000000000000000000000000000000000000000000000000000000000000000000
....: 000000000000*v^3 + 219250181382755095460635105092317559707543457958120704060932907746351056267222617626687610447197162342252924685718695515252683737863596519008402515232693077981492273087253161275026183370
....: 3196884967083802209612631738615619711125481289134424085457297409958043269924683462643410866133419535695380648599578361120430566039481555179529540167398130389306543814291378325119481580113957735579897917001
....: 9536108699150947301622677529140208126280042425195983347687097447643352930012648178396162527527173380139165292388602203891389950468191298627102058232206627167012401090393522972602959856777716202315902160255
....: 26763520000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*v + 208519313702963597792336448786317458130536687422413888526129565922315681346997072734539440533222683616661
....: 4384583809766515221558834445288019146840810180903574691941264335750287299470453620747381862497725467514438329784936550147777229904858656572513646687903172788172469701042793458805351874145798281602789169681
....: 1948462863215323138930427663128389970365407923962972793099139809598960779704194025933542338930154982759123957616825638010555288518111106330271564293946050035319773173496755745234560502323512208937117129886
....: 49294252668653137958243183218418023585981434178543521437938796526970908651227517508648960000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) + AA(1773771227584385815111
....: 7068939009498611048910642423053079660223338224964280285000355089025830369592045372647666883212208906725171718233178084442686725627452714145040039664330294716895541967915196235296422815147978121107870040525
....: 1302236514052194110676994950952729944559723424740529408951349782336633836028779523429197411226361190808599780496380781267797593468069191606090372913554716997560130442095483312355231935640717206940736751368
....: 4804928379537206520793326151526820642950955563190631046800156016316332291230696804233552536518357713891614206692927887968526820514226320993712712393535241321241966186332160000000000000000000000000000000000
....: 000000000000000000000000000000000000000000000000000000*v^7 + 128872023179233198859434201891767563570179714815902434940499483121273923949501048669112206706044519819081958371080579394652756244399575137821254
....: 4325482124350329392047876976918001320612536093717016690303577788633333165060443616364197365357514864901041323792001103403722448858583650128326344725730360262068783681274403312308602332477387245462097752958
....: 5404068947535671381441621628306993814307157721406380037500755047539612560232176320334172602150175169612099756971361520790550691338833604787566823017275864810829196799273469037466161981680083842233795090773
....: 16072155415326731906073506029658642131621102223360000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*v^6 - 1096250906913775477303175525461587798537717289790603520304664
....: 5387317552813361130881334380522359858117112646234285934775762634186893179825950420125761634653899074613654362658063751309168515984424835419011048063158693078098555627406445672120427286487049790216349623417
....: 3132170543306670976784769032429978918056021528301974077758976477008369906519465327190714568916255974079005697886778994895850097680543495754736508113387645701040631400212125979916738435487238216764650063240
....: 8919808126376358669006958264619430110194569497523409564931355102911610331358350620054519676148630147992838885810115795108012763381760000000000000000000000000000000000000000000000000000000000000000000000000
....: 000000000000000*v^5 - 128872023179233198859434201891767563570179714815902434940499483121273923949501048669112206706044519819081958371080579394652756244399575137821254432548212435032939204787697691800132061
....: 2536093717016690303577788633333165060443616364197365357514864901041323792001103403722448858583650128326344725730360262068783681274403312308602332477387245462097752958540406894753567138144162162830699381430
....: 7157721406380037500755047539612560232176320334172602150175169612099756971361520790550691338833604787566823017275864810829196799273469037466161981680083842233795090773160721554153267319060735060296586421316
....: 21102223360000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*v^4 + 4187305862431651394946441570222257359705435153389017326433067436410141346437261407579735214350124188
....: 8526448016886573426185432020681264738163975647976418550840041872690609858327857227950640536534355415992809783392650483270707296826676928356351619064000853374262523786540916346083933002219755728226121807332
....: 5196274065369291567621454169593166581493865838356697633203420676384822188409922315697532656036791542410805860580844613445114319437591218797562188951438183766180621866884053062121670537857900212906568989692
....: 334761494282611504996314209013969788813271582218838070939302272965378084990268974059340431360000000000000000000000000000000000000000000000000000000000000000000000000000000000000000*v^3 - 219250181382755095
....: 4606351050923175597075434579581207040609329077463510562672226176266876104471971623422529246857186955152526837378635965190084025152326930779814922730872531612750261833703196884967083802209612631738615619711
....: 1254812891344240854572974099580432699246834626434108661334195356953806485995783611204305660394815551795295401673981303893065438142913783251194815801139577355798979170019536108699150947301622677529140208126
....: 2800424251959833476870974476433529300126481783961625275271733801391652923886022038913899504681912986271020582322066271670124010903935229726029598567777162023159021602552676352000000000000000000000000000000
....: 0000000000000000000000000000000000000000000000000000000000*v - 2085193137029635977923364487863174581305366874224138885261295659223156813469970727345394405332226836166614384583809766515221558834445288019146
....: 8408101809035746919412643357502872994704536207473818624977254675144383297849365501477772299048586565725136466879031727881724697010427934588053518741457982816027891696811948462863215323138930427663128389970
....: 3654079239629727930991398095989607797041940259335423389301549827591239576168256380105552885181111063302715642939460500353197731734967557452345605023235122089371171298864929425266865313795824318321841802358
....: 5981434178543521437938796526970908651227517508648960000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)
....: 
sage: bool(a_number)

a_number seems to be pretty close to zero, but evaluating bool(a_number) is just too much to handle...

Looking at this, I am really stunned by the size of the coefficients there... Even better, if before running bool(a_number) we ask for its minimal polynomial, it changes its repr(!?) and then it is possible to evaluate bool(a_number) without an issue. What the heck?

sage: a_number
0.?e672
sage: a_number.minpoly()
x
sage: a_number
0
sage: bool(a_number)
False
Last edited 12 months ago by jipilab (previous) (diff)

comment:8 Changed 12 months ago by jipilab

For the recursion error, it is obtained through the following:

sage: R.<x> = QQ[]
....: p = x^4 - 785085354174377760378543488111323044749776571631209495946379816236515588853583855784535326960526508097636330877798625485321064091382548770084769695089257246049553938280772932180561801873783457940
....: 7623236326202557782135972832786016308591922054201949779233079296*x^3 - 39106193696419400676420574963932594736160172155690837888708921665618371452344263107004249679119699863114892743908514315776394551509920
....: 758420273580999694164311317393649793536718487328933034394305606610547548695572114475418861859185723418418335449088*x^2 + 698934161024097912313988531912594419543524661831111252286197385013781031639372622775
....: 475026510556965115793039835522307708645909510694502414254723699140720599682877047132487963818434541534769581913895075840*x - 3450873173395281893717377931138512726225554486085193277581262111899648
....: p.roots(AA, False)
Traceback (most recent call last):
...
RecursionError: maximum recursion depth exceeded

comment:9 Changed 9 months ago by mkoeppe

  • Milestone changed from sage-9.1 to sage-9.2

Moving tickets to milestone sage-9.2 based on a review of last modification date, branch status, and severity.

comment:10 Changed 3 months ago by mkoeppe

  • Milestone changed from sage-9.2 to sage-9.3
Note: See TracTickets for help on using tickets.