Ticket #3967: 9865.patch
| File 9865.patch, 3.8 kB (added by jvoight, 4 months ago) |
|---|
-
a/sage/rings/number_field/totallyreal.py
old new 87 87 return dB 88 88 89 89 def enumerate_totallyreal_fields_prim(n, B, a = [], verbose=0, return_seqs=False, \ 90 phc=False, keep_fields=False, t_2=False ):90 phc=False, keep_fields=False, t_2=False, just_print=False): 91 91 r""" 92 92 This function enumerates primitive totally real fields of 93 93 degree $n>1$ with discriminant $d \leq B$; optionally one can … … 197 197 dB_odlyzko = odlyzko_bound_totallyreal(n) 198 198 dB = math.ceil(40000*dB_odlyzko**n) 199 199 counts = [0,0,0,0] 200 201 if just_print: 202 jp = open(just_print, "w") 200 203 201 204 if keep_fields: 202 205 if type(keep_fields) == bool: … … 252 255 # Find a minimal lattice element 253 256 counts[3] += 1 254 257 ng = pari([nf,zk]).polredabs() 258 ngt2 = ng[n-1]**2-2*ng[n-2] 255 259 256 260 # Check if K is contained in the list. 257 found = False 258 ind = bisect.bisect_left(S, [d,ng]) 259 while ind < len(S) and S[ind][0] == d: 260 if S[ind][1] == ng: 261 if not just_print: 262 found = False 263 ind = bisect.bisect_left(S, [d,ng]) 264 while ind < len(S) and S[ind][0] == d: 265 if S[ind][1] == ng: 266 if verbose: 267 print "but is not new" 268 found = True 269 break 270 ind += 1 271 if not found and (type(t_2) == bool and (not t_2 or ngt2 >= t_2val)) or \ 272 (type(t_2) == Integer and ngt2 >= t_2): 261 273 if verbose: 262 print "but is not new" 263 found = True 264 break 265 ind += 1 266 ngt2 = ng[n-1]**2-2*ng[n-2] 267 if not found and (type(t_2) == bool and (not t_2 or ngt2 >= t_2val)) or \ 268 (type(t_2) == Integer and ngt2 >= t_2): 269 if verbose: 270 print "and is new!" 271 S.insert(ind, [d,ng]) 272 274 print "and is new!" 275 S.insert(ind, [d,ng]) 276 else: 277 if (type(t_2) == bool and (not t_2 or ngt2 >= t_2val)) or \ 278 (type(t_2) == Integer and ngt2 >= t_2): 279 jp.write(str([d,ng.reverse().Vec()]) + "\n") 273 280 else: 274 281 if verbose: 275 282 print "has discriminant", abs(d), "> B" … … 290 297 T.incr(f_out,verbose=verbose,phc=phc) 291 298 else: 292 299 T.incr(f_out,phc=phc) 300 301 if just_print: 302 jp.close() 293 303 294 304 # In the application of Smyth's theorem above (and easy 295 305 # irreducibility test), we exclude finitely many possibilities