Ticket #9400: 9400_jd_review.patch
File 9400_jd_review.patch, 23.2 KB (added by , 12 years ago) |
---|
-
sage/libs/pari/gen.pyx
# HG changeset patch # User Jeroen Demeyer <jdemeyer@cage.ugent.be> # Date 1282386675 -7200 # Node ID 268c9abb602e57269f1add27bab01f8d25a1b271 # Parent 0d7ed532726625a43432b22169beca536ee81b8a [mq]: 9400_jd_review diff -r 0d7ed5327266 -r 268c9abb602e sage/libs/pari/gen.pyx
a b 6430 6430 _sig_on 6431 6431 return self.new_gen(modreverse(self.g)) 6432 6432 6433 def nfbasis(self, long flag=0, p=0): 6434 cdef gen _p 6435 cdef GEN g 6436 if p != 0: 6437 _p = self.pari(p) 6438 g = _p.g 6439 else: 6440 g = <GEN>NULL 6441 _sig_on 6442 return self.new_gen(nfbasis0(self.g, flag, g)) 6443 6444 def nfbasis_d(self, long flag=0, p=0): 6433 def nfbasis(self, long flag=0, fa=0): 6434 """ 6435 nfbasis(x, flag, fa): integral basis of the field QQ[a], where ``a`` is 6436 a root of the polynomial x. 6437 6438 Binary digits of ``flag`` mean: 6439 - 1: assume that no square of a prime>primelimit divides the 6440 discriminant of ``x``. 6441 - 2: use round 2 algorithm instead of round 4. 6442 If present, ``fa`` provides the matrix of a partial factorization of 6443 the discriminant of ``x``, useful if one wants only an order maximal at 6444 certain primes only. 6445 6446 EXAMPLES:: 6447 6448 sage: pari('x^3 - 17').nfbasis() 6449 [1, x, 1/3*x^2 - 1/3*x + 1/3] 6450 6451 We test ``flag`` = 1, noting it gives it wrong result when the 6452 discriminant (-4 * `p`^2 * `q` in the example below) has a big square 6453 factor:: 6454 6455 sage: p = next_prime(10^10); q = next_prime(p) 6456 sage: x = polygen(QQ); f = x^2 + p^2*q 6457 sage: pari(f).nfbasis(1) # Wrong result 6458 [1, x] 6459 sage: pari(f).nfbasis() # Correct result 6460 [1, 1/10000000019*x] 6461 sage: pari(f).nfbasis(fa = "[2,2; %s,2]"%p) # Correct result and faster 6462 [1, 1/10000000019*x] 6463 6464 TESTS:: 6465 6466 ``flag`` = 2 should give the same result: 6467 sage: pari('x^3 - 17').nfbasis(flag = 2) 6468 [1, x, 1/3*x^2 - 1/3*x + 1/3] 6469 """ 6470 global t0 6471 t0GEN(fa) 6472 if typ(t0) != t_MAT: 6473 t0 = <GEN>0 6474 _sig_on 6475 return self.new_gen(nfbasis0(self.g, flag, t0)) 6476 6477 def nfbasis_d(self, long flag=0, fa=0): 6445 6478 """ 6446 6479 nfbasis_d(x): Return a basis of the number field defined over QQ 6447 6480 by x and its discriminant. … … 6463 6496 sage: pari([-2,0,0,1]).Polrev().nfbasis_d() 6464 6497 ([1, x, x^2], -108) 6465 6498 """ 6466 cdef gen d 6467 cdef GEN g 6468 6469 if p: 6470 g = (<gen>self.pari(p)).g 6471 else: 6472 g = <GEN>NULL 6473 6474 _sig_on 6475 nfb = self.new_gen(nfbasis(self.g, &t0, flag, g)) 6476 d = self.new_gen(t0) 6477 return nfb, d 6499 global t0 6500 cdef GEN disc 6501 t0GEN(fa) 6502 if typ(t0) != t_MAT: 6503 t0 = <GEN>0 6504 _sig_on 6505 B = self.new_gen_noclear(nfbasis(self.g, &disc, flag, t0)) 6506 D = self.new_gen(disc); 6507 return B,D 6478 6508 6479 6509 def nfdisc(self, long flag=0, p=0): 6480 6510 """ … … 6541 6571 x = f.variable() 6542 6572 return x.Mod(f) 6543 6573 6544 def nfinit(self, long flag=0): 6545 _sig_on 6546 return P.new_gen(nfinit0(self.g, flag, prec)) 6574 def nfinit(self, long flag=0, long precision=0): 6575 """ 6576 nfinit(pol, {flag=0}): ``pol`` being a nonconstant irreducible 6577 polynomial, gives a vector containing all the data necessary for PARI 6578 to compute in this number field. 6579 6580 ``flag`` is optional and can be set to: 6581 - 0: default 6582 - 1: do not compute different 6583 - 2: first use polred to find a simpler polynomial 6584 - 3: outputs a two-element vector [nf,Mod(a,P)], where nf is as in 2 6585 and Mod(a,P) is a polmod equal to Mod(x,pol) and P=nf.pol 6586 6587 EXAMPLES:: 6588 6589 sage: pari('x^3 - 17').nfinit() 6590 [x^3 - 17, [1, 1], -867, 3, [[1, 1.68006..., 2.57128...; 1, -0.340034... + 2.65083...*I, -1.28564... - 2.22679...*I], [1, 1.68006..., 2.57128...; 1, 2.31080..., -3.51243...; 1, -2.99087..., 0.941154...], [1, 2, 3; 1, 2, -4; 1, -3, 1], [3, 1, 0; 1, -11, 17; 0, 17, 0], [51, 0, 16; 0, 17, 3; 0, 0, 1], [17, 0, -1; 0, 0, 3; -1, 3, 2], [51, [-17, 6, -1; 0, -18, 3; 1, 0, -16]]], [2.57128..., -1.28564... - 2.22679...*I], [1, 1/3*x^2 - 1/3*x + 1/3, x], [1, 0, -1; 0, 0, 3; 0, 1, 1], [1, 0, 0, 0, -4, 6, 0, 6, -1; 0, 1, 0, 1, 1, -1, 0, -1, 3; 0, 0, 1, 0, 2, 0, 1, 0, 1]] 6591 6592 TESTS:: 6593 6594 This example only works after increasing precision:: 6595 6596 sage: pari('x^2 + 10^100 + 1').nfinit(precision=64) 6597 Traceback (most recent call last): 6598 ... 6599 PariError: precision too low (10) 6600 sage: pari('x^2 + 10^100 + 1').nfinit() 6601 [...] 6602 6603 Throw a PARI error which is not precer:: 6604 6605 sage: pari('1.0').nfinit() 6606 Traceback (most recent call last): 6607 ... 6608 PariError: incorrect type (11) 6609 """ 6610 6611 # If explicit precision is given, use only that 6612 if precision: 6613 return self._nfinit_with_prec(flag, precision) 6614 6615 # Otherwise, start with 64 bits of precision and increase as needed: 6616 precision = 64 6617 while True: 6618 try: 6619 return self._nfinit_with_prec(flag, precision) 6620 except PariError, err: 6621 if err.errnum() == precer: 6622 precision *= 2 6623 else: 6624 raise err 6625 6626 # NOTE: because of the way _sig_on and Cython exceptions work, this 6627 # function MUST NOT be folded into nfinit() above. It has to be a 6628 # seperate function. 6629 def _nfinit_with_prec(self, long flag, long precision): 6630 """ 6631 See ``self.nfinit()``. 6632 """ 6633 _sig_on 6634 return P.new_gen(nfinit0(self.g, flag, pbw(precision))) 6547 6635 6548 6636 def nfisisom(self, gen other): 6549 6637 """ … … 6867 6955 _sig_on 6868 6956 return self.new_gen(polgalois(self.g, prec)) 6869 6957 6870 def nfgaloisconj(self, long flag=0, denom=None, long prec =0):6958 def nfgaloisconj(self, long flag=0, denom=None, long precision=0): 6871 6959 r""" 6872 6960 Edited from the pari documentation: 6873 6961 … … 6894 6982 else: 6895 6983 t0 = NULL 6896 6984 _sig_on 6897 return self.new_gen(galoisconj0(self.g, flag, t0, pbw(prec )))6985 return self.new_gen(galoisconj0(self.g, flag, t0, pbw(precision))) 6898 6986 6899 6987 def nfroots(self, poly): 6900 6988 r""" … … 9240 9328 9241 9329 cdef extern from "pari/pari.h": 9242 9330 char *errmessage[] 9243 int user 9244 int errpile 9245 int noer 9331 int talker2, bugparier, alarmer, openfiler, talker, flagerr, impl, \ 9332 archer, notfuncer, precer, typeer, consister, user, errpile, \ 9333 overflower, matinv1, mattype1, arither1, primer1, invmoder, \ 9334 constpoler, notpoler, redpoler, zeropoler, operi, operf, gdiver, \ 9335 memer, negexper, sqrter5, noer 9336 int warner, warnprec, warnfile, warnmem 9246 9337 9247 9338 cdef extern from "misc.h": 9248 9339 int factorint_withproof_sage(GEN* ans, GEN x, GEN cutoff) … … 9265 9356 9266 9357 errmessage = staticmethod(__errmessage) 9267 9358 9359 def errnum(self): 9360 r""" 9361 Return the PARI error number corresponding to this exception. 9362 9363 EXAMPLES:: 9364 9365 sage: try: 9366 ... pari('1/0') 9367 ... except PariError, err: 9368 ... print err.errnum() 9369 27 9370 """ 9371 return self.args[0] 9372 9268 9373 def __repr__(self): 9269 return "PariError(%d)"%self.args[0] 9374 r""" 9375 TESTS:: 9376 9377 sage: PariError(11) 9378 PariError(11) 9379 """ 9380 return "PariError(%d)"%self.errnum() 9270 9381 9271 9382 def __str__(self): 9272 return "%s (%d)"%(self.errmessage(self.args[0]),self.args[0]) 9383 r""" 9384 EXAMPLES:: 9385 9386 sage: try: 9387 ... pari('1/0') 9388 ... except PariError, err: 9389 ... print err 9390 division by zero (27) 9391 """ 9392 return "%s (%d)"%(self.errmessage(self.errnum()), self.errnum()) 9393 9273 9394 9274 9395 # We expose a trap function to C. 9275 9396 # If this function returns without raising an exception, -
sage/rings/number_field/number_field.py
diff -r 0d7ed5327266 -r 268c9abb602e sage/rings/number_field/number_field.py
a b 2404 2404 """ 2405 2405 PARI number field corresponding to this field. 2406 2406 2407 This is the number field constructed using nfinit . This is the same2407 This is the number field constructed using nfinit(). This is the same 2408 2408 as the number field got by doing pari(self) or gp(self). 2409 2409 2410 2410 EXAMPLES:: … … 2414 2414 sage: k.pari_nf()[:4] 2415 2415 [x^4 - 3*x + 7, [0, 2], 85621, 1] 2416 2416 sage: pari(k)[:4] 2417 [x^4 - 3*x + 7, [0, 2], 85621, 1] 2417 [x^4 - 3*x + 7, [0, 2], 85621, 1] 2418 2418 2419 2419 :: 2420 2420 … … 2436 2436 We illustrate the maximize_at_primes and assume_disc_small parameters:: 2437 2437 2438 2438 sage: p = next_prime(10^40); q = next_prime(p) 2439 sage: K.<a> = NumberField(x^2 - p*q, maximize_at_primes=[p])2440 2439 2441 2440 The following would take a very long time without the 2442 2441 maximize_at_primes option above:: 2443 2442 2443 sage: K.<a> = NumberField(x^2 - p*q, maximize_at_primes=[p]) 2444 2444 sage: K.pari_nf() 2445 2445 [x^2 - 100000000000000000000...] 2446 2446 2447 I'm not sure this really illustrates anything::2448 2449 sage: K.<a> = NumberField(x^2 - 3*5*7*11*13, assume_disc_small=True)2447 Since the discriminant is square-free, this also works:: 2448 2449 sage: K.<a> = NumberField(x^2 - p*q, assume_disc_small=True) 2450 2450 sage: K.pari_nf() 2451 [x^2 - 1 5015, [2, 0], 60060, 1,...]2451 [x^2 - 100000000000000000000...] 2452 2452 """ 2453 2453 if self.absolute_polynomial().denominator() != 1: 2454 2454 raise TypeError, "Unable to coerce number field defined by non-integral polynomial to PARI." … … 2456 2456 return self.__pari_nf 2457 2457 except AttributeError: 2458 2458 f = self.pari_polynomial() 2459 if self._maximize_at_primes: 2460 v = self._normalize_prime_list(self._maximize_at_primes) 2461 m = self._pari_disc_factorization_matrix(v) 2462 s = str(f) 2463 # we use a string since the Sage wrapping of the pari 2464 # c library nfinit doesn't support the third option. 2465 k = pari('nfinit([%s,nfbasis(%s,0,%s)])'%(s,s,str(m))) 2466 elif self._assume_disc_small: 2467 k = f.nfinit(1) 2468 else: 2469 k = f.nfinit() 2470 self.__pari_nf = k 2459 self.__pari_nf = pari([f, self._pari_integral_basis()]).nfinit() 2471 2460 return self.__pari_nf 2472 2461 2473 def _pari_ init_(self):2474 """ 2475 Needed for conversion ofnumber field to PARI.2462 def _pari_(self): 2463 """ 2464 Converts this number field to PARI. 2476 2465 2477 2466 This only works if the defining polynomial of this number field is 2478 2467 integral and monic. … … 2480 2469 EXAMPLES:: 2481 2470 2482 2471 sage: k = NumberField(x^2 + x + 1, 'a') 2483 sage: k._pari_init_()2484 'nfinit(x^2 + x + 1)'2485 2472 sage: k._pari_() 2486 2473 [x^2 + x + 1, [0, 1], -3, 1, ... [1, x], [1, 0; 0, 1], [1, 0, 0, -1; 0, 1, 1, -1]] 2487 2474 sage: pari(k) 2488 2475 [x^2 + x + 1, [0, 1], -3, 1, ...[1, x], [1, 0; 0, 1], [1, 0, 0, -1; 0, 1, 1, -1]] 2489 2490 We illustrate the maximize_at_primes parameter:: 2491 2492 sage: p = next_prime(10^40); q = next_prime(p) 2493 sage: K.<a> = NumberField(x^2 - p*q, maximize_at_primes=[p,q]) 2494 2495 Note that nfbasis is explicitly passed in:: 2496 2497 sage: K._pari_init_() 2498 'nfinit(x^2 - 100000000000000000000000000000000000002600000000000000000000000000000000000016819,nfbasis(x^2 - 100000000000000000000000000000000000002600000000000000000000000000000000000016819,0,[10000000000000000000000000000000000000121, 1; 10000000000000000000000000000000000000139, 1]))' 2499 2500 2501 We illustrate the assume_disc_small parameter (note the 1 option to nfinit):: 2502 2503 sage: K.<a> = NumberField(x^2 - 3*5*7*11*13, assume_disc_small=True) 2504 sage: K._pari_init_() 2505 'nfinit(x^2 - 15015,1)' 2506 """ 2507 f = str(self.pari_polynomial()) 2508 if self.absolute_polynomial().denominator() != 1: 2509 raise TypeError, "Unable to coerce number field defined by non-integral polynomial to PARI." 2510 if self._maximize_at_primes: 2511 v = self._normalize_prime_list(self._maximize_at_primes) 2512 m = self._pari_disc_factorization_matrix(v) 2513 return 'nfinit(%s,nfbasis(%s,0,%s))'%(f,f,str(m)) 2514 elif self._assume_disc_small: 2515 return 'nfinit(%s,1)'%f 2516 else: 2517 return 'nfinit(%s)'%f 2518 2476 """ 2477 return self.pari_nf() 2478 2479 def _pari_init_(self): 2480 """ 2481 Converts this number field to PARI. 2482 2483 This only works if the defining polynomial of this number field is 2484 integral and monic. 2485 2486 EXAMPLES:: 2487 2488 sage: k = NumberField(x^2 + x + 1, 'a') 2489 sage: k._pari_init_() 2490 '[x^2 + x + 1, [0, 1], -3, 1, ... [1, x], [1, 0; 0, 1], [1, 0, 0, -1; 0, 1, 1, -1]]' 2491 sage: gp(k) 2492 [x^2 + x + 1, [0, 1], -3, 1, ...[1, x], [1, 0; 0, 1], [1, 0, 0, -1; 0, 1, 1, -1]] 2493 """ 2494 return str(self.pari_nf()) 2495 2519 2496 def pari_bnf(self, certify=False, units=True): 2520 2497 """ 2521 2498 PARI big number field corresponding to this field. … … 2894 2871 sage: K.selmer_group([K.ideal(2, -a+1), K.ideal(3, a+1)], 3) 2895 2872 [2, a + 1] 2896 2873 sage: K.selmer_group([K.ideal(2, -a+1), K.ideal(3, a+1), K.ideal(a)], 3) 2897 [2, a + 1, a] 2874 [2, a + 1, a] # 32-bit 2875 [2, a + 1, -a] # 64-bit 2898 2876 sage: K.<a> = NumberField(polygen(QQ)) 2899 2877 sage: K.selmer_group([],5) 2900 2878 [] … … 3722 3700 sage: K.integral_basis() 3723 3701 [1, 1/2*a^2 + 1/2*a, a^2] 3724 3702 3725 ALGORITHM: Uses the pari library .3703 ALGORITHM: Uses the pari library (via _pari_integral_basis). 3726 3704 """ 3727 3705 return self.maximal_order(v=v).basis() 3728 3706 3729 def _compute_integral_basis(self, v=None): 3730 """ 3731 Internal function returning an integral basis of this number field; 3732 used in the maximal_order() function. 3733 3734 Note that this is *not* necessarily the same basis returned by 3735 self.integral_basis(). 3707 def _pari_integral_basis(self, v=None): 3708 """ 3709 Internal function returning an integral basis of this number field in 3710 PARI format. 3736 3711 3737 3712 INPUT: 3738 3713 … … 3744 3719 EXAMPLES:: 3745 3720 3746 3721 sage: K.<a> = NumberField(x^5 + 10*x + 1) 3747 sage: K._ compute_integral_basis()3748 [1, a, a^2, a^3, a^4]3722 sage: K._pari_integral_basis() 3723 [1, x, x^2, x^3, x^4] 3749 3724 3750 3725 Next we compute the ring of integers of a cubic field in which 2 is 3751 3726 an "essential discriminant divisor", so the ring of integers is not … … 3754 3729 :: 3755 3730 3756 3731 sage: K.<a> = NumberField(x^3 + x^2 - 2*x + 8) 3757 sage: K._ compute_integral_basis()3758 [1, a, 1/2*a^2 - 1/2*a]3732 sage: K._pari_integral_basis() 3733 [1, x, 1/2*x^2 - 1/2*x] 3759 3734 sage: K.integral_basis() 3760 3735 [1, 1/2*a^2 + 1/2*a, a^2] 3761 3736 """ … … 3771 3746 B = f.nfbasis(1 if self._assume_disc_small else 0) 3772 3747 else: 3773 3748 m = self._pari_disc_factorization_matrix(v) 3774 B = f.nfbasis(p = m) 3775 3776 basis = map(self, B) 3777 self._integral_basis_dict[v] = basis 3778 return basis 3749 B = f.nfbasis(fa = m) 3750 3751 self._integral_basis_dict[v] = B 3752 return B 3779 3753 3780 3754 def _pari_disc_factorization_matrix(self, v): 3781 3755 """ … … 3790 3764 sage: f = x^3 + 17*x + 393; f.discriminant().factor() 3791 3765 -1 * 5^2 * 29 * 5779 3792 3766 sage: K.<a> = NumberField(f) 3793 sage: K._pari_disc_factorization_matrix([5,29])3767 sage: fa = K._pari_disc_factorization_matrix([5,29]); fa 3794 3768 [5, 2; 29, 1] 3769 sage: fa.type() 3770 't_MAT' 3795 3771 """ 3796 3772 f = self.pari_polynomial() 3797 3773 m = pari.matrix(len(v), 2) … … 5351 5327 except KeyError: 5352 5328 pass 5353 5329 5354 B = self._compute_integral_basis(v = v)5330 B = map(self, self._pari_integral_basis(v = v)) 5355 5331 5356 5332 if len(v) == 0 or v is None: 5357 5333 is_maximal = True … … 7157 7133 p = sage.rings.arith.next_prime(p) 7158 7134 if p % n == 1: 7159 7135 return p 7160 7161 def integral_basis(self, v=None):7162 """ 7163 Return a list of elements of this number field that are a basis for7164 the full ring of integers.7136 7137 def _pari_integral_basis(self, v=None): 7138 """ 7139 Internal function returning an integral basis of this number field in 7140 PARI format. 7165 7141 7166 7142 This field is cyclomotic, so this is a trivial computation, since 7167 7143 the power basis on the generator is an integral basis. Thus the v … … 7169 7145 7170 7146 EXAMPLES:: 7171 7147 7172 sage: CyclotomicField(5).integral_basis() 7173 [1, zeta5, zeta5^2, zeta5^3] 7148 sage: CyclotomicField(5)._pari_integral_basis() 7149 [1, x, x^2, x^3] 7150 sage: len(CyclotomicField(137)._pari_integral_basis()) 7151 136 7174 7152 """ 7175 7153 try: 7176 7154 return self._integral_basis_dict[tuple()] 7177 7155 except KeyError: 7178 v = tuple() 7179 z = self.gen() 7180 a = self(1) 7156 z = pari(self.gen()) 7157 a = pari(1) 7181 7158 B = [] 7182 7159 for n in xrange(self.degree()): 7183 B.append(a )7160 B.append(a.lift()) 7184 7161 a *= z 7185 self._integral_basis_dict[tuple()] = B7162 self._integral_basis_dict[tuple()] = pari(B) 7186 7163 return B 7187 7188 def _compute_integral_basis(self, v=None):7189 """7190 Alias for self.integral_basis().7191 7192 EXAMPLES::7193 7194 sage: len(CyclotomicField(137)._compute_integral_basis())7195 1367196 sage: CyclotomicField(17).integral_basis() == CyclotomicField(17)._compute_integral_basis()7197 True7198 """7199 return self.integral_basis(v=v)7200 7164 7201 7165 7202 7166 def zeta_order(self): -
sage/rings/number_field/number_field_ideal_rel.py
diff -r 0d7ed5327266 -r 268c9abb602e sage/rings/number_field/number_field_ideal_rel.py
a b 414 414 sage: K.<c> = F.extension(Y^2 - (1 + a)*(a + b)*a*b) 415 415 sage: I = K.ideal(3, c) 416 416 sage: J = I.ideal_below(); J 417 Fractional ideal (-b) 417 Fractional ideal (b) # 32-bit 418 Fractional ideal (-b) # 64-bit 418 419 sage: J.number_field() == F 419 420 True 420 421 """ … … 592 593 sage: I.relative_ramification_index() 593 594 2 594 595 sage: I.ideal_below() 595 Fractional ideal (b) 596 Fractional ideal (b) # 32-bit 597 Fractional ideal (-b) # 64-bit 596 598 sage: K.ideal(b) == I^2 597 599 True 598 600 """ -
sage/rings/polynomial/polynomial_quotient_ring.py
diff -r 0d7ed5327266 -r 268c9abb602e sage/rings/polynomial/polynomial_quotient_ring.py
a b 689 689 `x^2 + 31` from 12 to 2, i.e. we lose a generator of order 6:: 690 690 691 691 sage: S.S_class_group([K.ideal(a)]) 692 [((1/4*xbar^2 + 31/4, (-1/8*a + 1/8)*xbar^2 - 31/8*a + 31/8, 1/16*xbar^3 + 1/16*xbar^2 + 31/16*xbar + 31/16, -1/16*a*xbar^3 + (1/16*a + 1/8)*xbar^2 - 31/16*a*xbar + 31/16*a + 31/8), 6, 1/16*xbar^3 - 5/16*xbar^2 + 31/16*xbar - 139/16), ((-1/4*xbar^2 - 23/4, (1/8*a - 1/8)*xbar^2 + 23/8*a - 23/8, -1/16*xbar^3 - 1/16*xbar^2 - 23/16*xbar - 23/16, 1/16*a*xbar^3 + (-1/16*a - 1/8)*xbar^2 + 23/16*a*xbar - 23/16*a - 23/8), 2, -1/8*xbar^2 - 15/8)] 692 [((1/4*xbar^2 + 31/4, (-1/8*a + 1/8)*xbar^2 - 31/8*a + 31/8, 1/16*xbar^3 + 1/16*xbar^2 + 31/16*xbar + 31/16, -1/16*a*xbar^3 + (1/16*a + 1/8)*xbar^2 - 31/16*a*xbar + 31/16*a + 31/8), 6, 1/16*xbar^3 - 5/16*xbar^2 + 31/16*xbar - 139/16), ((-1/4*xbar^2 - 23/4, (1/8*a - 1/8)*xbar^2 + 23/8*a - 23/8, -1/16*xbar^3 - 1/16*xbar^2 - 23/16*xbar - 23/16, 1/16*a*xbar^3 + (-1/16*a - 1/8)*xbar^2 + 23/16*a*xbar - 23/16*a - 23/8), 2, -1/8*xbar^2 - 15/8)] # 32-bit 693 [((1/4*xbar^2 + 31/4, (-1/8*a + 1/8)*xbar^2 - 31/8*a + 31/8, 1/16*xbar^3 + 1/16*xbar^2 + 31/16*xbar + 31/16, -1/16*a*xbar^3 + (1/16*a + 1/8)*xbar^2 - 31/16*a*xbar + 31/16*a + 31/8), 6, -1/16*xbar^3 + 1/16*xbar^2 - 31/16*xbar + 47/16), ((-1/4*xbar^2 - 23/4, (1/8*a - 1/8)*xbar^2 + 23/8*a - 23/8, -1/16*xbar^3 - 1/16*xbar^2 - 23/16*xbar - 23/16, 1/16*a*xbar^3 + (-1/16*a - 1/8)*xbar^2 + 23/16*a*xbar - 23/16*a - 23/8), 2, -1/8*xbar^2 - 15/8)] # 64-bit 693 694 694 695 Note that all the returned values live where we expect them to:: 695 696 … … 1069 1070 sage: D.selmer_group([K.ideal(2, -a+1), K.ideal(3, a+1)], 3) 1070 1071 [2, -a - 1] 1071 1072 sage: D.selmer_group([K.ideal(2, -a+1), K.ideal(3, a+1), K.ideal(a)], 3) 1072 [2, -a - 1, a]# 32-bit1073 [2, -a - 1, -a]# 64-bit1073 [2, -a - 1, -a] # 32-bit 1074 [2, -a - 1, a] # 64-bit 1074 1075 1075 1076 """ 1076 1077 units, clgp_gens = self._S_class_group_and_units(tuple(S), proof=proof) -
sage/rings/residue_field.pyx
diff -r 0d7ed5327266 -r 268c9abb602e sage/rings/residue_field.pyx
a b 468 468 469 469 sage: K.<a> = NumberField(x^3-11) 470 470 sage: F = K.ideal(37).factor(); F 471 (Fractional ideal (37, a + 12)) * (Fractional ideal ( -2*a + 5)) * (Fractional ideal (37, a + 9))# 32-bit472 (Fractional ideal (37, a + 12)) * (Fractional ideal (2*a -5)) * (Fractional ideal (37, a + 9)) # 64-bit471 (Fractional ideal (37, a + 12)) * (Fractional ideal (2*a - 5)) * (Fractional ideal (37, a + 9)) # 32-bit 472 (Fractional ideal (37, a + 12)) * (Fractional ideal (-2*a + 5)) * (Fractional ideal (37, a + 9)) # 64-bit 473 473 sage: k = K.residue_field(F[0][0]) 474 474 sage: l = K.residue_field(F[1][0]) 475 475 sage: k == l