1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
|
diff --git a/src/sage/arith/misc.py b/src/sage/arith/misc.py
index 745d5fcbbe7..86409ab3243 100644
--- a/src/sage/arith/misc.py
+++ b/src/sage/arith/misc.py
@@ -2691,9 +2691,14 @@ def factor(n, proof=None, int_=False, algorithm='pari', verbose=0, **kwds):
Any object which has a factor method can be factored like this::
- sage: K.<i> = QuadraticField(-1) # needs sage.rings.number_field
- sage: factor(122 - 454*i) # needs sage.rings.number_field
- (-i) * (-i - 2)^3 * (i + 1)^3 * (-2*i + 3) * (i + 4)
+ sage: # needs sage.rings.number_field
+ sage: K.<i> = QuadraticField(-1)
+ sage: f = factor(122 - 454*i); f # random
+ (i) * (i - 1)^3 * (i + 2)^3 * (3*i + 2) * (i + 4)
+ sage: len(f)
+ 4
+ sage: product(p[0]^p[1] for p in f) * f.unit()
+ -454*i + 122
To access the data in a factorization::
@@ -2775,8 +2780,10 @@ def radical(n, *args, **kwds):
...
ArithmeticError: radical of 0 is not defined
sage: K.<i> = QuadraticField(-1) # needs sage.rings.number_field
- sage: radical(K(2)) # needs sage.rings.number_field
- i + 1
+ sage: r = radical(K(2)); r # random, needs sage.rings.number_field
+ i - 1
+ sage: r.norm() # needs sage.rings.number_field
+ 2
Tests with numpy and gmpy2 numbers::
@@ -3031,7 +3038,7 @@ def is_squarefree(n):
sage: is_squarefree(O(2))
False
sage: O(2).factor()
- (-I) * (I + 1)^2
+ (...) * (...)^2
This method fails on domains which are not Unique Factorization Domains::
diff --git a/src/sage/categories/quotient_fields.py b/src/sage/categories/quotient_fields.py
index 76f0570a819..0e4d13ef889 100644
--- a/src/sage/categories/quotient_fields.py
+++ b/src/sage/categories/quotient_fields.py
@@ -100,7 +100,7 @@ class QuotientFields(Category_singleton):
sage: R = ZZ.extension(x^2 + 1, names='i')
sage: i = R.1
sage: gcd(5, 3 + 4*i)
- -i - 2
+ 2*i - 1
sage: P.<t> = R[]
sage: gcd(t, i)
Traceback (most recent call last):
diff --git a/src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py b/src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py
index 6995f61f463..457b0ba2253 100644
--- a/src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py
+++ b/src/sage/dynamics/arithmetic_dynamics/berkovich_ds.py
@@ -690,10 +690,10 @@ class DynamicalSystem_Berkovich_projective(DynamicalSystem_Berkovich):
sage: # needs sage.rings.number_field
sage: ideal = A.ideal(5).factor()[1][0]; ideal
- Fractional ideal (2*a + 1)
+ Fractional ideal (-a + 2)
sage: g = f.conjugate(conj, new_ideal=ideal)
sage: g.domain().ideal()
- Fractional ideal (2*a + 1)
+ Fractional ideal (-a + 2)
"""
if self.domain().is_padic_base():
return DynamicalSystem_Berkovich(self._system.conjugate(M, adjugate=adjugate))
diff --git a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py
index 262c063a35d..e2c43cc73f8 100644
--- a/src/sage/dynamics/arithmetic_dynamics/projective_ds.py
+++ b/src/sage/dynamics/arithmetic_dynamics/projective_ds.py
@@ -1790,7 +1790,7 @@ class DynamicalSystem_projective(SchemeMorphism_polynomial_projective_space,
sage: P.<x,y> = ProjectiveSpace(K,1)
sage: f = DynamicalSystem_projective([1/3*x^2+1/a*y^2, y^2])
sage: f.primes_of_bad_reduction() # needs sage.rings.function_field
- [Fractional ideal (a), Fractional ideal (3)]
+ [Fractional ideal (-a), Fractional ideal (3)]
This is an example where ``check=False`` returns extra primes::
diff --git a/src/sage/libs/pari/convert_sage.pyx b/src/sage/libs/pari/convert_sage.pyx
index 64386bcf632..db6725f39a5 100644
--- a/src/sage/libs/pari/convert_sage.pyx
+++ b/src/sage/libs/pari/convert_sage.pyx
@@ -573,17 +573,16 @@ cpdef list pari_prime_range(long c_start, long c_stop, bint py_ints=False):
sage: pari_prime_range(2, 19)
[2, 3, 5, 7, 11, 13, 17]
"""
- cdef long p = 0
- cdef byteptr pari_prime_ptr = diffptr
+ cdef ulong i = 1
res = []
- while p < c_start:
- NEXT_PRIME_VIADIFF(p, pari_prime_ptr)
- while p < c_stop:
+ while pari_PRIMES[i] < c_start:
+ i+=1
+ while pari_PRIMES[i] < c_stop:
if py_ints:
- res.append(p)
+ res.append(pari_PRIMES[i])
else:
z = <Integer>PY_NEW(Integer)
- mpz_set_ui(z.value, p)
+ mpz_set_ui(z.value, pari_PRIMES[i])
res.append(z)
- NEXT_PRIME_VIADIFF(p, pari_prime_ptr)
+ i+=1
return res
diff --git a/src/sage/libs/pari/convert_sage_real_mpfr.pyx b/src/sage/libs/pari/convert_sage_real_mpfr.pyx
index 98db6023dc9..5fd7fba1c47 100644
--- a/src/sage/libs/pari/convert_sage_real_mpfr.pyx
+++ b/src/sage/libs/pari/convert_sage_real_mpfr.pyx
@@ -28,7 +28,7 @@ cpdef Gen new_gen_from_real_mpfr_element(RealNumber self):
# We round up the precision to the nearest multiple of wordsize.
cdef int rounded_prec
- rounded_prec = (self.prec() + wordsize - 1) & ~(wordsize - 1)
+ rounded_prec = nbits2prec(self.prec())
# Yes, assigning to self works fine, even in Cython.
if rounded_prec > prec:
@@ -48,7 +48,7 @@ cpdef Gen new_gen_from_real_mpfr_element(RealNumber self):
exponent = mpfr_get_z_exp(mantissa, self.value)
# Create a PARI REAL
- pari_float = cgetr(2 + rounded_prec / wordsize)
+ pari_float = cgetr(rounded_prec)
pari_float[1] = evalexpo(exponent + rounded_prec - 1) + evalsigne(mpfr_sgn(self.value))
mpz_export(&pari_float[2], NULL, 1, wordsize // 8, 0, 0, mantissa)
mpz_clear(mantissa)
diff --git a/src/sage/libs/pari/tests.py b/src/sage/libs/pari/tests.py
index 1ed571cd4b9..bd8dc9641d2 100644
--- a/src/sage/libs/pari/tests.py
+++ b/src/sage/libs/pari/tests.py
@@ -1502,7 +1502,7 @@ Quadratic class numbers::
sage: pari(-104).quadclassunit()
[6, [6], [Qfb(5, -4, 6)], 1]
sage: pari(109).quadclassunit()
- [1, [], [], 5.56453508676047]
+ [1, [], [], 5.56453508676047, -1]
sage: pari(10001).quadclassunit() # random generators
[16, [16], [Qfb(10, 99, -5, 0.E-38)], 5.29834236561059]
sage: pari(10001).quadclassunit()[0]
@@ -1749,13 +1749,13 @@ General number fields::
sage: y = QQ['yy'].0; _ = pari(y) # pari has variable ordering rules
sage: x = QQ['zz'].0; nf = pari(x^2 + 2).nfinit()
sage: nf.nfroots(y^2 + 2)
- [Mod(-zz, zz^2 + 2), Mod(zz, zz^2 + 2)]
+ [Mod(-zz, zz^2 + 2), Mod(zz, zz^2 + 2)]~
sage: nf = pari(x^3 + 2).nfinit()
sage: nf.nfroots(y^3 + 2)
- [Mod(zz, zz^3 + 2)]
+ [Mod(zz, zz^3 + 2)]~
sage: nf = pari(x^4 + 2).nfinit()
sage: nf.nfroots(y^4 + 2)
- [Mod(-zz, zz^4 + 2), Mod(zz, zz^4 + 2)]
+ [Mod(-zz, zz^4 + 2), Mod(zz, zz^4 + 2)]~
sage: nf = pari('x^2 + 1').nfinit()
sage: nf.nfrootsof1()
diff --git a/src/sage/matrix/matrix2.pyx b/src/sage/matrix/matrix2.pyx
index 0c257cfaf33..780cae7fbf2 100644
--- a/src/sage/matrix/matrix2.pyx
+++ b/src/sage/matrix/matrix2.pyx
@@ -16583,7 +16583,7 @@ cdef class Matrix(Matrix1):
....: -2*a^2 + 4*a - 2, -2*a^2 + 1, 2*a, a^2 - 6, 3*a^2 - a ])
sage: r,s,p = m._echelon_form_PID()
sage: s[2]
- (0, 0, -3*a^2 - 18*a + 34, -68*a^2 + 134*a - 53, -111*a^2 + 275*a - 90)
+ (0, 0, 3*a^2 + 18*a - 34, 68*a^2 - 134*a + 53, 111*a^2 - 275*a + 90)
sage: r * m == s and r.det() == 1
True
diff --git a/src/sage/modular/cusps_nf.py b/src/sage/modular/cusps_nf.py
index 4d120c075da..f3a3ff7e65b 100644
--- a/src/sage/modular/cusps_nf.py
+++ b/src/sage/modular/cusps_nf.py
@@ -1184,9 +1184,9 @@ def NFCusps_ideal_reps_for_levelN(N, nlists=1):
sage: from sage.modular.cusps_nf import NFCusps_ideal_reps_for_levelN
sage: NFCusps_ideal_reps_for_levelN(N)
[(Fractional ideal (1),
- Fractional ideal (67, a + 17),
- Fractional ideal (127, a + 48),
- Fractional ideal (157, a - 19))]
+ Fractional ideal (67, -4/7*a^3 + 13/7*a^2 + 39/7*a - 43),
+ Fractional ideal (127, -4/7*a^3 + 13/7*a^2 + 39/7*a - 42),
+ Fractional ideal (157, -4/7*a^3 + 13/7*a^2 + 39/7*a + 48))]
sage: L = NFCusps_ideal_reps_for_levelN(N, 5)
sage: all(len(L[i]) == k.class_number() for i in range(len(L)))
True
@@ -1244,7 +1244,7 @@ def units_mod_ideal(I):
sage: I = k.ideal(5, a + 1)
sage: units_mod_ideal(I)
[1,
- -2*a^2 - 4*a + 1,
+ 2*a^2 + 4*a - 1,
...]
::
diff --git a/src/sage/modular/dirichlet.py b/src/sage/modular/dirichlet.py
index 1f6a7a94444..1cf3ccdb611 100644
--- a/src/sage/modular/dirichlet.py
+++ b/src/sage/modular/dirichlet.py
@@ -2395,13 +2395,13 @@ class DirichletGroupFactory(UniqueFactory):
sage: parent(val)
Gaussian Integers generated by zeta4 in Cyclotomic Field of order 4 and degree 2
sage: r4_29_0 = r4.residue_field(K(29).factor()[0][0]); r4_29_0(val)
- 17
+ 12
sage: r4_29_0(val) * GF(29)(3)
- 22
+ 7
sage: r4_29_0(G.gens()[2].values_on_gens()[2]) * 3
- 22
+ 7
sage: parent(r4_29_0(G.gens()[2].values_on_gens()[2]) * 3)
- Residue field of Fractional ideal (-2*zeta4 + 5)
+ Residue field of Fractional ideal (-2*zeta4 - 5)
::
diff --git a/src/sage/modular/modsym/p1list_nf.py b/src/sage/modular/modsym/p1list_nf.py
index 86d33071974..00bb0979ea4 100644
--- a/src/sage/modular/modsym/p1list_nf.py
+++ b/src/sage/modular/modsym/p1list_nf.py
@@ -61,7 +61,7 @@ Lift an MSymbol to a matrix in `SL(2, R)`:
sage: alpha = MSymbol(N, a + 2, 3*a^2)
sage: alpha.lift_to_sl2_Ok()
- [-1, 4*a^2 - 13*a + 23, a + 2, 5*a^2 + 3*a - 3]
+ [-a - 1, 15*a^2 - 38*a + 86, a + 2, -a^2 + 9*a - 19]
sage: Ok = k.ring_of_integers()
sage: M = Matrix(Ok, 2, alpha.lift_to_sl2_Ok())
sage: det(M)
@@ -977,11 +977,11 @@ class P1NFList(SageObject):
sage: N = k.ideal(5, a + 1)
sage: P = P1NFList(N)
sage: u = k.unit_group().gens_values(); u
- [-1, -2*a^2 - 4*a + 1]
+ [-1, 2*a^2 + 4*a - 1]
sage: P.apply_J_epsilon(4, -1)
2
sage: P.apply_J_epsilon(4, u[0], u[1])
- 5
+ 1
::
@@ -1122,7 +1122,7 @@ def lift_to_sl2_Ok(N, c, d):
sage: M = Matrix(Ok, 2, lift_to_sl2_Ok(N, 0, 7))
Traceback (most recent call last):
...
- ValueError: <0> + <7> and the Fractional ideal (7, a) are not coprime.
+ ValueError: <0> + <7> and the Fractional ideal (7, -4/7*a^3 + 13/7*a^2 + 39/7*a - 19) are not coprime.
"""
k = N.number_field()
# check the input
diff --git a/src/sage/quadratic_forms/binary_qf.py b/src/sage/quadratic_forms/binary_qf.py
index 1a75f415b64..c89759288b9 100755
--- a/src/sage/quadratic_forms/binary_qf.py
+++ b/src/sage/quadratic_forms/binary_qf.py
@@ -1646,7 +1646,7 @@ class BinaryQF(SageObject):
sage: Q = BinaryQF([1, 0, 12345])
sage: n = 2^99 + 5273
sage: Q.solve_integer(n) # needs sage.libs.pari
- (-67446480057659, 7139620553488)
+ (67446480057659, 7139620553488)
sage: Q.solve_integer(n, algorithm='cornacchia') # needs sage.libs.pari
(67446480057659, 7139620553488)
sage: timeit('Q.solve_integer(n)') # not tested
@@ -1661,7 +1661,7 @@ class BinaryQF(SageObject):
sage: Qs
[x^2 + x*y + 6*y^2, 2*x^2 - x*y + 3*y^2, 2*x^2 + x*y + 3*y^2]
sage: [Q.solve_integer(3) for Q in Qs]
- [None, (0, -1), (0, -1)]
+ [None, (0, 1), (0, 1)]
sage: [Q.solve_integer(5) for Q in Qs]
[None, None, None]
sage: [Q.solve_integer(6) for Q in Qs]
@@ -1741,11 +1741,11 @@ class BinaryQF(SageObject):
sage: # needs sage.libs.pari
sage: Q = BinaryQF([1, 0, 5])
sage: Q.solve_integer(126, _flag=1)
- [(11, -1), (-1, -5), (-1, 5), (-11, -1)]
+ [(-11, -1), (-1, -5), (-1, 5), (11, -1)]
sage: Q.solve_integer(126, _flag=2)
(11, -1)
sage: Q.solve_integer(126, _flag=3)
- [(11, -1), (-1, -5), (-1, 5), (-11, -1), (-9, -3), (9, -3)]
+ [(-11, -1), (-9, -3), (-1, -5), (-1, 5), (9, -3), (11, -1)]
"""
if self.is_negative_definite(): # not supported by PARI
return (-self).solve_integer(-n)
diff --git a/src/sage/rings/finite_rings/finite_field_prime_modn.py b/src/sage/rings/finite_rings/finite_field_prime_modn.py
index d94b0a4335a..0978c7328fe 100644
--- a/src/sage/rings/finite_rings/finite_field_prime_modn.py
+++ b/src/sage/rings/finite_rings/finite_field_prime_modn.py
@@ -114,9 +114,9 @@ class FiniteField_prime_modn(FiniteField_generic, integer_mod_ring.IntegerModRin
sage: RF13 = K.residue_field(pp)
sage: RF13.hom([GF(13)(1)])
Ring morphism:
- From: Residue field of Fractional ideal (-w - 18)
- To: Finite Field of size 13
- Defn: 1 |--> 1
+ From: Residue field of Fractional ideal (w + 18)
+ To: Finite Field of size 13
+ Defn: 1 |--> 1
Check that :issue:`19573` is resolved::
diff --git a/src/sage/rings/finite_rings/residue_field.pyx b/src/sage/rings/finite_rings/residue_field.pyx
index 3146f7fd764..a8e77e48b76 100644
--- a/src/sage/rings/finite_rings/residue_field.pyx
+++ b/src/sage/rings/finite_rings/residue_field.pyx
@@ -22,14 +22,13 @@ monogenic (i.e., 2 is an essential discriminant divisor)::
sage: # needs sage.rings.number_field
sage: K.<a> = NumberField(x^3 + x^2 - 2*x + 8)
sage: F = K.factor(2); F
- (Fractional ideal (-1/2*a^2 + 1/2*a - 1)) * (Fractional ideal (-a^2 + 2*a - 3))
- * (Fractional ideal (3/2*a^2 - 5/2*a + 4))
+ (Fractional ideal (-1/2*a^2 + 1/2*a - 1)) * (Fractional ideal (a^2 - 2*a + 3)) * (Fractional ideal (-3/2*a^2 + 5/2*a - 4))
sage: F[0][0].residue_field()
Residue field of Fractional ideal (-1/2*a^2 + 1/2*a - 1)
sage: F[1][0].residue_field()
- Residue field of Fractional ideal (-a^2 + 2*a - 3)
+ Residue field of Fractional ideal (a^2 - 2*a + 3)
sage: F[2][0].residue_field()
- Residue field of Fractional ideal (3/2*a^2 - 5/2*a + 4)
+ Residue field of Fractional ideal (-3/2*a^2 + 5/2*a - 4)
We can also form residue fields from `\ZZ`::
@@ -126,10 +125,10 @@ First over a small non-prime field::
sage: I = ideal([ubar*X + Y]); I
Ideal (ubar*X + Y) of Multivariate Polynomial Ring in X, Y over
Residue field in ubar of Fractional ideal
- (47, 517/55860*u^5 + 235/3724*u^4 + 9829/13965*u^3
- + 54106/13965*u^2 + 64517/27930*u + 755696/13965)
+ (47, 4841/93100*u^5 + 34451/139650*u^4 + 303697/69825*u^3
+ + 297893/27930*u^2 + 1649764/23275*u + 2633506/69825)
sage: I.groebner_basis() # needs sage.libs.singular
- [X + (-19*ubar^2 - 5*ubar - 17)*Y]
+ [X + (-15*ubar^2 + 3*ubar - 2)*Y]
And now over a large prime field::
@@ -496,9 +495,9 @@ class ResidueField_generic(Field):
sage: # needs sage.rings.number_field
sage: I = QQ[i].factor(2)[0][0]; I
- Fractional ideal (I + 1)
+ Fractional ideal (-I - 1)
sage: k = I.residue_field(); k
- Residue field of Fractional ideal (I + 1)
+ Residue field of Fractional ideal (-I - 1)
sage: type(k)
<class 'sage.rings.finite_rings.residue_field.ResidueFiniteField_prime_modn_with_category'>
@@ -1008,7 +1007,7 @@ cdef class ReductionMap(Map):
sage: cr
Partially defined reduction map:
From: Number Field in a with defining polynomial x^2 + 1
- To: Residue field of Fractional ideal (a + 1)
+ To: Residue field of Fractional ideal (-a + 1)
sage: cr == r # not implemented
True
sage: r(2 + a) == cr(2 + a)
@@ -1039,7 +1038,7 @@ cdef class ReductionMap(Map):
sage: cr
Partially defined reduction map:
From: Number Field in a with defining polynomial x^2 + 1
- To: Residue field of Fractional ideal (a + 1)
+ To: Residue field of Fractional ideal (-a + 1)
sage: cr == r # not implemented
True
sage: r(2 + a) == cr(2 + a)
@@ -1071,7 +1070,7 @@ cdef class ReductionMap(Map):
sage: r = F.reduction_map(); r
Partially defined reduction map:
From: Number Field in a with defining polynomial x^2 + 1
- To: Residue field of Fractional ideal (a + 1)
+ To: Residue field of Fractional ideal (-a + 1)
We test that calling the function also works after copying::
@@ -1083,7 +1082,7 @@ cdef class ReductionMap(Map):
Traceback (most recent call last):
...
ZeroDivisionError: Cannot reduce field element 1/2*a
- modulo Fractional ideal (a + 1): it has negative valuation
+ modulo Fractional ideal (-a + 1): it has negative valuation
sage: # needs sage.rings.finite_rings
sage: R.<t> = GF(2)[]; h = t^5 + t^2 + 1
@@ -1105,11 +1104,11 @@ cdef class ReductionMap(Map):
sage: # needs sage.rings.number_field
sage: K.<i> = NumberField(x^2 + 1)
sage: P1, P2 = [g[0] for g in K.factor(5)]; P1, P2
- (Fractional ideal (-i - 2), Fractional ideal (2*i + 1))
+ (Fractional ideal (2*i - 1), Fractional ideal (-2*i - 1))
sage: a = 1/(1+2*i)
sage: F1, F2 = [g.residue_field() for g in [P1,P2]]; F1, F2
- (Residue field of Fractional ideal (-i - 2),
- Residue field of Fractional ideal (2*i + 1))
+ (Residue field of Fractional ideal (2*i - 1),
+ Residue field of Fractional ideal (-2*i - 1))
sage: a.valuation(P1)
0
sage: F1(i/7)
@@ -1122,7 +1121,7 @@ cdef class ReductionMap(Map):
Traceback (most recent call last):
...
ZeroDivisionError: Cannot reduce field element -2/5*i + 1/5
- modulo Fractional ideal (2*i + 1): it has negative valuation
+ modulo Fractional ideal (-2*i - 1): it has negative valuation
"""
# The reduction map is just x |--> F(to_vs(x) * (PB**(-1))) if
# either x is integral or the denominator of x is coprime to
@@ -1188,8 +1187,7 @@ cdef class ReductionMap(Map):
sage: f = k.convert_map_from(K)
sage: s = f.section(); s
Lifting map:
- From: Residue field in abar of
- Fractional ideal (-14*a^4 + 24*a^3 + 26*a^2 - 58*a + 15)
+ From: Residue field in abar of Fractional ideal (14*a^4 - 24*a^3 - 26*a^2 + 58*a - 15)
To: Number Field in a with defining polynomial x^5 - 5*x + 2
sage: s(k.gen())
a
@@ -1424,8 +1422,7 @@ cdef class ResidueFieldHomomorphism_global(RingHomomorphism):
sage: f = k.coerce_map_from(K.ring_of_integers())
sage: s = f.section(); s
Lifting map:
- From: Residue field in abar of
- Fractional ideal (-14*a^4 + 24*a^3 + 26*a^2 - 58*a + 15)
+ From: Residue field in abar of Fractional ideal (14*a^4 - 24*a^3 - 26*a^2 + 58*a - 15)
To: Maximal Order generated by a in Number Field in a with defining polynomial x^5 - 5*x + 2
sage: s(k.gen())
a
@@ -1678,7 +1675,7 @@ cdef class LiftingMap(Section):
sage: F.<tmod> = K.factor(7)[0][0].residue_field()
sage: F.lift_map() #indirect doctest
Lifting map:
- From: Residue field in tmod of Fractional ideal (theta_12^2 + 2)
+ From: Residue field in tmod of Fractional ideal (2*theta_12^3 + theta_12)
To: Maximal Order generated by theta_12 in Cyclotomic Field of order 12 and degree 4
"""
return "Lifting"
diff --git a/src/sage/rings/finite_rings/residue_field_pari_ffelt.pyx b/src/sage/rings/finite_rings/residue_field_pari_ffelt.pyx
index e9962c3ccde..90a68c619f6 100644
--- a/src/sage/rings/finite_rings/residue_field_pari_ffelt.pyx
+++ b/src/sage/rings/finite_rings/residue_field_pari_ffelt.pyx
@@ -103,7 +103,7 @@ class ResidueFiniteField_pari_ffelt(ResidueField_generic, FiniteField_pari_ffelt
sage: P.residue_class_degree()
2
sage: ff.<alpha> = P.residue_field(); ff
- Residue field in alpha of Fractional ideal (-12*aa^2 + 189*aa - 475)
+ Residue field in alpha of Fractional ideal (12*aa^2 - 189*aa + 475)
sage: type(ff)
<class 'sage.rings.finite_rings.residue_field_pari_ffelt.ResidueFiniteField_pari_ffelt_with_category'>
sage: ff(alpha^2 + 1)
diff --git a/src/sage/rings/integer.pyx b/src/sage/rings/integer.pyx
index 9616e7946bc..bcc45e703a2 100644
--- a/src/sage/rings/integer.pyx
+++ b/src/sage/rings/integer.pyx
@@ -5585,7 +5585,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement):
sage: 5.is_norm(K)
False
sage: n.is_norm(K, element=True)
- (True, -4*beta + 6)
+ (True, 4*beta + 6)
sage: n.is_norm(K, element=True)[1].norm()
4
sage: n = 5
diff --git a/src/sage/rings/number_field/S_unit_solver.py b/src/sage/rings/number_field/S_unit_solver.py
index 0ffac369720..1260650ef77 100644
--- a/src/sage/rings/number_field/S_unit_solver.py
+++ b/src/sage/rings/number_field/S_unit_solver.py
@@ -12,10 +12,10 @@ EXAMPLES::
sage: x = polygen(ZZ, 'x')
sage: K.<xi> = NumberField(x^2 + x + 1)
sage: S = K.primes_above(3)
- sage: expected = [((0, 1), (4, 0), xi + 2, -xi - 1),
- ....: ((1, -1), (0, -1), 1/3*xi + 2/3, -1/3*xi + 1/3),
+ sage: expected = [((4, 1), (4, 0), xi + 2, -xi - 1),
+ ....: ((3, -1), (2, -1), 1/3*xi + 2/3, -1/3*xi + 1/3),
....: ((1, 0), (5, 0), xi + 1, -xi),
- ....: ((2, 0), (5, 1), xi, -xi + 1)]
+ ....: ((2, 0), (3, 1), xi, -xi + 1)]
sage: sols = solve_S_unit_equation(K, S, 200)
sage: eq_up_to_order(sols, expected)
True
@@ -1448,7 +1448,7 @@ def embedding_to_Kp(a, prime, prec):
sage: from sage.rings.number_field.S_unit_solver import embedding_to_Kp
sage: K.<a> = QuadraticField(17)
sage: p = K.prime_above(13); p
- Fractional ideal (-a + 2)
+ Fractional ideal (a - 2)
sage: embedding_to_Kp(a-3, p, 15)
-20542890112375827
@@ -1791,10 +1791,10 @@ def sieve_ordering(SUK, q):
Residue field of Fractional ideal (2*xi + 1))
sage: sieve_data[2]
- ([18, 12, 16, 8], [18, 16, 10, 4], [18, 10, 12, 10])
+ ([18, 9, 16, 8], [18, 7, 10, 4], [18, 3, 12, 10])
sage: sieve_data[3]
- (648, 2916, 3888)
+ (972, 972, 3888)
"""
K = SUK.number_field()
@@ -2170,23 +2170,23 @@ def construct_complement_dictionaries(split_primes_list, SUK, verbose=False):
sage: SUK = K.S_unit_group(S=K.primes_above(H))
sage: split_primes_list = [3, 7]
sage: actual = construct_complement_dictionaries(split_primes_list, SUK)
- sage: expected = {3: {(0, 1, 0): [(1, 0, 0), (0, 1, 0)],
- ....: (1, 0, 0): [(1, 0, 0), (0, 1, 0)]},
- ....: 7: {(0, 1, 0): [(1, 0, 0), (1, 4, 4), (1, 2, 2)],
- ....: (0, 1, 2): [(0, 1, 2), (0, 3, 4), (0, 5, 0)],
- ....: (0, 3, 2): [(1, 0, 0), (1, 4, 4), (1, 2, 2)],
- ....: (0, 3, 4): [(0, 1, 2), (0, 3, 4), (0, 5, 0)],
- ....: (0, 5, 0): [(0, 1, 2), (0, 3, 4), (0, 5, 0)],
- ....: (0, 5, 4): [(1, 0, 0), (1, 4, 4), (1, 2, 2)],
- ....: (1, 0, 0): [(0, 5, 4), (0, 3, 2), (0, 1, 0)],
- ....: (1, 0, 2): [(1, 0, 4), (1, 4, 2), (1, 2, 0)],
+ sage: expected = {3: {(1, 1, 0): [(1, 0, 0), (1, 1, 0)],
+ ....: (1, 0, 0): [(1, 0, 0), (1, 1, 0)]},
+ ....: 7: {(1, 1, 0): [(1, 0, 0), (1, 4, 4), (1, 2, 2)],
+ ....: (1, 3, 2): [(1, 0, 0), (1, 4, 4), (1, 2, 2)],
+ ....: (1, 5, 4): [(1, 0, 0), (1, 4, 4), (1, 2, 2)],
....: (1, 0, 4): [(1, 2, 4), (1, 4, 0), (1, 0, 2)],
....: (1, 2, 0): [(1, 2, 4), (1, 4, 0), (1, 0, 2)],
- ....: (1, 2, 2): [(0, 5, 4), (0, 3, 2), (0, 1, 0)],
+ ....: (1, 4, 2): [(1, 2, 4), (1, 4, 0), (1, 0, 2)],
+ ....: (1, 1, 2): [(1, 1, 2), (1, 3, 4), (1, 5, 0)],
+ ....: (1, 3, 4): [(1, 1, 2), (1, 3, 4), (1, 5, 0)],
+ ....: (1, 5, 0): [(1, 1, 2), (1, 3, 4), (1, 5, 0)],
+ ....: (1, 0, 2): [(1, 0, 4), (1, 4, 2), (1, 2, 0)],
....: (1, 2, 4): [(1, 0, 4), (1, 4, 2), (1, 2, 0)],
....: (1, 4, 0): [(1, 0, 4), (1, 4, 2), (1, 2, 0)],
- ....: (1, 4, 2): [(1, 2, 4), (1, 4, 0), (1, 0, 2)],
- ....: (1, 4, 4): [(0, 5, 4), (0, 3, 2), (0, 1, 0)]}}
+ ....: (1, 0, 0): [(1, 5, 4), (1, 3, 2), (1, 1, 0)],
+ ....: (1, 2, 2): [(1, 5, 4), (1, 3, 2), (1, 1, 0)],
+ ....: (1, 4, 4): [(1, 5, 4), (1, 3, 2), (1, 1, 0)]}}
sage: all(set(actual[p][vec]) == set(expected[p][vec])
....: for p in [3, 7] for vec in expected[p])
True
@@ -2693,9 +2693,9 @@ def sieve_below_bound(K, S, bound=10, bump=10, split_primes_list=[], verbose=Fal
sage: SUK = UnitGroup(K, S=tuple(K.primes_above(3)))
sage: S = SUK.primes()
sage: sols = sieve_below_bound(K, S, 10)
- sage: expected = [((1, -1), (0, -1), 1/3*xi + 2/3, -1/3*xi + 1/3),
- ....: ((0, 1), (4, 0), xi + 2, -xi - 1),
- ....: ((2, 0), (5, 1), xi, -xi + 1),
+ sage: expected = [((3, -1), (2, -1), 1/3*xi + 2/3, -1/3*xi + 1/3),
+ ....: ((4, 1), (4, 0), xi + 2, -xi - 1),
+ ....: ((2, 0), (3, 1), xi, -xi + 1),
....: ((1, 0), (5, 0), xi + 1, -xi)]
sage: eq_up_to_order(sols, expected)
True
@@ -2758,10 +2758,10 @@ def solve_S_unit_equation(K, S, prec=106, include_exponents=True, include_bound=
sage: K.<xi> = NumberField(x^2 + x + 1)
sage: S = K.primes_above(3)
sage: sols = solve_S_unit_equation(K, S, 200)
- sage: expected = [((0, 1), (4, 0), xi + 2, -xi - 1),
- ....: ((1, -1), (0, -1), 1/3*xi + 2/3, -1/3*xi + 1/3),
+ sage: expected = [((4, 1), (4, 0), xi + 2, -xi - 1),
+ ....: ((3, -1), (2, -1), 1/3*xi + 2/3, -1/3*xi + 1/3),
....: ((1, 0), (5, 0), xi + 1, -xi),
- ....: ((2, 0), (5, 1), xi, -xi + 1)]
+ ....: ((2, 0), (3, 1), xi, -xi + 1)]
sage: eq_up_to_order(sols, expected)
True
@@ -2769,7 +2769,7 @@ def solve_S_unit_equation(K, S, prec=106, include_exponents=True, include_bound=
sage: solutions, bound = solve_S_unit_equation(K, S, 100, include_bound=True)
sage: bound
- 7
+ 6
You can omit the exponent vectors::
diff --git a/src/sage/rings/number_field/galois_group.py b/src/sage/rings/number_field/galois_group.py
index c974c3df6ff..ee53ca6d674 100644
--- a/src/sage/rings/number_field/galois_group.py
+++ b/src/sage/rings/number_field/galois_group.py
@@ -995,8 +995,8 @@ class GaloisGroup_v2(GaloisGroup_perm):
sage: K.<b> = NumberField(x^4 - 2*x^2 + 2, 'a').galois_closure()
sage: G = K.galois_group()
sage: [G.artin_symbol(P) for P in K.primes_above(7)]
- [(1,4)(2,3)(5,8)(6,7), (1,4)(2,3)(5,8)(6,7),
- (1,5)(2,6)(3,7)(4,8), (1,5)(2,6)(3,7)(4,8)]
+ [(1,5)(2,6)(3,7)(4,8), (1,5)(2,6)(3,7)(4,8),
+ (1,4)(2,3)(5,8)(6,7), (1,4)(2,3)(5,8)(6,7)]
sage: G.artin_symbol(17)
Traceback (most recent call last):
...
diff --git a/src/sage/rings/number_field/number_field.py b/src/sage/rings/number_field/number_field.py
index bb16476980e..3a98a997962 100644
--- a/src/sage/rings/number_field/number_field.py
+++ b/src/sage/rings/number_field/number_field.py
@@ -3627,7 +3627,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
sage: L.<b> = K.extension(x^2 - 3, x^2 + 1)
sage: M.<c> = L.extension(x^2 + 1)
sage: L.ideal(K.ideal(2, a))
- Fractional ideal (a)
+ Fractional ideal (-a)
sage: M.ideal(K.ideal(2, a)) == M.ideal(a*(b - c)/2)
True
@@ -3665,40 +3665,29 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
sage: x = polygen(QQ, 'x')
sage: K.<a> = NumberField(x^2 + 23)
- sage: d = K.ideals_of_bdd_norm(10)
- sage: for n in d:
- ....: print(n)
- ....: for I in sorted(d[n]):
- ....: print(I)
- 1
- Fractional ideal (1)
- 2
- Fractional ideal (2, 1/2*a - 1/2)
- Fractional ideal (2, 1/2*a + 1/2)
- 3
- Fractional ideal (3, 1/2*a - 1/2)
- Fractional ideal (3, 1/2*a + 1/2)
- 4
- Fractional ideal (2)
- Fractional ideal (4, 1/2*a + 3/2)
- Fractional ideal (4, 1/2*a + 5/2)
- 5
- 6
- Fractional ideal (1/2*a - 1/2)
- Fractional ideal (1/2*a + 1/2)
- Fractional ideal (6, 1/2*a + 5/2)
- Fractional ideal (6, 1/2*a + 7/2)
- 7
- 8
- Fractional ideal (4, a - 1)
- Fractional ideal (4, a + 1)
- Fractional ideal (1/2*a + 3/2)
- Fractional ideal (1/2*a - 3/2)
- 9
- Fractional ideal (3)
- Fractional ideal (9, 1/2*a + 7/2)
- Fractional ideal (9, 1/2*a + 11/2)
- 10
+ sage: d = K.ideals_of_bdd_norm(10); d # random
+ {1: [Fractional ideal (1)],
+ 2: [Fractional ideal (2, 1/2*a - 1/2), Fractional ideal (2, 1/2*a + 1/2)],
+ 3: [Fractional ideal (3, 1/2*a + 1/2), Fractional ideal (3, 1/2*a - 1/2)],
+ 4: [Fractional ideal (4, 1/2*a + 3/2),
+ Fractional ideal (2),
+ Fractional ideal (4, 1/2*a + 5/2)],
+ 5: [],
+ 6: [Fractional ideal (6, 1/2*a + 7/2),
+ Fractional ideal (-1/2*a - 1/2),
+ Fractional ideal (-1/2*a + 1/2),
+ Fractional ideal (6, 1/2*a + 5/2)],
+ 7: [],
+ 8: [Fractional ideal (1/2*a + 3/2),
+ Fractional ideal (4, a - 1),
+ Fractional ideal (4, a + 1),
+ Fractional ideal (-1/2*a + 3/2)],
+ 9: [Fractional ideal (9, 1/2*a + 7/2),
+ Fractional ideal (3),
+ Fractional ideal (9, 1/2*a + 11/2)],
+ 10: []}
+ sage: [[I.norm() for I in sorted(d[n])] for n in d]
+ [[1], [2, 2], [3, 3], [4, 4, 4], [], [6, 6, 6, 6], [], [8, 8, 8, 8], [9, 9, 9], []]
"""
hnf_ideals = self.pari_nf().ideallist(bound)
d = {}
@@ -3925,9 +3914,13 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
EXAMPLES::
sage: K.<i> = QuadraticField(-1)
- sage: K.primes_of_bounded_norm(10)
- [Fractional ideal (i + 1), Fractional ideal (-i - 2),
- Fractional ideal (2*i + 1), Fractional ideal (3)]
+ sage: P = K.primes_of_bounded_norm(10); P # random
+ [Fractional ideal (i + 1),
+ Fractional ideal (i + 2),
+ Fractional ideal (-i + 2),
+ Fractional ideal (3)]
+ sage: [p.norm() for p in P]
+ [2, 5, 5, 9]
sage: K.primes_of_bounded_norm(1)
[]
sage: x = polygen(QQ, 'x')
@@ -3936,10 +3929,10 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
sage: P
[Fractional ideal (a),
Fractional ideal (a + 1),
- Fractional ideal (-a^2 - 1),
+ Fractional ideal (a^2 + 1),
Fractional ideal (a^2 + a - 1),
Fractional ideal (2*a + 1),
- Fractional ideal (-2*a^2 - a - 1),
+ Fractional ideal (2*a^2 + a + 1),
Fractional ideal (a^2 - 2*a - 1),
Fractional ideal (a + 3)]
sage: [p.norm() for p in P]
@@ -3988,11 +3981,13 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
sage: K.<i> = QuadraticField(-1)
sage: it = K.primes_of_bounded_norm_iter(10)
- sage: list(it)
+ sage: l = list(it); l # random
[Fractional ideal (i + 1),
Fractional ideal (3),
- Fractional ideal (-i - 2),
- Fractional ideal (2*i + 1)]
+ Fractional ideal (i + 2),
+ Fractional ideal (-i + 2)]
+ sage: [I.norm() for I in l]
+ [2, 9, 5, 5]
sage: list(K.primes_of_bounded_norm_iter(1))
[]
"""
@@ -4317,7 +4312,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
sage: k.<a> = NumberField(x^4 - 3/2*x + 5/3); k
Number Field in a with defining polynomial x^4 - 3/2*x + 5/3
sage: k.pari_nf()
- [y^4 - 324*y + 2160, [0, 2], 48918708, 216, ..., [36, 36*y, y^3 + 6*y^2 - 252, 6*y^2], [1, 0, 0, 252; 0, 1, 0, 0; 0, 0, 0, 36; 0, 0, 6, -36], [1, 0, 0, 0, 0, 0, -18, 42, 0, -18, -46, -60, 0, 42, -60, -60; 0, 1, 0, 0, 1, 0, 2, 0, 0, 2, -11, -1, 0, 0, -1, 9; 0, 0, 1, 0, 0, 0, 6, 6, 1, 6, -5, 0, 0, 6, 0, 0; 0, 0, 0, 1, 0, 6, -6, -6, 0, -6, -1, 2, 1, -6, 2, 0]]
+ [y^4 - 324*y + 2160, [0, 2], 48918708, 216, ..., [36, 36*y, y^3 + 6*y^2 - 252, -6*y^2], [1, 0, 0, 252; 0, 1, 0, 0; 0, 0, 0, 36; 0, 0, -6, 36], [1, 0, 0, 0, 0, 0, -18, -42, 0, -18, -46, 60, 0, -42, 60, -60; 0, 1, 0, 0, 1, 0, 2, 0, 0, 2, -11, 1, 0, 0, 1, 9; 0, 0, 1, 0, 0, 0, 6, -6, 1, 6, -5, 0, 0, -6, 0, 0; 0, 0, 0, 1, 0, -6, 6, -6, 0, 6, 1, 2, 1, -6, 2, 0]]
sage: pari(k)
[y^4 - 324*y + 2160, [0, 2], 48918708, 216, ...]
sage: gp(k)
@@ -4807,7 +4802,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
1/13*a^2 + 7/13*a - 332/13,
-1/13*a^2 + 6/13*a + 345/13,
-1,
- -2/13*a^2 - 1/13*a + 755/13]
+ 1/13*a^2 - 19/13*a - 7/13]
sage: units[5] in (1/13*a^2 - 19/13*a - 7/13, 1/13*a^2 + 20/13*a - 7/13)
True
sage: len(units) == 6
@@ -4818,7 +4813,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
sage: K.<a> = NumberField(2*x^2 - 1/3)
sage: K._S_class_group_and_units(tuple(K.primes_above(2) + K.primes_above(3)))
- ([6*a + 2, 6*a + 3, -1, -12*a + 5], [])
+ ([...6*a...2, ...6*a...3, -1, ...12*a...5], [])
"""
K_pari = self.pari_bnf(proof=proof)
S_pari = [p.pari_prime() for p in sorted(set(S))]
@@ -4996,7 +4991,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
1/13*a^2 + 7/13*a - 332/13,
-1/13*a^2 + 6/13*a + 345/13,
-1,
- -2/13*a^2 - 1/13*a + 755/13]
+ 1/13*a^2 - 19/13*a - 7/13]
sage: gens[5] in (1/13*a^2 - 19/13*a - 7/13, 1/13*a^2 + 20/13*a - 7/13)
True
sage: gens[6] in (-1/13*a^2 + 45/13*a - 97/13, 1/13*a^2 - 45/13*a + 97/13)
@@ -5153,16 +5148,20 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
sage: KS2, gens, fromKS2, toKS2 = K.selmer_space([P2, P3, P5], 2)
sage: KS2
Vector space of dimension 4 over Finite Field of size 2
- sage: gens
- [a + 1, a, 2, -1]
+ sage: gens # random
+ [-a - 1, a, 2, -1]
+ sage: gens in ([-a - 1, a, 2, -1], [a + 1, a, 2, -1])
+ True
Each generator must have even valuation at primes not in `S`::
- sage: [K.ideal(g).factor() for g in gens]
+ sage: facgens = [K.ideal(g).factor() for g in gens]; facgens # random
[(Fractional ideal (2, a + 1)) * (Fractional ideal (3, a + 1)),
Fractional ideal (a),
(Fractional ideal (2, a + 1))^2,
1]
+ sage: facgens[2][0][1]
+ 2
sage: toKS2(10)
(0, 0, 1, 1)
@@ -5174,8 +5173,10 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
sage: KS3, gens, fromKS3, toKS3 = K.selmer_space([P2, P3, P5], 3)
sage: KS3
Vector space of dimension 3 over Finite Field of size 3
- sage: gens
- [1/2, 1/4*a + 1/4, a]
+ sage: gens # random
+ [1/2, -1/4*a - 1/4, a]
+ sage: gens in ([1/2, -1/4*a - 1/4, a], [1/2, 1/4*a + 1/4, a])
+ True
An example to show that the group `K(S,2)` may be strictly
larger than the group of elements giving extensions unramified
@@ -5640,7 +5641,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
sage: k.<a> = NumberField(x^2 + 23)
sage: d = k.different()
sage: d
- Fractional ideal (-a)
+ Fractional ideal (a)
sage: d.norm()
23
sage: k.disc()
@@ -5760,7 +5761,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
sage: K.elements_of_norm(3)
[]
sage: K.elements_of_norm(50)
- [-a - 7, 5*a - 5, 7*a + 1]
+ [7*a - 1, 5*a - 5, -7*a - 1]
TESTS:
@@ -5871,11 +5872,16 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
sage: K.<a> = NumberField(x^2 + 1)
sage: K.factor(1/3)
(Fractional ideal (3))^-1
- sage: K.factor(1+a)
- Fractional ideal (a + 1)
- sage: K.factor(1+a/5)
- (Fractional ideal (a + 1)) * (Fractional ideal (-a - 2))^-1
- * (Fractional ideal (2*a + 1))^-1 * (Fractional ideal (-2*a + 3))
+ sage: fac = K.factor(1+a); fac # random
+ Fractional ideal (-a - 1)
+ sage: len(fac)
+ 1
+ sage: fac = K.factor(1+a/5); fac # random
+ (Fractional ideal (-a - 1)) * (Fractional ideal (2*a - 1))^-1 * (Fractional ideal (-2*a - 1))^-1 * (Fractional ideal (3*a + 2))
+ sage: len(fac)
+ 4
+ sage: product(I[0]^I[1] for I in list(fac))
+ Fractional ideal (1/5*a + 1)
An example over a relative number field::
@@ -5908,9 +5914,9 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
sage: (fi, fj) = f[::]
sage: (fi[1], fj[1])
(1, 1)
- sage: fi[0] == L.fractional_ideal(1/2*a*b - a + 1/2)
+ sage: fi[0] == L.fractional_ideal(-1/2*a*b - a + 1/2)
True
- sage: fj[0] == L.fractional_ideal(-1/2*a*b - a + 1/2)
+ sage: fj[0] == L.fractional_ideal(1/2*a*b - a + 1/2)
True
"""
return self.ideal(n).factor()
@@ -6507,12 +6513,12 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
sage: k.<a> = NumberField(x^6 + 2218926655879913714112*x^4 - 32507675650290949030789018433536*x^3 + 4923635504174417014460581055002374467948544*x^2 - 36066074010564497464129951249279114076897746988630016*x + 264187244046129768986806800244258952598300346857154900812365824)
sage: new_basis = k.reduced_basis(prec=120)
sage: [c.minpoly() for c in new_basis]
- [x - 1,
- x^2 + x + 1,
- x^6 + 3*x^5 - 102*x^4 - 103*x^3 + 10572*x^2 - 59919*x + 127657,
- x^6 + 3*x^5 - 102*x^4 - 103*x^3 + 10572*x^2 - 59919*x + 127657,
- x^3 - 171*x + 848,
- x^6 + 171*x^4 + 1696*x^3 + 29241*x^2 + 145008*x + 719104]
+ [x^2 + x + 1,
+ x - 1,
+ x^6 + 3*x^5 - 102*x^4 - 315*x^3 + 10254*x^2 + 80955*x + 198147,
+ x^6 + 213*x^4 + 12567*x^2 + 198147,
+ x^6 + 171*x^4 - 1696*x^3 + 29241*x^2 - 145008*x + 719104,
+ x^6 + 171*x^4 - 1696*x^3 + 29241*x^2 - 145008*x + 719104]
sage: R = k.order(new_basis)
sage: R.discriminant()==k.discriminant()
True
@@ -7107,14 +7113,14 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
sage: K.units(proof=True) # takes forever, not tested
...
sage: K.units(proof=False) # result not independently verified
- (-a^9 - a + 1,
+ (a^9 + a - 1,
+ -a^15 + a^12 - a^10 + a^9 + 2*a^8 - 3*a^7 - a^6 + 3*a^5 - a^4 - 4*a^3 + 3*a^2 + 2*a - 2,
+ a^15 + a^14 + a^13 + a^12 + a^10 - a^7 - a^6 - a^2 - 1,
+ 2*a^16 - 3*a^15 + 3*a^14 - 3*a^13 + 3*a^12 - a^11 + a^9 - 3*a^8 + 4*a^7 - 5*a^6 + 6*a^5 - 4*a^4 + 3*a^3 - 2*a^2 - 2*a + 4,
-a^16 + a^15 - a^14 + a^12 - a^11 + a^10 + a^8 - a^7 + 2*a^6 - a^4 + 3*a^3 - 2*a^2 + 2*a - 1,
- 2*a^16 - a^14 - a^13 + 3*a^12 - 2*a^10 + a^9 + 3*a^8 - 3*a^6 + 3*a^5 + 3*a^4 - 2*a^3 - 2*a^2 + 3*a + 4,
- a^15 + a^14 + 2*a^11 + a^10 - a^9 + a^8 + 2*a^7 - a^5 + 2*a^3 - a^2 - 3*a + 1,
- -a^16 - a^15 - a^14 - a^13 - a^12 - a^11 - a^10 - a^9 - a^8 - a^7 - a^6 - a^5 - a^4 - a^3 - a^2 + 2,
- -2*a^16 + 3*a^15 - 3*a^14 + 3*a^13 - 3*a^12 + a^11 - a^9 + 3*a^8 - 4*a^7 + 5*a^6 - 6*a^5 + 4*a^4 - 3*a^3 + 2*a^2 + 2*a - 4,
- a^15 - a^12 + a^10 - a^9 - 2*a^8 + 3*a^7 + a^6 - 3*a^5 + a^4 + 4*a^3 - 3*a^2 - 2*a + 2,
- 2*a^16 + a^15 - a^11 - 3*a^10 - 4*a^9 - 4*a^8 - 4*a^7 - 5*a^6 - 7*a^5 - 8*a^4 - 6*a^3 - 5*a^2 - 6*a - 7)
+ a^16 - 2*a^15 - 2*a^13 - a^12 - a^11 - 2*a^10 + a^9 - 2*a^8 + 2*a^7 - 3*a^6 - 3*a^4 - 2*a^3 - a^2 - 4*a + 2,
+ -a^15 - a^14 - 2*a^11 - a^10 + a^9 - a^8 - 2*a^7 + a^5 - 2*a^3 + a^2 + 3*a - 1,
+ -3*a^16 - 3*a^15 - 3*a^14 - 3*a^13 - 3*a^12 - 2*a^11 - 2*a^10 - 2*a^9 - a^8 + a^7 + 2*a^6 + 3*a^5 + 3*a^4 + 4*a^3 + 6*a^2 + 8*a + 8)
TESTS:
@@ -7123,7 +7129,7 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
sage: K.<a> = NumberField(1/2*x^2 - 1/6)
sage: K.units()
- (3*a - 2,)
+ (-3*a + 2,)
"""
proof = proof_flag(proof)
@@ -7205,14 +7211,14 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
(u0, u1, u2, u3, u4, u5, u6, u7, u8)
sage: U.gens_values() # result not independently verified
[-1,
- -a^9 - a + 1,
+ a^9 + a - 1,
+ -a^15 + a^12 - a^10 + a^9 + 2*a^8 - 3*a^7 - a^6 + 3*a^5 - a^4 - 4*a^3 + 3*a^2 + 2*a - 2,
+ a^15 + a^14 + a^13 + a^12 + a^10 - a^7 - a^6 - a^2 - 1,
+ 2*a^16 - 3*a^15 + 3*a^14 - 3*a^13 + 3*a^12 - a^11 + a^9 - 3*a^8 + 4*a^7 - 5*a^6 + 6*a^5 - 4*a^4 + 3*a^3 - 2*a^2 - 2*a + 4,
-a^16 + a^15 - a^14 + a^12 - a^11 + a^10 + a^8 - a^7 + 2*a^6 - a^4 + 3*a^3 - 2*a^2 + 2*a - 1,
- 2*a^16 - a^14 - a^13 + 3*a^12 - 2*a^10 + a^9 + 3*a^8 - 3*a^6 + 3*a^5 + 3*a^4 - 2*a^3 - 2*a^2 + 3*a + 4,
- a^15 + a^14 + 2*a^11 + a^10 - a^9 + a^8 + 2*a^7 - a^5 + 2*a^3 - a^2 - 3*a + 1,
- -a^16 - a^15 - a^14 - a^13 - a^12 - a^11 - a^10 - a^9 - a^8 - a^7 - a^6 - a^5 - a^4 - a^3 - a^2 + 2,
- -2*a^16 + 3*a^15 - 3*a^14 + 3*a^13 - 3*a^12 + a^11 - a^9 + 3*a^8 - 4*a^7 + 5*a^6 - 6*a^5 + 4*a^4 - 3*a^3 + 2*a^2 + 2*a - 4,
- a^15 - a^12 + a^10 - a^9 - 2*a^8 + 3*a^7 + a^6 - 3*a^5 + a^4 + 4*a^3 - 3*a^2 - 2*a + 2,
- 2*a^16 + a^15 - a^11 - 3*a^10 - 4*a^9 - 4*a^8 - 4*a^7 - 5*a^6 - 7*a^5 - 8*a^4 - 6*a^3 - 5*a^2 - 6*a - 7]
+ a^16 - 2*a^15 - 2*a^13 - a^12 - a^11 - 2*a^10 + a^9 - 2*a^8 + 2*a^7 - 3*a^6 - 3*a^4 - 2*a^3 - a^2 - 4*a + 2,
+ -a^15 - a^14 - 2*a^11 - a^10 + a^9 - a^8 - 2*a^7 + a^5 - 2*a^3 + a^2 + 3*a - 1,
+ -3*a^16 - 3*a^15 - 3*a^14 - 3*a^13 - 3*a^12 - 2*a^11 - 2*a^10 - 2*a^9 - a^8 + a^7 + 2*a^6 + 3*a^5 + 3*a^4 + 4*a^3 + 6*a^2 + 8*a + 8]
"""
proof = proof_flag(proof)
@@ -7261,8 +7267,8 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
sage: U = K.S_unit_group(S=a); U
S-unit group with structure C10 x Z x Z x Z of
Number Field in a with defining polynomial x^4 - 10*x^3 + 100*x^2 - 375*x + 1375
- with S = (Fractional ideal (5, 1/275*a^3 + 4/55*a^2 - 5/11*a + 5),
- Fractional ideal (11, 1/275*a^3 + 4/55*a^2 - 5/11*a + 9))
+ with S = (Fractional ideal (5, -7/275*a^3 + 1/11*a^2 - 9/11*a),
+ Fractional ideal (11, -7/275*a^3 + 1/11*a^2 - 9/11*a + 3))
sage: U.gens()
(u0, u1, u2, u3)
sage: U.gens_values() # random
@@ -7273,8 +7279,8 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
sage: [u.multiplicative_order() for u in U.gens()]
[10, +Infinity, +Infinity, +Infinity]
sage: U.primes()
- (Fractional ideal (5, 1/275*a^3 + 4/55*a^2 - 5/11*a + 5),
- Fractional ideal (11, 1/275*a^3 + 4/55*a^2 - 5/11*a + 9))
+ (Fractional ideal (5, -7/275*a^3 + 1/11*a^2 - 9/11*a),
+ Fractional ideal (11, -7/275*a^3 + 1/11*a^2 - 9/11*a + 3))
With the default value of `S`, the S-unit group is the same as
the global unit group::
@@ -7426,8 +7432,8 @@ class NumberField_generic(WithEqualityById, number_field_base.NumberField):
sage: # needs sage.rings.padics
sage: solutions, bound = K.S_unit_solutions(S, prec=100, include_bound=True)
- sage: bound
- 7
+ sage: bound in (6, 7)
+ True
"""
from .S_unit_solver import solve_S_unit_equation
return solve_S_unit_equation(self, S, prec, include_exponents, include_bound, proof)
@@ -8782,7 +8788,7 @@ class NumberField_absolute(NumberField_generic):
(Number Field in a1 with defining polynomial x^2 - 2, Ring morphism:
From: Number Field in a1 with defining polynomial x^2 - 2
To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2
- Defn: a1 |--> a^2 + 3/2, None),
+ Defn: a1 |--> -a^2 - 3/2, None),
(Number Field in a2 with defining polynomial x^2 + 4, Ring morphism:
From: Number Field in a2 with defining polynomial x^2 + 4
To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2
@@ -8790,14 +8796,14 @@ class NumberField_absolute(NumberField_generic):
(Number Field in a3 with defining polynomial x^2 + 2, Ring morphism:
From: Number Field in a3 with defining polynomial x^2 + 2
To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2
- Defn: a3 |--> 2*a^3 + 5*a, None),
+ Defn: a3 |--> -2*a^3 - 5*a, None),
(Number Field in a4 with defining polynomial x^4 + 1, Ring morphism:
From: Number Field in a4 with defining polynomial x^4 + 1
To: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2
- Defn: a4 |--> a^3 + 1/2*a^2 + 5/2*a + 3/4, Ring morphism:
+ Defn: a4 |--> -a^3 - 1/2*a^2 - 5/2*a - 3/4, Ring morphism:
From: Number Field in a with defining polynomial 2*x^4 + 6*x^2 + 1/2
To: Number Field in a4 with defining polynomial x^4 + 1
- Defn: a |--> -1/2*a4^3 + a4^2 - 1/2*a4)
+ Defn: a |--> 1/2*a4^3 + a4^2 + 1/2*a4)
]
"""
return self._subfields_helper(degree=degree, name=name,
@@ -12694,12 +12700,12 @@ def _splitting_classes_gens_(K, m, d):
sage: L = K.subfields(20)[0][0]
sage: L.conductor() # needs sage.groups
101
- sage: _splitting_classes_gens_(L,101,20) # needs sage.libs.gap # optional - gap_package_polycyclic
+ sage: _splitting_classes_gens_(L,101,20) # optional - gap_package_polycyclic, needs sage.libs.gap
[95]
sage: K = CyclotomicField(44)
sage: L = K.subfields(4)[0][0]
- sage: _splitting_classes_gens_(L,44,4) # needs sage.libs.gap # optional - gap_package_polycyclic
+ sage: _splitting_classes_gens_(L,44,4) # optional - gap_package_polycyclic, needs sage.libs.gap
[37]
sage: K = CyclotomicField(44)
@@ -12711,7 +12717,7 @@ def _splitting_classes_gens_(K, m, d):
with zeta44_0 = 3.837971894457990?
sage: L.conductor() # needs sage.groups
11
- sage: _splitting_classes_gens_(L,11,5) # needs sage.libs.gap # optional - gap_package_polycyclic
+ sage: _splitting_classes_gens_(L,11,5) # optional - gap_package_polycyclic, needs sage.libs.gap
[10]
"""
from sage.groups.abelian_gps.abelian_group import AbelianGroup
diff --git a/src/sage/rings/number_field/number_field_element.pyx b/src/sage/rings/number_field/number_field_element.pyx
index 27432813b2b..1a676ee087b 100644
--- a/src/sage/rings/number_field/number_field_element.pyx
+++ b/src/sage/rings/number_field/number_field_element.pyx
@@ -1954,14 +1954,14 @@ cdef class NumberFieldElement(NumberFieldElement_base):
sage: x = polygen(ZZ, 'x')
sage: K.<i> = NumberField(x^2 + 1)
sage: (6*i + 6).factor()
- (-i) * (i + 1)^3 * 3
+ (i) * (-i - 1)^3 * 3
In the following example, the class number is 2. If a factorization
in prime elements exists, we will find it::
sage: K.<a> = NumberField(x^2 - 10)
sage: factor(169*a + 531)
- (-6*a - 19) * (-3*a - 1) * (-2*a + 9)
+ (-6*a - 19) * (2*a - 9) * (3*a + 1)
sage: factor(K(3))
Traceback (most recent call last):
...
@@ -4238,7 +4238,7 @@ cdef class NumberFieldElement(NumberFieldElement_base):
sage: P5s = F(5).support()
sage: P5s
- [Fractional ideal (-t^2 - 1), Fractional ideal (t^2 - 2*t - 1)]
+ [Fractional ideal (t^2 + 1), Fractional ideal (t^2 - 2*t - 1)]
sage: all(5 in P5 for P5 in P5s)
True
sage: all(P5.is_prime() for P5 in P5s)
@@ -4487,7 +4487,7 @@ cdef class NumberFieldElement(NumberFieldElement_base):
sage: f = Qi.embeddings(K)[0]
sage: a = f(2+3*i) * (2-zeta)^2
sage: a.descend_mod_power(Qi,2)
- [-2*i + 3, 3*i + 2]
+ [3*i + 2, 2*i - 3]
An absolute example::
diff --git a/src/sage/rings/number_field/number_field_ideal.py b/src/sage/rings/number_field/number_field_ideal.py
index d62ae34fb95..72e14adb3af 100644
--- a/src/sage/rings/number_field/number_field_ideal.py
+++ b/src/sage/rings/number_field/number_field_ideal.py
@@ -75,7 +75,7 @@ class NumberFieldIdeal(Ideal_generic):
Fractional ideal (3)
sage: F = pari(K).idealprimedec(5)
sage: K.ideal(F[0])
- Fractional ideal (2*i + 1)
+ Fractional ideal (-2*i - 1)
TESTS:
@@ -236,7 +236,7 @@ class NumberFieldIdeal(Ideal_generic):
sage: K.<a> = NumberField(x^2 + 3); K
Number Field in a with defining polynomial x^2 + 3
sage: f = K.factor(15); f
- (Fractional ideal (1/2*a + 3/2))^2 * (Fractional ideal (5))
+ (Fractional ideal (-a))^2 * (Fractional ideal (5))
sage: (f[0][0] < f[1][0])
True
sage: (f[0][0] == f[0][0])
@@ -273,7 +273,7 @@ class NumberFieldIdeal(Ideal_generic):
sage: A = K.ideal([5, 2 + I])
sage: B = K.ideal([13, 5 + 12*I])
sage: A*B
- Fractional ideal (4*I - 7)
+ Fractional ideal (-4*I + 7)
sage: (K.ideal(3 + I) * K.ideal(7 + I)).gens()
(10*I + 20,)
@@ -683,17 +683,17 @@ class NumberFieldIdeal(Ideal_generic):
sage: I.free_module()
Free module of degree 4 and rank 4 over Integer Ring
User basis matrix:
- [ 4 0 0 0]
- [ -3 7 -1 1]
- [ 3 7 1 1]
- [ 0 -10 0 -2]
+ [ 4 0 0 0]
+ [ 3 7 1 1]
+ [ 0 10 0 2]
+ [ 3 -7 1 -1]
sage: J = I^(-1); J.free_module()
Free module of degree 4 and rank 4 over Integer Ring
User basis matrix:
[ 1/4 0 0 0]
- [-3/16 7/16 -1/16 1/16]
[ 3/16 7/16 1/16 1/16]
- [ 0 -5/8 0 -1/8]
+ [ 0 5/8 0 1/8]
+ [ 3/16 -7/16 1/16 -1/16]
An example of intersecting ideals by intersecting free modules.::
@@ -790,7 +790,7 @@ class NumberFieldIdeal(Ideal_generic):
sage: J.is_principal()
False
sage: J.gens_reduced()
- (5, a)
+ (5, -a)
sage: all(j.parent() is K for j in J.gens())
True
sage: all(j.parent() is K for j in J.gens_reduced())
@@ -2069,7 +2069,7 @@ class NumberFieldFractionalIdeal(MultiplicativeGroupElement, NumberFieldIdeal, I
sage: K.<a> = NumberField(x^2 + 2); K
Number Field in a with defining polynomial x^2 + 2
sage: f = K.factor(2); f
- (Fractional ideal (a))^2
+ (Fractional ideal (...a))^2
sage: f[0][0].ramification_index()
2
sage: K.ideal(13).ramification_index()
@@ -2416,9 +2416,9 @@ class NumberFieldFractionalIdeal(MultiplicativeGroupElement, NumberFieldIdeal, I
sage: I = K.ideal((3+4*i)/5); I
Fractional ideal (4/5*i + 3/5)
sage: I.denominator()
- Fractional ideal (2*i + 1)
+ Fractional ideal (-2*i - 1)
sage: I.numerator()
- Fractional ideal (-i - 2)
+ Fractional ideal (2*i - 1)
sage: I.numerator().is_integral() and I.denominator().is_integral()
True
sage: I.numerator() + I.denominator() == K.unit_ideal()
@@ -2447,9 +2447,9 @@ class NumberFieldFractionalIdeal(MultiplicativeGroupElement, NumberFieldIdeal, I
sage: I = K.ideal((3+4*i)/5); I
Fractional ideal (4/5*i + 3/5)
sage: I.denominator()
- Fractional ideal (2*i + 1)
+ Fractional ideal (-2*i - 1)
sage: I.numerator()
- Fractional ideal (-i - 2)
+ Fractional ideal (2*i - 1)
sage: I.numerator().is_integral() and I.denominator().is_integral()
True
sage: I.numerator() + I.denominator() == K.unit_ideal()
@@ -3164,11 +3164,11 @@ class NumberFieldFractionalIdeal(MultiplicativeGroupElement, NumberFieldIdeal, I
Partially defined quotient map
from Number Field in i with defining polynomial x^2 + 1
to an explicit vector space representation for the quotient of
- the ring of integers by (p,I) for the ideal I=Fractional ideal (-i - 2).
+ the ring of integers by (p,I) for the ideal I=Fractional ideal (2*i - 1).
sage: lift
Lifting map
to Gaussian Integers generated by i in Number Field in i with defining polynomial x^2 + 1
- from quotient of integers by Fractional ideal (-i - 2)
+ from quotient of integers by Fractional ideal (2*i - 1)
"""
return quotient_char_p(self, p)
@@ -3213,11 +3213,11 @@ class NumberFieldFractionalIdeal(MultiplicativeGroupElement, NumberFieldIdeal, I
sage: K.<i> = NumberField(x^2 + 1)
sage: P1, P2 = [g[0] for g in K.factor(5)]; P1, P2
- (Fractional ideal (-i - 2), Fractional ideal (2*i + 1))
+ (Fractional ideal (2*i - 1), Fractional ideal (-2*i - 1))
sage: a = 1/(1+2*i)
sage: F1, F2 = [g.residue_field() for g in [P1, P2]]; F1, F2
- (Residue field of Fractional ideal (-i - 2),
- Residue field of Fractional ideal (2*i + 1))
+ (Residue field of Fractional ideal (2*i - 1),
+ Residue field of Fractional ideal (-2*i - 1))
sage: a.valuation(P1)
0
sage: F1(i/7)
@@ -3230,7 +3230,7 @@ class NumberFieldFractionalIdeal(MultiplicativeGroupElement, NumberFieldIdeal, I
Traceback (most recent call last):
...
ZeroDivisionError: Cannot reduce field element -2/5*i + 1/5
- modulo Fractional ideal (2*i + 1): it has negative valuation
+ modulo Fractional ideal (-2*i - 1): it has negative valuation
An example with a relative number field::
@@ -3491,7 +3491,7 @@ def quotient_char_p(I, p):
[]
sage: I = K.factor(13)[0][0]; I
- Fractional ideal (-2*i + 3)
+ Fractional ideal (3*i + 2)
sage: I.residue_class_degree()
1
sage: quotient_char_p(I, 13)[0]
diff --git a/src/sage/rings/number_field/number_field_ideal_rel.py b/src/sage/rings/number_field/number_field_ideal_rel.py
index 7f6cfd9b1b7..0bae4e74e13 100644
--- a/src/sage/rings/number_field/number_field_ideal_rel.py
+++ b/src/sage/rings/number_field/number_field_ideal_rel.py
@@ -11,7 +11,7 @@ EXAMPLES::
sage: G = [from_A(z) for z in I.gens()]; G
[7, -2*b*a - 1]
sage: K.fractional_ideal(G)
- Fractional ideal ((1/2*b + 2)*a - 1/2*b + 2)
+ Fractional ideal ((-1/2*b + 2)*a - 1/2*b - 2)
sage: K.fractional_ideal(G).absolute_norm().factor()
7^2
@@ -277,7 +277,7 @@ class NumberFieldFractionalIdeal_rel(NumberFieldFractionalIdeal):
sage: L.<b> = K.extension(5*x^2 + 1)
sage: P = L.primes_above(2)[0]
sage: P.gens_reduced()
- (2, -15*a*b + 3*a + 1)
+ (2, -15*a*b - 3*a + 1)
"""
try:
# Compute the single generator, if it exists
@@ -385,7 +385,7 @@ class NumberFieldFractionalIdeal_rel(NumberFieldFractionalIdeal):
sage: K.<a> = NumberField(x^2 + 6)
sage: L.<b> = K.extension(K['x'].gen()^4 + a)
sage: N = L.ideal(b).relative_norm(); N
- Fractional ideal (-a)
+ Fractional ideal (a)
sage: N.parent()
Monoid of ideals of Number Field in a with defining polynomial x^2 + 6
sage: N.ring()
@@ -410,7 +410,7 @@ class NumberFieldFractionalIdeal_rel(NumberFieldFractionalIdeal):
sage: L.<b> = K.extension(5*x^2 + 1)
sage: P = L.primes_above(2)[0]
sage: P.relative_norm()
- Fractional ideal (6*a + 2)
+ Fractional ideal (6*a - 2)
"""
L = self.number_field()
K = L.base_field()
@@ -529,7 +529,7 @@ class NumberFieldFractionalIdeal_rel(NumberFieldFractionalIdeal):
sage: L.<b> = K.extension(5*x^2 + 1)
sage: P = L.primes_above(2)[0]
sage: P.ideal_below()
- Fractional ideal (6*a + 2)
+ Fractional ideal (6*a - 2)
"""
L = self.number_field()
K = L.base_field()
@@ -548,14 +548,12 @@ class NumberFieldFractionalIdeal_rel(NumberFieldFractionalIdeal):
sage: x = polygen(ZZ, 'x')
sage: K.<a, b> = QQ.extension([x^2 + 11, x^2 - 5])
sage: K.factor(5)
- (Fractional ideal (5, (-1/4*b - 1/4)*a + 1/4*b - 3/4))^2
- * (Fractional ideal (5, (-1/4*b - 1/4)*a + 1/4*b - 7/4))^2
+ (Fractional ideal (5, (1/4*b - 1/4)*a + 1/4*b + 3/4))^2 * (Fractional ideal (5, (1/4*b - 1/4)*a + 1/4*b + 7/4))^2
sage: K.ideal(5).factor()
- (Fractional ideal (5, (-1/4*b - 1/4)*a + 1/4*b - 3/4))^2
- * (Fractional ideal (5, (-1/4*b - 1/4)*a + 1/4*b - 7/4))^2
+ (Fractional ideal (5, (1/4*b - 1/4)*a + 1/4*b + 3/4))^2 * (Fractional ideal (5, (1/4*b - 1/4)*a + 1/4*b + 7/4))^2
sage: K.ideal(5).prime_factors()
- [Fractional ideal (5, (-1/4*b - 1/4)*a + 1/4*b - 3/4),
- Fractional ideal (5, (-1/4*b - 1/4)*a + 1/4*b - 7/4)]
+ [Fractional ideal (5, (1/4*b - 1/4)*a + 1/4*b + 3/4),
+ Fractional ideal (5, (1/4*b - 1/4)*a + 1/4*b + 7/4)]
sage: PQ.<X> = QQ[]
sage: F.<a, b> = NumberFieldTower([X^2 - 2, X^2 - 3])
@@ -914,7 +912,7 @@ def is_NumberFieldFractionalIdeal_rel(x):
sage: is_NumberFieldFractionalIdeal_rel(I)
True
sage: N = I.relative_norm(); N
- Fractional ideal (-a)
+ Fractional ideal (a)
sage: is_NumberFieldFractionalIdeal_rel(N)
False
"""
diff --git a/src/sage/rings/number_field/number_field_rel.py b/src/sage/rings/number_field/number_field_rel.py
index 9ab6fd4c261..6e9bf71baf4 100644
--- a/src/sage/rings/number_field/number_field_rel.py
+++ b/src/sage/rings/number_field/number_field_rel.py
@@ -233,21 +233,21 @@ class NumberField_relative(NumberField_generic):
sage: l.<b> = k.extension(5*x^2 + 3); l
Number Field in b with defining polynomial 5*x^2 + 3 over its base field
sage: l.pari_rnf()
- [x^2 + (-y^3 + 1/2*y^2 - 6*y + 3/2)*x + (-3/4*y^3 - 1/4*y^2 - 17/4*y - 19/4), ..., y^4 + 6*y^2 + 1, x^2 + (-y^3 + 1/2*y^2 - 6*y + 3/2)*x + (-3/4*y^3 - 1/4*y^2 - 17/4*y - 19/4)], [0, 0]]
+ [x^2 + (5/4*y^3 - 1/4*y^2 + 27/4*y - 3/4)*x + (-9/4*y^3 - 1/4*y^2 - 47/4*y - 7/4), ..., y^4 + 6*y^2 + 1, x^2 + (5/4*y^3 - 1/4*y^2 + 27/4*y - 3/4)*x + (-9/4*y^3 - 1/4*y^2 - 47/4*y - 7/4)], [0, 0]]
sage: b
b
sage: l.<b> = k.extension(x^2 + 3/5); l
Number Field in b with defining polynomial x^2 + 3/5 over its base field
sage: l.pari_rnf()
- [x^2 + (-y^3 + 1/2*y^2 - 6*y + 3/2)*x + (-3/4*y^3 - 1/4*y^2 - 17/4*y - 19/4), ..., y^4 + 6*y^2 + 1, x^2 + (-y^3 + 1/2*y^2 - 6*y + 3/2)*x + (-3/4*y^3 - 1/4*y^2 - 17/4*y - 19/4)], [0, 0]]
+ [x^2 + (5/4*y^3 - 1/4*y^2 + 27/4*y - 3/4)*x + (-9/4*y^3 - 1/4*y^2 - 47/4*y - 7/4), ..., y^4 + 6*y^2 + 1, x^2 + (5/4*y^3 - 1/4*y^2 + 27/4*y - 3/4)*x + (-9/4*y^3 - 1/4*y^2 - 47/4*y - 7/4)], [0, 0]]
sage: b
b
sage: l.<b> = k.extension(x - 1/a0); l
Number Field in b with defining polynomial x + 1/2*a0 over its base field
sage: l.pari_rnf()
- [x, [4, -x^3 - x^2 - 7*x - 3, -x^3 + x^2 - 7*x + 3, 2*x^3 + 10*x], ..., [x^4 + 6*x^2 + 1, -x, -1, y^4 + 6*y^2 + 1, x], [0, 0]]
+ [x, [4, -x^3 + x^2 - 7*x + 3, -2*x^3 - 10*x, x^3 + x^2 + 7*x + 3], ..., [x^4 + 6*x^2 + 1, -x, -1, y^4 + 6*y^2 + 1, x], [0, 0]]
sage: b
-1/2*a0
@@ -1635,9 +1635,9 @@ class NumberField_relative(NumberField_generic):
sage: K.<a> = NumberField(x^2 + 1)
sage: L.<b> = K.extension(x^2 - 1/2)
sage: L._pari_relative_structure()
- (x^2 + Mod(-y, y^2 + 1),
- Mod(Mod(1/2*y - 1/2, y^2 + 1)*x, x^2 + Mod(-y, y^2 + 1)),
- Mod(Mod(-y - 1, y^2 + 1)*x, Mod(1, y^2 + 1)*x^2 + Mod(-1/2, y^2 + 1)))
+ (x^2 + Mod(y, y^2 + 1),
+ Mod(Mod(-1/2*y - 1/2, y^2 + 1)*x, x^2 + Mod(y, y^2 + 1)),
+ Mod(Mod(y - 1, y^2 + 1)*x, x^2 + Mod(-1/2, y^2 + 1)))
An example where both fields are defined by non-integral or
non-monic polynomials::
@@ -1937,7 +1937,7 @@ class NumberField_relative(NumberField_generic):
sage: k.relative_polynomial()
x^2 + 1/3
sage: k.pari_relative_polynomial()
- x^2 + Mod(y, y^2 + 1)*x - 1
+ x^2 + Mod(-y, y^2 + 1)*x - 1
"""
return QQ['x'](self._pari_rnfeq()[0])
@@ -2721,7 +2721,7 @@ class NumberField_relative(NumberField_generic):
sage: x = polygen(ZZ, 'x')
sage: K.<a, b> = NumberField([x^2 + 23, x^2 - 3])
sage: P = K.prime_factors(5)[0]; P
- Fractional ideal (5, 1/2*a + b - 5/2)
+ Fractional ideal (5, -1/2*a + b + 5/2)
sage: u = K.uniformizer(P)
sage: u.valuation(P)
1
diff --git a/src/sage/rings/number_field/order.py b/src/sage/rings/number_field/order.py
index e54d2f454af..85fb330d254 100644
--- a/src/sage/rings/number_field/order.py
+++ b/src/sage/rings/number_field/order.py
@@ -495,7 +495,7 @@ class Order(IntegralDomain, sage.rings.abc.Order):
sage: K.<a> = NumberField(x^2 + 2)
sage: R = K.maximal_order()
sage: R.fractional_ideal(2/3 + 7*a, a)
- Fractional ideal (1/3*a)
+ Fractional ideal (-1/3*a)
"""
return self.number_field().fractional_ideal(*args, **kwds)
@@ -569,7 +569,7 @@ class Order(IntegralDomain, sage.rings.abc.Order):
sage: k.<a> = NumberField(x^2 + 5077); G = k.class_group(); G
Class group of order 22 with structure C22 of Number Field in a with defining polynomial x^2 + 5077
sage: G.0 ^ -9
- Fractional ideal class (43, a + 13)
+ Fractional ideal class (67, a + 45)
sage: Ok = k.maximal_order(); Ok
Maximal Order generated by a in Number Field in a with defining polynomial x^2 + 5077
sage: Ok * (11, a + 7)
@@ -2918,7 +2918,7 @@ def GaussianIntegers(names='I', latex_name='i'):
sage: ZZI
Gaussian Integers generated by I in Number Field in I with defining polynomial x^2 + 1 with I = 1*I
sage: factor(3 + I)
- (-I) * (I + 1) * (2*I + 1)
+ (-I) * (I - 2) * (-I + 1)
sage: CC(I)
1.00000000000000*I
sage: I.minpoly()
@@ -2949,7 +2949,7 @@ def EisensteinIntegers(names='omega'):
with defining polynomial x^2 + x + 1
with omega = -0.50000000000000000? + 0.866025403784439?*I
sage: factor(3 + omega)
- (-1) * (-omega - 3)
+ (omega + 1) * (-2*omega + 1)
sage: CC(omega)
-0.500000000000000 + 0.866025403784439*I
sage: omega.minpoly()
diff --git a/src/sage/rings/number_field/selmer_group.py b/src/sage/rings/number_field/selmer_group.py
index acdf2954fdf..7da6b58a209 100644
--- a/src/sage/rings/number_field/selmer_group.py
+++ b/src/sage/rings/number_field/selmer_group.py
@@ -71,7 +71,7 @@ def _ideal_generator(I):
sage: K.<a> = QuadraticField(-11)
sage: [_ideal_generator(K.prime_above(p)) for p in primes(25)]
- [2, 1/2*a - 1/2, -1/2*a - 3/2, 7, -a, 13, 17, 19, 1/2*a + 9/2]
+ [2, 1/2*a - 1/2, -1/2*a - 3/2, 7, a, 13, 17, 19, 1/2*a + 9/2]
"""
try:
return I.gens_reduced()[0]
diff --git a/src/sage/rings/polynomial/polynomial_quotient_ring.py b/src/sage/rings/polynomial/polynomial_quotient_ring.py
index e12977e8464..c5bf39a1c73 100644
--- a/src/sage/rings/polynomial/polynomial_quotient_ring.py
+++ b/src/sage/rings/polynomial/polynomial_quotient_ring.py
@@ -1429,13 +1429,13 @@ class PolynomialQuotientRing_generic(QuotientRing_generic):
sage: R.<x> = K[]
sage: S.<xbar> = R.quotient(x^2 + 23)
sage: S.S_class_group([])
- [((2, -a + 1, 1/2*xbar + 1/2, -1/2*a*xbar + 1/2*a + 1), 6)]
+ [((2, a + 1, -1/2*xbar + 3/2, 1/2*a*xbar - 1/2*a + 1), 6)]
sage: S.S_class_group([K.ideal(3, a-1)])
[]
sage: S.S_class_group([K.ideal(2, a+1)])
[]
sage: S.S_class_group([K.ideal(a)])
- [((2, -a + 1, 1/2*xbar + 1/2, -1/2*a*xbar + 1/2*a + 1), 6)]
+ [((2, a + 1, -1/2*xbar + 3/2, 1/2*a*xbar - 1/2*a + 1), 6)]
Now we take an example over a nontrivial base with two factors, each
contributing to the class group::
@@ -1495,14 +1495,14 @@ class PolynomialQuotientRing_generic(QuotientRing_generic):
sage: C = S.S_class_group([])
sage: C[:2]
[((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),
+ (1/8*a + 1/8)*xbar^2 + 31/8*a + 31/8,
+ -1/16*xbar^3 + 3/16*xbar^2 - 31/16*xbar + 93/16,
+ 1/16*a*xbar^3 + (-1/16*a + 1/8)*xbar^2 + 31/16*a*xbar - 31/16*a + 31/8),
6),
((-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),
+ (-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),
6)]
sage: C[2][1]
2
@@ -1514,11 +1514,11 @@ class PolynomialQuotientRing_generic(QuotientRing_generic):
....: 1/16*a*xbar^3 - 1/16*a*xbar^2 + 23/16*a*xbar - 23/16*a)
sage: gens[0] == expected_gens[0]
True
- sage: gens[1] in (expected_gens[1], expected_gens[1]/2 + expected_gens[0]/2)
+ sage: gens[1] in (expected_gens[1], expected_gens[1]/2 + expected_gens[0]/2, -expected_gens[1]/2 + expected_gens[0]/2)
True
- sage: gens[2] in (expected_gens[2], expected_gens[2] + expected_gens[0]/2)
+ sage: gens[2] in (expected_gens[2], expected_gens[2] + expected_gens[0]/2, -expected_gens[2] + expected_gens[0]/2)
True
- sage: gens[3] in (expected_gens[3], expected_gens[3] + expected_gens[0]/2)
+ sage: gens[3] in (expected_gens[3], expected_gens[3] + expected_gens[0]/2, -expected_gens[3] + expected_gens[0]/2)
True
"""
fields, isos, iso_classes = self._S_decomposition(tuple(S))
@@ -1611,7 +1611,7 @@ class PolynomialQuotientRing_generic(QuotientRing_generic):
sage: R.<x> = K[]
sage: S.<xbar> = R.quotient(x^2 + 23)
sage: S.class_group()
- [((2, -a + 1, 1/2*xbar + 1/2, -1/2*a*xbar + 1/2*a + 1), 6)]
+ [((2, a + 1, -1/2*xbar + 3/2, 1/2*a*xbar - 1/2*a + 1), 6)]
Here is an example of a product of number fields, both of which
contribute to the class group::
@@ -1711,19 +1711,19 @@ class PolynomialQuotientRing_generic(QuotientRing_generic):
with defining polynomial x^2 + 3 with a = 1.732050807568878?*I
with modulus y^3 + 5
sage: [u for u, o in L.S_units([]) if o is Infinity]
- [(-1/3*a - 1)*b^2 - 4/3*a*b - 5/6*a + 7/2,
- 2/3*a*b^2 + (2/3*a - 2)*b - 5/6*a - 7/2]
+ [(-1/3*a - 1)*b^2 - 4/3*a*b - 4/3*a + 3,
+ (-1/3*a - 1)*b^2 + (2/3*a - 2)*b + 13/6*a - 1/2]
sage: [u for u, o in L.S_units([K.ideal(1/2*a - 3/2)])
....: if o is Infinity]
[(-1/6*a - 1/2)*b^2 + (1/3*a - 1)*b + 4/3*a,
- (-1/3*a - 1)*b^2 - 4/3*a*b - 5/6*a + 7/2,
- 2/3*a*b^2 + (2/3*a - 2)*b - 5/6*a - 7/2]
+ (-1/3*a - 1)*b^2 - 4/3*a*b - 4/3*a + 3,
+ (-1/3*a - 1)*b^2 + (2/3*a - 2)*b + 13/6*a - 1/2]
sage: [u for u, o in L.S_units([K.ideal(2)]) if o is Infinity]
[(1/2*a - 1/2)*b^2 + (a + 1)*b + 3,
- (1/6*a + 1/2)*b^2 + (-1/3*a + 1)*b - 5/6*a + 1/2,
(1/6*a + 1/2)*b^2 + (-1/3*a + 1)*b - 5/6*a - 1/2,
- (-1/3*a - 1)*b^2 - 4/3*a*b - 5/6*a + 7/2,
- 2/3*a*b^2 + (2/3*a - 2)*b - 5/6*a - 7/2]
+ 1/3*a*b^2 + (1/3*a + 1)*b - 1/6*a + 3/2,
+ (-1/3*a - 1)*b^2 - 4/3*a*b - 4/3*a + 3,
+ (-1/3*a - 1)*b^2 + (2/3*a - 2)*b + 13/6*a - 1/2]
Note that all the returned values live where we expect them to::
@@ -1808,8 +1808,8 @@ class PolynomialQuotientRing_generic(QuotientRing_generic):
with defining polynomial x^2 + 3 with a = 1.732050807568878?*I
with modulus y^3 + 5
sage: [u for u, o in L.units() if o is Infinity]
- [(-1/3*a - 1)*b^2 - 4/3*a*b - 5/6*a + 7/2,
- 2/3*a*b^2 + (2/3*a - 2)*b - 5/6*a - 7/2]
+ [(-1/3*a - 1)*b^2 - 4/3*a*b - 4/3*a + 3,
+ (-1/3*a - 1)*b^2 + (2/3*a - 2)*b + 13/6*a - 1/2]
sage: L.<b> = K.extension(y^3 + 5)
sage: L.unit_group()
Unit group with structure C6 x Z x Z of
@@ -1817,8 +1817,8 @@ class PolynomialQuotientRing_generic(QuotientRing_generic):
sage: L.unit_group().gens() # abstract generators
(u0, u1, u2)
sage: L.unit_group().gens_values()[1:]
- [(-1/3*a - 1)*b^2 - 4/3*a*b - 5/6*a + 7/2,
- 2/3*a*b^2 + (2/3*a - 2)*b - 5/6*a - 7/2]
+ [(-1/3*a - 1)*b^2 - 4/3*a*b - 4/3*a + 3,
+ (-1/3*a - 1)*b^2 + (2/3*a - 2)*b + 13/6*a - 1/2]
Note that all the returned values live where we expect them to::
diff --git a/src/sage/rings/qqbar.py b/src/sage/rings/qqbar.py
index 47365a9a8c6..7fd8c6f0c05 100644
--- a/src/sage/rings/qqbar.py
+++ b/src/sage/rings/qqbar.py
@@ -2776,11 +2776,12 @@ def number_field_elements_from_algebraics(numbers, minimal=False,
To: Algebraic Real Field
Defn: a |--> 1.732050807568878?)
sage: number_field_elements_from_algebraics((rt2,qqI)) # needs sage.symbolic
- (Number Field in a with defining polynomial y^4 + 1, [-a^3 + a, a^2],
+ (Number Field in a with defining polynomial y^4 + 1,
+ [a^3 - a, a^2],
Ring morphism:
- From: Number Field in a with defining polynomial y^4 + 1
- To: Algebraic Field
- Defn: a |--> 0.7071067811865475? + 0.7071067811865475?*I)
+ From: Number Field in a with defining polynomial y^4 + 1
+ To: Algebraic Field
+ Defn: a |--> -0.7071067811865475? - 0.7071067811865475?*I)
Note that for the first example, where \sage does not realize that
the number is real, we get a homomorphism to ``QQbar``::
@@ -4590,8 +4591,7 @@ class AlgebraicNumber_base(sage.structure.element.FieldElement):
Number Field in a with defining polynomial y^4 - 20*y^2 + 81
with a in -3.789313782671036?
sage: (QQbar(7)^(3/5))._exact_field()
- Number Field in a with defining polynomial
- y^5 - 2*y^4 - 18*y^3 + 38*y^2 + 82*y - 181 with a in 2.554256611698490?
+ Number Field in a with defining polynomial y^5 - 7 with a in 1.475773161594552?
"""
sd = self._descr
if isinstance(sd, (ANRational, ANExtensionElement)):
@@ -4611,7 +4611,7 @@ class AlgebraicNumber_base(sage.structure.element.FieldElement):
sage: (sqrt(QQbar(2)) + sqrt(QQbar(19)))._exact_value()
-1/9*a^3 + a^2 + 11/9*a - 10 where a^4 - 20*a^2 + 81 = 0 and a in -3.789313782671036?
sage: (QQbar(7)^(3/5))._exact_value()
- 2*a^4 + 2*a^3 - 34*a^2 - 17*a + 150 where a^5 - 2*a^4 - 18*a^3 + 38*a^2 + 82*a - 181 = 0 and a in 2.554256611698490?
+ a^3 where a^5 - 7 = 0 and a in 1.475773161594552?
"""
sd = self._descr
if isinstance(sd, (ANRational, ANExtensionElement)):
@@ -7839,8 +7839,8 @@ class ANExtensionElement(ANDescr):
sage: sage_input(v, verify=True)
# Verified
R.<y> = QQ[]
- v = QQbar.polynomial_root(AA.common_polynomial(y^8 - y^7 + y^5 - y^4 + y^3 - y + 1), CIF(RIF(RR(0.91354545764260087), RR(0.91354545764260098)), RIF(RR(0.40673664307580015), RR(0.40673664307580021))))
- v^5 + v^3
+ v = QQbar.polynomial_root(AA.common_polynomial(y^8 - y^7 + y^5 - y^4 + y^3 - y + 1), CIF(RIF(RR(0.66913060635885813), RR(0.66913060635885824)), RIF(-RR(0.74314482547739424), -RR(0.74314482547739413))))
+ v^6 + v^5
sage: v = QQbar(sqrt(AA(2)))
sage: v.exactify()
sage: sage_input(v, verify=True)
diff --git a/src/sage/rings/rational.pyx b/src/sage/rings/rational.pyx
index 272650abeef..0dbe3453dd2 100644
--- a/src/sage/rings/rational.pyx
+++ b/src/sage/rings/rational.pyx
@@ -1446,7 +1446,7 @@ cdef class Rational(sage.structure.element.FieldElement):
sage: 0.is_norm(K)
True
sage: (1/7).is_norm(K, element=True)
- (True, 1/7*beta + 3/7)
+ (True, -3/7*beta + 5/7)
sage: (1/10).is_norm(K, element=True)
(False, None)
sage: (1/691).is_norm(QQ, element=True)
@@ -1558,7 +1558,7 @@ cdef class Rational(sage.structure.element.FieldElement):
EXAMPLES::
sage: QQ(2)._bnfisnorm(QuadraticField(-1, 'i')) # needs sage.rings.number_field
- (i + 1, 1)
+ (-i + 1, 1)
sage: x = polygen(QQ, 'x')
sage: 7._bnfisnorm(NumberField(x^3 - 2, 'b')) # needs sage.rings.number_field
(1, 7)
diff --git a/src/sage/schemes/affine/affine_morphism.py b/src/sage/schemes/affine/affine_morphism.py
index 0eba4c662ec..2208cefca1d 100755
--- a/src/sage/schemes/affine/affine_morphism.py
+++ b/src/sage/schemes/affine/affine_morphism.py
@@ -1158,13 +1158,11 @@ class SchemeMorphism_polynomial_affine_space_field(SchemeMorphism_polynomial_aff
sage: H = End(A)
sage: f = H([QQbar(3^(1/3))*x^2 + QQbar(sqrt(-2))]) # needs sage.symbolic
sage: f.reduce_base_field() # needs sage.symbolic
- Scheme endomorphism of Affine Space of dimension 1 over Number
- Field in a with defining polynomial y^6 + 6*y^4 - 6*y^3 + 12*y^2 + 36*y + 17
- with a = 1.442249570307409? + 1.414213562373095?*I
+ Scheme endomorphism of Affine Space of dimension 1 over Number Field in a with defining polynomial y^6 + 6*y^4 - 6*y^3 + 12*y^2 + 36*y + 17 with a = 1.442249570307409? - 1.414213562373095?*I
Defn: Defined on coordinates by sending (x) to
((-48/269*a^5 + 27/269*a^4 - 320/269*a^3 + 468/269*a^2 - 772/269*a
- - 1092/269)*x^2 + (48/269*a^5 - 27/269*a^4 + 320/269*a^3 - 468/269*a^2
- + 1041/269*a + 1092/269))
+ - 1092/269)*x^2 + (-48/269*a^5 + 27/269*a^4 - 320/269*a^3 + 468/269*a^2
+ - 1041/269*a - 1092/269))
::
diff --git a/src/sage/schemes/elliptic_curves/ell_field.py b/src/sage/schemes/elliptic_curves/ell_field.py
index a63dbf57809..84a719adfbb 100755
--- a/src/sage/schemes/elliptic_curves/ell_field.py
+++ b/src/sage/schemes/elliptic_curves/ell_field.py
@@ -902,7 +902,7 @@ class EllipticCurve_field(ell_generic.EllipticCurve_generic, ProjectivePlaneCurv
by y^2 = x^3 + 5*a0*x^2 + (-200*a0^2)*x + (-42000*a0^2+42000*a0+126000)
over Number Field in a0 with defining polynomial x^3 - 3*x^2 + 3*x + 9
sage: K.<b> = E.division_field(3, simplify_all=True); K
- Number Field in b with defining polynomial x^12 - 25*x^10 + 130*x^8 + 645*x^6 + 1050*x^4 + 675*x^2 + 225
+ Number Field in b with defining polynomial x^12 + 5*x^10 + 40*x^8 + 315*x^6 + 750*x^4 + 675*x^2 + 2025
Some higher-degree examples::
diff --git a/src/sage/schemes/elliptic_curves/ell_local_data.py b/src/sage/schemes/elliptic_curves/ell_local_data.py
index 7434659b5a2..df076ed62b6 100755
--- a/src/sage/schemes/elliptic_curves/ell_local_data.py
+++ b/src/sage/schemes/elliptic_curves/ell_local_data.py
@@ -1161,7 +1161,7 @@ def check_prime(K, P):
sage: check_prime(K, a + 1)
Fractional ideal (a + 1)
sage: [check_prime(K, P) for P in K.primes_above(31)]
- [Fractional ideal (5/2*a + 1/2), Fractional ideal (5/2*a - 1/2)]
+ [Fractional ideal (-5/2*a - 1/2), Fractional ideal (-5/2*a + 1/2)]
sage: L.<b> = NumberField(x^2 + 3)
sage: check_prime(K, L.ideal(5))
Traceback (most recent call last):
diff --git a/src/sage/schemes/elliptic_curves/ell_number_field.py b/src/sage/schemes/elliptic_curves/ell_number_field.py
index 8ccdbcd452d..ffdc95bc92d 100755
--- a/src/sage/schemes/elliptic_curves/ell_number_field.py
+++ b/src/sage/schemes/elliptic_curves/ell_number_field.py
@@ -229,9 +229,9 @@ class EllipticCurve_number_field(EllipticCurve_field):
sage: E == loads(dumps(E))
True
sage: E.simon_two_descent()
- (2, 2, [(0 : 0 : 1), (1/18*a + 7/18 : -5/54*a - 17/54 : 1)])
+ (2, 2, [(0 : 0 : 1), (1/8*a + 5/8 : -3/16*a - 7/16 : 1)])
sage: E.simon_two_descent(lim1=5, lim3=5, limtriv=10, maxprob=7, limbigprime=10)
- (2, 2, [(-1 : 0 : 1), (-2 : -1/2*a - 1/2 : 1)])
+ (2, 2, [(-1 : 0 : 1), (1/2*a - 5/2 : -1/2*a - 13/2 : 1)])
::
@@ -286,7 +286,7 @@ class EllipticCurve_number_field(EllipticCurve_field):
sage: E.simon_two_descent() # long time (4s on sage.math, 2013)
(3,
3,
- [(1/8*zeta43_0^2 - 3/8*zeta43_0 - 1/4 : -5/16*zeta43_0^2 + 7/16*zeta43_0 + 1/8 : 1),
+ [(-1/2*zeta43_0^2 - 1/2*zeta43_0 + 7 : -3/2*zeta43_0^2 - 5/2*zeta43_0 + 18 : 1),
(0 : 0 : 1)])
"""
verbose = int(verbose)
@@ -881,7 +881,7 @@ class EllipticCurve_number_field(EllipticCurve_field):
sage: K.<i> = NumberField(x^2 + 1)
sage: E = EllipticCurve([1 + i, 0, 1, 0, 0])
sage: E.local_data()
- [Local data at Fractional ideal (2*i + 1):
+ [Local data at Fractional ideal (-2*i - 1):
Reduction type: bad non-split multiplicative
Local minimal model: Elliptic Curve defined by y^2 + (i+1)*x*y + y = x^3
over Number Field in i with defining polynomial x^2 + 1
@@ -889,7 +889,7 @@ class EllipticCurve_number_field(EllipticCurve_field):
Conductor exponent: 1
Kodaira Symbol: I1
Tamagawa Number: 1,
- Local data at Fractional ideal (-2*i + 3):
+ Local data at Fractional ideal (3*i + 2):
Reduction type: bad split multiplicative
Local minimal model: Elliptic Curve defined by y^2 + (i+1)*x*y + y = x^3
over Number Field in i with defining polynomial x^2 + 1
@@ -907,7 +907,7 @@ class EllipticCurve_number_field(EllipticCurve_field):
Kodaira Symbol: I0
Tamagawa Number: 1
sage: E.local_data(2*i + 1)
- Local data at Fractional ideal (2*i + 1):
+ Local data at Fractional ideal (-2*i - 1):
Reduction type: bad non-split multiplicative
Local minimal model: Elliptic Curve defined by y^2 + (i+1)*x*y + y = x^3
over Number Field in i with defining polynomial x^2 + 1
@@ -1465,8 +1465,10 @@ class EllipticCurve_number_field(EllipticCurve_field):
sage: K.<a> = NumberField(x^2 - 5)
sage: E = EllipticCurve([20, 225, 750, 625*a + 6875, 31250*a + 46875])
sage: bad_primes = E.discriminant().support(); bad_primes
- [Fractional ideal (-a), Fractional ideal (7/2*a - 81/2),
- Fractional ideal (-a - 52), Fractional ideal (2)]
+ [Fractional ideal (-a),
+ Fractional ideal (-7/2*a + 81/2),
+ Fractional ideal (-a - 52),
+ Fractional ideal (2)]
sage: [E.kodaira_symbol(P) for P in bad_primes]
[I0, I1, I1, II]
sage: K.<a> = QuadraticField(-11)
@@ -1492,7 +1494,7 @@ class EllipticCurve_number_field(EllipticCurve_field):
sage: K.<i> = NumberField(x^2 + 1)
sage: EllipticCurve([i, i - 1, i + 1, 24*i + 15, 14*i + 35]).conductor()
- Fractional ideal (21*i - 3)
+ Fractional ideal (3*i + 21)
sage: K.<a> = NumberField(x^2 - x + 3)
sage: EllipticCurve([1 + a, -1 + a, 1 + a, -11 + a, 5 - 9*a]).conductor()
Fractional ideal (-6*a)
@@ -2593,8 +2595,8 @@ class EllipticCurve_number_field(EllipticCurve_field):
sage: [E1.ainvs() for E1 in C]
[(0, 0, 0, 0, -27),
(0, 0, 0, 0, 1),
- (i + 1, i, i + 1, -i + 3, 4*i),
- (i + 1, i, i + 1, -i + 33, -58*i)]
+ (i + 1, i, 0, 3, -i),
+ (i + 1, i, 0, 33, 91*i)]
The matrix of degrees of cyclic isogenies between curves::
@@ -2625,13 +2627,13 @@ class EllipticCurve_number_field(EllipticCurve_field):
sage: [((i,j), isogs[i][j].x_rational_map())
....: for i in range(4) for j in range(4) if isogs[i][j] != 0]
[((0, 1), (1/9*x^3 - 12)/x^2),
- ((0, 3), (-1/2*i*x^2 + i*x - 12*i)/(x - 3)),
+ ((0, 3), (1/2*i*x^2 - 2*i*x + 15*i)/(x - 3)),
((1, 0), (x^3 + 4)/x^2),
- ((1, 2), (-1/2*i*x^2 - i*x - 2*i)/(x + 1)),
- ((2, 1), (1/2*i*x^2 - x)/(x + 3/2*i)),
- ((2, 3), (x^3 + 4*i*x^2 - 10*x - 10*i)/(x^2 + 4*i*x - 4)),
- ((3, 0), (1/2*i*x^2 + x + 4*i)/(x - 5/2*i)),
- ((3, 2), (1/9*x^3 - 4/3*i*x^2 - 34/3*x + 226/9*i)/(x^2 - 8*i*x - 16))]
+ ((1, 2), (1/2*i*x^2 + i)/(x + 1)),
+ ((2, 1), (-1/2*i*x^2 - 1/2*i)/(x - 1/2*i)),
+ ((2, 3), (x^3 - 2*i*x^2 - 7*x + 4*i)/(x^2 - 2*i*x - 1)),
+ ((3, 0), (-1/2*i*x^2 + 2*x - 5/2*i)/(x + 7/2*i)),
+ ((3, 2), (1/9*x^3 + 2/3*i*x^2 - 13/3*x - 116/9*i)/(x^2 + 10*i*x - 25))]
The isogeny class may be visualized by obtaining its graph and
plotting it::
@@ -3112,10 +3114,10 @@ class EllipticCurve_number_field(EllipticCurve_field):
sage: K.<i> = QuadraticField(-1)
sage: E1 = EllipticCurve([i + 1, 0, 1, -240*i - 400, -2869*i - 2627])
sage: E1.conductor()
- Fractional ideal (-4*i - 7)
+ Fractional ideal (4*i + 7)
sage: E2 = EllipticCurve([1+i,0,1,0,0])
sage: E2.conductor()
- Fractional ideal (-4*i - 7)
+ Fractional ideal (4*i + 7)
sage: E1.is_isogenous(E2) # long time
True
sage: E1.is_isogenous(E2, proof=False) # faster (~170ms)
@@ -3442,8 +3444,8 @@ class EllipticCurve_number_field(EllipticCurve_field):
sage: Q = E(0,-1)
sage: E.lll_reduce([P,Q])
(
- [0 1]
- [(0 : -1 : 1), (-2 : -1/2*a - 1/2 : 1)], [1 0]
+ [ 0 -1]
+ [(0 : -1 : 1), (-2 : 1/2*a - 1/2 : 1)], [ 1 0]
)
::
@@ -3454,9 +3456,10 @@ class EllipticCurve_number_field(EllipticCurve_field):
....: E.point([-17/18*a - 1/9, -109/108*a - 277/108])]
sage: E.lll_reduce(points)
(
- [(-a + 4 : -3*a + 7 : 1), (-17/18*a - 1/9 : 109/108*a + 277/108 : 1)],
- [ 1 0]
- [ 1 -1]
+ [(-a + 4 : -3*a + 7 : 1), (-17/18*a - 1/9 : -109/108*a - 277/108 : 1)],
+ <BLANKLINE>
+ [1 0]
+ [1 1]
)
"""
r = len(points)
diff --git a/src/sage/schemes/elliptic_curves/ell_point.py b/src/sage/schemes/elliptic_curves/ell_point.py
index 0da080ffdbe..34615bb46b8 100755
--- a/src/sage/schemes/elliptic_curves/ell_point.py
+++ b/src/sage/schemes/elliptic_curves/ell_point.py
@@ -142,7 +142,7 @@ lazy_import('sage.schemes.generic.morphism', 'SchemeMorphism')
try:
from sage.libs.pari.all import pari, PariError
- from cypari2.pari_instance import prec_words_to_bits
+ from cypari2.pari_instance import prec_pari_to_bits
except ImportError:
PariError = ()
@@ -2672,10 +2672,10 @@ class EllipticCurvePoint_number_field(EllipticCurvePoint_field):
sage: K.<i> = NumberField(x^2 + 1)
sage: E = EllipticCurve(K, [0,1,0,-160,308])
sage: P = E(26, -120)
- sage: E.discriminant().support()
- [Fractional ideal (i + 1),
- Fractional ideal (-i - 2),
- Fractional ideal (2*i + 1),
+ sage: E.discriminant().support() # random
+ [Fractional ideal (-i - 1),
+ Fractional ideal (2*i - 1),
+ Fractional ideal (-2*i - 1),
Fractional ideal (3)]
sage: [E.tamagawa_exponent(p) for p in E.discriminant().support()]
[1, 4, 4, 4]
@@ -3705,7 +3705,7 @@ class EllipticCurvePoint_number_field(EllipticCurvePoint_field):
E_pari = E_work.pari_curve()
log_pari = E_pari.ellpointtoz(pt_pari, precision=working_prec)
- while prec_words_to_bits(log_pari.precision()) < precision:
+ while prec_pari_to_bits(log_pari.precision()) < precision:
# result is not precise enough, re-compute with double
# precision. if the base field is not QQ, this
# requires modifying the precision of the embedding,
diff --git a/src/sage/schemes/elliptic_curves/ell_rational_field.py b/src/sage/schemes/elliptic_curves/ell_rational_field.py
index 1b7a52b0ed0..466f55960f6 100755
--- a/src/sage/schemes/elliptic_curves/ell_rational_field.py
+++ b/src/sage/schemes/elliptic_curves/ell_rational_field.py
@@ -1844,7 +1844,7 @@ class EllipticCurve_rational_field(EllipticCurve_number_field):
sage: E = EllipticCurve('389a1')
sage: E._known_points = [] # clear cached points
sage: E.simon_two_descent()
- (2, 2, [(5/4 : 5/8 : 1), (-3/4 : 7/8 : 1)])
+ (2, 2, [(-3/4 : 7/8 : 1), (5/4 : 5/8 : 1)])
sage: E = EllipticCurve('5077a1')
sage: E.simon_two_descent()
(3, 3, [(1 : 0 : 1), (2 : 0 : 1), (0 : 2 : 1)])
diff --git a/src/sage/schemes/elliptic_curves/gal_reps_number_field.py b/src/sage/schemes/elliptic_curves/gal_reps_number_field.py
index a4eb66a6df7..8b597e41595 100755
--- a/src/sage/schemes/elliptic_curves/gal_reps_number_field.py
+++ b/src/sage/schemes/elliptic_curves/gal_reps_number_field.py
@@ -800,17 +800,17 @@ def deg_one_primes_iter(K, principal_only=False):
[Fractional ideal (2, a + 1),
Fractional ideal (3, a + 1),
Fractional ideal (3, a + 2),
- Fractional ideal (a),
+ Fractional ideal (-a),
Fractional ideal (7, a + 3),
Fractional ideal (7, a + 4)]
sage: it = deg_one_primes_iter(K, True)
sage: [next(it) for _ in range(6)]
- [Fractional ideal (a),
- Fractional ideal (-2*a + 3),
- Fractional ideal (2*a + 3),
+ [Fractional ideal (-a),
+ Fractional ideal (2*a - 3),
+ Fractional ideal (-2*a - 3),
Fractional ideal (a + 6),
Fractional ideal (a - 6),
- Fractional ideal (-3*a + 4)]
+ Fractional ideal (3*a - 4)]
"""
# imaginary quadratic fields have no principal primes of norm < disc / 4
start = K.discriminant().abs() // 4 if principal_only and K.signature() == (0,1) else 2
diff --git a/src/sage/schemes/elliptic_curves/gp_simon.py b/src/sage/schemes/elliptic_curves/gp_simon.py
index 729380dccf1..d18f753c76c 100644
--- a/src/sage/schemes/elliptic_curves/gp_simon.py
+++ b/src/sage/schemes/elliptic_curves/gp_simon.py
@@ -59,7 +59,7 @@ def simon_two_descent(E, verbose=0, lim1=None, lim3=None, limtriv=None,
sage: import sage.schemes.elliptic_curves.gp_simon
sage: E = EllipticCurve('389a1')
sage: sage.schemes.elliptic_curves.gp_simon.simon_two_descent(E)
- (2, 2, [(5/4 : 5/8 : 1), (-3/4 : 7/8 : 1)])
+ (2, 2, [(-3/4 : 7/8 : 1), (5/4 : 5/8 : 1)])
TESTS::
diff --git a/src/sage/schemes/elliptic_curves/isogeny_class.py b/src/sage/schemes/elliptic_curves/isogeny_class.py
index 13edc68a022..a83fd8705ac 100755
--- a/src/sage/schemes/elliptic_curves/isogeny_class.py
+++ b/src/sage/schemes/elliptic_curves/isogeny_class.py
@@ -223,8 +223,8 @@ class IsogenyClass_EC(SageObject):
sage: C.curves
[Elliptic Curve defined by y^2 = x^3 + (-27) over Number Field in i with defining polynomial x^2 + 1 with i = 1*I,
Elliptic Curve defined by y^2 = x^3 + 1 over Number Field in i with defining polynomial x^2 + 1 with i = 1*I,
- Elliptic Curve defined by y^2 + (i+1)*x*y + (i+1)*y = x^3 + i*x^2 + (-i+3)*x + 4*i over Number Field in i with defining polynomial x^2 + 1 with i = 1*I,
- Elliptic Curve defined by y^2 + (i+1)*x*y + (i+1)*y = x^3 + i*x^2 + (-i+33)*x + (-58*i) over Number Field in i with defining polynomial x^2 + 1 with i = 1*I]
+ Elliptic Curve defined by y^2 + (i+1)*x*y = x^3 + i*x^2 + 3*x + (-i) over Number Field in i with defining polynomial x^2 + 1 with i = 1*I,
+ Elliptic Curve defined by y^2 + (i+1)*x*y = x^3 + i*x^2 + 33*x + 91*i over Number Field in i with defining polynomial x^2 + 1 with i = 1*I]
"""
if self._label:
return "Elliptic curve isogeny class %s" % (self._label)
@@ -615,8 +615,8 @@ class IsogenyClass_EC_NumberField(IsogenyClass_EC):
sage: [E1.ainvs() for E1 in C]
[(0, 0, 0, 0, -27),
(0, 0, 0, 0, 1),
- (i + 1, i, i + 1, -i + 3, 4*i),
- (i + 1, i, i + 1, -i + 33, -58*i)]
+ (i + 1, i, 0, 3, -i),
+ (i + 1, i, 0, 33, 91*i)]
The matrix of degrees of cyclic isogenies between curves::
@@ -647,13 +647,13 @@ class IsogenyClass_EC_NumberField(IsogenyClass_EC):
sage: [((i,j), isogs[i][j].x_rational_map())
....: for i in range(4) for j in range(4) if isogs[i][j] != 0]
[((0, 1), (1/9*x^3 - 12)/x^2),
- ((0, 3), (-1/2*i*x^2 + i*x - 12*i)/(x - 3)),
+ ((0, 3), (1/2*i*x^2 - 2*i*x + 15*i)/(x - 3)),
((1, 0), (x^3 + 4)/x^2),
- ((1, 2), (-1/2*i*x^2 - i*x - 2*i)/(x + 1)),
- ((2, 1), (1/2*i*x^2 - x)/(x + 3/2*i)),
- ((2, 3), (x^3 + 4*i*x^2 - 10*x - 10*i)/(x^2 + 4*i*x - 4)),
- ((3, 0), (1/2*i*x^2 + x + 4*i)/(x - 5/2*i)),
- ((3, 2), (1/9*x^3 - 4/3*i*x^2 - 34/3*x + 226/9*i)/(x^2 - 8*i*x - 16))]
+ ((1, 2), (1/2*i*x^2 + i)/(x + 1)),
+ ((2, 1), (-1/2*i*x^2 - 1/2*i)/(x - 1/2*i)),
+ ((2, 3), (x^3 - 2*i*x^2 - 7*x + 4*i)/(x^2 - 2*i*x - 1)),
+ ((3, 0), (-1/2*i*x^2 + 2*x - 5/2*i)/(x + 7/2*i)),
+ ((3, 2), (1/9*x^3 + 2/3*i*x^2 - 13/3*x - 116/9*i)/(x^2 + 10*i*x - 25))]
sage: K.<i> = QuadraticField(-1)
sage: E = EllipticCurve([1+i, -i, i, 1, 0])
diff --git a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py
index 6a0194fb0f9..90f7382a94e 100755
--- a/src/sage/schemes/elliptic_curves/isogeny_small_degree.py
+++ b/src/sage/schemes/elliptic_curves/isogeny_small_degree.py
@@ -886,15 +886,15 @@ def isogenies_5_0(E, minimal_models=True):
from Elliptic Curve defined by y^2 + y = x^3
over Number Field in a with defining polynomial x^6 - 320*x^3 - 320
to Elliptic Curve defined by
- y^2 + y = x^3 + (241565/32*a^5-362149/48*a^4+180281/24*a^3-9693307/4*a^2+14524871/6*a-7254985/3)*x
- + (1660391123/192*a^5-829315373/96*a^4+77680504/9*a^3-66622345345/24*a^2+33276655441/12*a-24931615912/9)
+ y^2 + y = x^3 + (643/8*a^5-15779/48*a^4-32939/24*a^3-71989/2*a^2+214321/6*a-112115/3)*x
+ + (2901961/96*a^5+4045805/48*a^4+12594215/18*a^3-30029635/6*a^2+15341626/3*a-38944312/9)
over Number Field in a with defining polynomial x^6 - 320*x^3 - 320,
Isogeny of degree 5
from Elliptic Curve defined by y^2 + y = x^3
over Number Field in a with defining polynomial x^6 - 320*x^3 - 320
to Elliptic Curve defined by
- y^2 + y = x^3 + (47519/32*a^5-72103/48*a^4+32939/24*a^3-1909753/4*a^2+2861549/6*a-1429675/3)*x
- + (-131678717/192*a^5+65520419/96*a^4-12594215/18*a^3+5280985135/24*a^2-2637787519/12*a+1976130088/9)
+ y^2 + y = x^3 + (-1109/8*a^5-53873/48*a^4-180281/24*a^3-14491/2*a^2+35899/6*a-43745/3)*x
+ + (-17790679/96*a^5-60439571/48*a^4-77680504/9*a^3+1286245/6*a^2-4961854/3*a-73854632/9)
over Number Field in a with defining polynomial x^6 - 320*x^3 - 320]
"""
F = E.base_field()
diff --git a/src/sage/schemes/plane_conics/con_number_field.py b/src/sage/schemes/plane_conics/con_number_field.py
index e09a1f60262..69fe9960c3d 100755
--- a/src/sage/schemes/plane_conics/con_number_field.py
+++ b/src/sage/schemes/plane_conics/con_number_field.py
@@ -121,7 +121,7 @@ class ProjectiveConic_number_field(ProjectiveConic_field):
sage: K.<i> = QuadraticField(-1)
sage: C = Conic(K, [1, 3, -5])
sage: C.has_rational_point(point=True, obstruction=True)
- (False, Fractional ideal (-i - 2))
+ (False, Fractional ideal (i + 2))
sage: C.has_rational_point(algorithm='rnfisnorm')
False
sage: C.has_rational_point(algorithm='rnfisnorm', obstruction=True,
@@ -135,7 +135,7 @@ class ProjectiveConic_number_field(ProjectiveConic_field):
sage: L.<b> = NumberField(x^3 - 5)
sage: C = Conic(L, [1, 2, -3])
sage: C.has_rational_point(point=True, algorithm='rnfisnorm')
- (True, (5/3 : -1/3 : 1))
+ (True, (-5/3 : 1/3 : 1))
sage: K.<a> = NumberField(x^4+2)
sage: Conic(QQ, [4,5,6]).has_rational_point()
diff --git a/src/sage/schemes/projective/projective_morphism.py b/src/sage/schemes/projective/projective_morphism.py
index 20031e81a41..fcbb0c01e82 100755
--- a/src/sage/schemes/projective/projective_morphism.py
+++ b/src/sage/schemes/projective/projective_morphism.py
@@ -928,7 +928,7 @@ class SchemeMorphism_polynomial_projective_space(SchemeMorphism_polynomial):
Dynamical System of Projective Space of dimension 1 over
Number Field in a with defining polynomial 3*x^2 + 1
Defn: Defined on coordinates by sending (z : w) to
- ((-3/2*a + 1/2)*z^2 + (-3/2*a + 1/2)*w^2 : (-3/2*a - 3/2)*z*w)
+ ((3/2*a + 1/2)*z^2 + (3/2*a + 1/2)*w^2 : (-3/2*a + 3/2)*z*w)
::
@@ -1728,11 +1728,11 @@ class SchemeMorphism_polynomial_projective_space_field(SchemeMorphism_polynomial
sage: f._number_field_from_algebraics() # needs sage.symbolic
Scheme endomorphism of Projective Space of dimension 1 over Number
Field in a with defining polynomial y^6 + 6*y^4 - 6*y^3 + 12*y^2 + 36*y + 17
- with a = 1.442249570307409? + 1.414213562373095?*I
+ with a = 1.442249570307409? - 1.414213562373095?*I
Defn: Defined on coordinates by sending (x : y) to
((-48/269*a^5 + 27/269*a^4 - 320/269*a^3 + 468/269*a^2 - 772/269*a
- - 1092/269)*x^2 + (48/269*a^5 - 27/269*a^4 + 320/269*a^3 - 468/269*a^2
- + 1041/269*a + 1092/269)*y^2 : y^2)
+ - 1092/269)*x^2 + (-48/269*a^5 + 27/269*a^4 - 320/269*a^3 + 468/269*a^2
+ - 1041/269*a - 1092/269)*y^2 : y^2)
::
@@ -1745,12 +1745,12 @@ class SchemeMorphism_polynomial_projective_space_field(SchemeMorphism_polynomial
Scheme morphism:
From: Projective Space of dimension 1 over Number Field in a
with defining polynomial y^4 + 3*y^2 + 1
- with a = 0.?e-113 + 0.618033988749895?*I
+ with a = 0.?e-166 + 1.618033988749895?*I
To: Projective Space of dimension 2 over Number Field in a
with defining polynomial y^4 + 3*y^2 + 1
- with a = 0.?e-113 + 0.618033988749895?*I
+ with a = 0.?e-166 + 1.618033988749895?*I
Defn: Defined on coordinates by sending (x : y) to
- (x^2 + (a^3 + 2*a)*x*y + 3*y^2 : y^2 : (2*a^2 + 3)*x*y)
+ (x^2 + (-a^3 - 2*a)*x*y + 3*y^2 : y^2 : (-2*a^2 - 3)*x*y)
The following was fixed in :issue:`23808`::
diff --git a/src/sage/schemes/projective/projective_point.py b/src/sage/schemes/projective/projective_point.py
index 7f941ec6726..b0f443acb4e 100755
--- a/src/sage/schemes/projective/projective_point.py
+++ b/src/sage/schemes/projective/projective_point.py
@@ -1238,10 +1238,10 @@ class SchemeMorphism_point_projective_field(SchemeMorphism_point_projective_ring
sage: P.<x,y> = ProjectiveSpace(QQbar, 1)
sage: Q = P([-1/2*QQbar(sqrt(2)) + QQbar(I), 1])
sage: S = Q._number_field_from_algebraics(); S
- (1/2*a^3 + a^2 - 1/2*a : 1)
+ (-1/2*a^3 + a^2 + 1/2*a : 1)
sage: S.codomain()
Projective Space of dimension 1 over Number Field in a with defining
- polynomial y^4 + 1 with a = 0.7071067811865475? + 0.7071067811865475?*I
+ polynomial y^4 + 1 with a = -0.7071067811865475? - 0.7071067811865475?*I
The following was fixed in :issue:`23808`::
@@ -1251,7 +1251,7 @@ class SchemeMorphism_point_projective_field(SchemeMorphism_point_projective_ring
sage: Q = P([-1/2*QQbar(sqrt(2)) + QQbar(I), 1]);Q
(-0.7071067811865475? + 1*I : 1)
sage: S = Q._number_field_from_algebraics(); S
- (1/2*a^3 + a^2 - 1/2*a : 1)
+ (-1/2*a^3 + a^2 + 1/2*a : 1)
sage: T = S.change_ring(QQbar) # Used to fail
sage: T
(-0.7071067811865475? + 1.000000000000000?*I : 1)
diff --git a/src/sage/structure/factorization.py b/src/sage/structure/factorization.py
index ab3fa717031..b16822791dc 100644
--- a/src/sage/structure/factorization.py
+++ b/src/sage/structure/factorization.py
@@ -143,17 +143,17 @@ Factorizations can involve fairly abstract mathematical objects::
sage: K.<a> = NumberField(x^2 + 3); K
Number Field in a with defining polynomial x^2 + 3
sage: f = K.factor(15); f
- (Fractional ideal (1/2*a + 3/2))^2 * (Fractional ideal (5))
+ (Fractional ideal (-a))^2 * (Fractional ideal (5))
sage: f.universe()
Monoid of ideals of Number Field in a with defining polynomial x^2 + 3
sage: f.unit()
Fractional ideal (1)
sage: g = K.factor(9); g
- (Fractional ideal (1/2*a + 3/2))^4
+ (Fractional ideal (-a))^4
sage: f.lcm(g)
- (Fractional ideal (1/2*a + 3/2))^4 * (Fractional ideal (5))
+ (Fractional ideal (-a))^4 * (Fractional ideal (5))
sage: f.gcd(g)
- (Fractional ideal (1/2*a + 3/2))^2
+ (Fractional ideal (-a))^2
sage: f.is_integral()
True
|