-
-
Notifications
You must be signed in to change notification settings - Fork 685
Description
sage: enumerate_totallyreal_fields_all(8, 10^8)
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
/home/jvoight/sage-4.2/devel/sage-main/sage/rings/number_field/<ipython console> in <module>()
/usr/local/share/sage-5.0/local/lib/python2.7/site-packages/sage/rings/number_field/totallyreal_rel.pyc in enumerate_totallyreal_fields_all(n, B, verbose, return_seqs)
887 print "Taking F =", Sds[i][1]
888 F = NumberField(ZZx(Sds[i][1]), 't')
--> 889 T = enumerate_totallyreal_fields_rel(F, n/d, B, verbose=verbose, return_seqs=return_seqs)
890 if return_seqs:
891 for i in range(3):
/usr/local/share/sage-5.0/local/lib/python2.7/site-packages/sage/rings/number_field/totallyreal_rel.pyc in enumerate_totallyreal_fields_rel(F, m, B, a, verbose, return_seqs)
726 T.incr(f_out,verbose)
727 else:
--> 728 T.incr(f_out)
729
730 Fx = PolynomialRing(F, 'xF')
/usr/local/share/sage-5.0/local/lib/python2.7/site-packages/sage/rings/number_field/totallyreal_rel.pyc in incr(self, f_out, verbose, haltk)
542 # New bounds from Lagrange multiplier in degree 3.
543 bminmax = [lagrange_degree_3(m,v(self.a[m-1]),v(self.a[m-2]),v(self.a[m-3])) for v in self.Foo]
--> 544 self.b_lower = [bminmax[i][0] for i in range(len(bminmax))]
545 self.b_upper = [bminmax[i][1] for i in range(len(bminmax))]
546
IndexError: list index out of range
The fix is easy: we just need to add the lines
if len(z4minmax) < 1:
z4minmax = [0.0, -1.0]
return z4minmax
before line 295 of sage/rings/number_field/totallyreal_data.pyx. (Yes, I'm still intimidated by creating a patch.)
The issue was that when the lagrange multipliers gives contradictory bounds (a good thing, since it says the enumeration can stop in that branch), it was not sending a pair of bounds, just a single element, causing a type error.
JV
Apply: attachment: trac_13101_bug_in_enumerate_totallyreal_fields_all.patch,
attachment: trac_13101_review.patch,
attachment: trac_13101_long_time.patch,
Component: number fields
Keywords: sd51
Author: Robert Harron, John Voight, Frédéric Chapoton
Branch/Commit: u/vbraun/enumerate_totallyreal @ 3923f3a
Reviewer: Alex Ghitza, Peter Bruin
Issue created by migration from https://trac.sagemath.org/ticket/13101