Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

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

2043

2044

2045

2046

2047

2048

2049

2050

2051

2052

2053

2054

2055

2056

2057

2058

2059

2060

2061

2062

2063

2064

2065

2066

2067

2068

2069

2070

2071

2072

2073

2074

2075

2076

2077

2078

2079

2080

2081

2082

2083

2084

2085

2086

2087

2088

2089

2090

2091

2092

2093

2094

2095

2096

2097

2098

2099

2100

2101

2102

2103

2104

2105

2106

2107

2108

2109

2110

2111

2112

2113

2114

2115

2116

2117

2118

2119

2120

2121

2122

2123

2124

2125

2126

2127

2128

2129

2130

2131

2132

2133

2134

2135

2136

2137

2138

2139

2140

2141

2142

2143

2144

2145

2146

2147

2148

2149

2150

2151

2152

2153

2154

2155

2156

2157

2158

2159

2160

2161

2162

2163

2164

2165

2166

2167

2168

2169

2170

2171

2172

2173

2174

2175

2176

2177

2178

2179

2180

2181

2182

2183

2184

2185

2186

2187

2188

2189

2190

2191

2192

2193

2194

2195

2196

2197

2198

2199

2200

2201

2202

2203

2204

2205

2206

2207

2208

2209

2210

2211

2212

2213

2214

2215

2216

2217

2218

2219

2220

2221

2222

2223

2224

2225

2226

2227

2228

2229

2230

2231

2232

2233

2234

2235

2236

2237

2238

2239

2240

2241

2242

2243

2244

2245

2246

2247

2248

2249

2250

2251

2252

2253

2254

2255

2256

2257

2258

2259

2260

2261

2262

2263

2264

2265

2266

2267

2268

2269

2270

2271

2272

2273

2274

2275

2276

2277

2278

2279

2280

2281

2282

2283

2284

2285

2286

2287

2288

2289

2290

2291

2292

2293

2294

2295

2296

2297

2298

2299

2300

2301

2302

2303

2304

2305

2306

2307

2308

2309

2310

2311

2312

2313

2314

2315

2316

2317

2318

2319

2320

2321

2322

2323

2324

2325

2326

2327

2328

2329

2330

2331

2332

2333

2334

2335

2336

2337

2338

2339

2340

2341

2342

2343

2344

2345

2346

2347

2348

2349

2350

2351

2352

2353

2354

2355

2356

2357

2358

2359

2360

2361

2362

2363

2364

2365

2366

2367

2368

2369

2370

2371

2372

2373

2374

2375

2376

2377

2378

2379

2380

2381

2382

2383

2384

2385

2386

2387

2388

2389

2390

2391

2392

2393

2394

2395

2396

2397

2398

2399

2400

2401

2402

2403

2404

2405

2406

2407

2408

2409

2410

2411

2412

2413

2414

2415

2416

2417

2418

2419

2420

2421

2422

2423

2424

2425

2426

2427

2428

2429

2430

2431

2432

2433

2434

2435

2436

2437

2438

2439

2440

2441

2442

2443

2444

2445

2446

2447

2448

2449

2450

2451

2452

2453

2454

2455

2456

2457

2458

2459

2460

2461

2462

2463

2464

2465

2466

2467

2468

2469

2470

2471

2472

2473

2474

2475

2476

2477

2478

2479

2480

2481

2482

2483

2484

2485

2486

2487

2488

2489

2490

2491

2492

2493

2494

2495

2496

2497

2498

2499

2500

2501

2502

2503

2504

2505

2506

2507

2508

2509

2510

2511

2512

2513

2514

2515

2516

2517

2518

2519

2520

2521

2522

2523

2524

2525

2526

2527

2528

2529

2530

2531

2532

2533

2534

2535

2536

2537

2538

2539

2540

2541

2542

2543

2544

2545

2546

2547

2548

2549

2550

2551

2552

2553

2554

2555

2556

2557

2558

2559

2560

2561

2562

2563

2564

2565

2566

2567

2568

2569

2570

2571

2572

2573

2574

2575

2576

2577

2578

2579

2580

2581

2582

2583

2584

2585

2586

2587

2588

2589

2590

2591

2592

2593

2594

2595

2596

2597

2598

2599

2600

2601

2602

2603

2604

2605

2606

2607

2608

2609

2610

2611

2612

2613

2614

2615

2616

2617

2618

2619

2620

2621

2622

2623

2624

2625

2626

2627

2628

2629

2630

2631

2632

2633

2634

2635

2636

2637

2638

2639

2640

2641

2642

2643

2644

2645

2646

2647

2648

2649

2650

2651

2652

2653

2654

2655

2656

2657

2658

2659

2660

2661

2662

2663

2664

2665

2666

2667

2668

2669

2670

2671

2672

2673

2674

2675

2676

2677

2678

2679

2680

2681

2682

2683

2684

2685

2686

2687

2688

2689

2690

2691

2692

2693

2694

2695

2696

2697

2698

2699

2700

2701

2702

2703

2704

2705

2706

2707

2708

2709

2710

2711

2712

2713

2714

2715

2716

2717

2718

2719

2720

2721

2722

2723

2724

2725

2726

2727

2728

2729

2730

2731

2732

2733

2734

2735

2736

2737

2738

2739

2740

2741

2742

2743

2744

2745

2746

2747

2748

2749

2750

2751

2752

2753

2754

2755

2756

2757

2758

2759

2760

2761

2762

2763

2764

2765

2766

2767

2768

2769

2770

2771

2772

2773

2774

2775

2776

2777

2778

2779

2780

2781

2782

2783

2784

2785

2786

2787

2788

2789

2790

2791

2792

2793

2794

2795

2796

2797

2798

2799

2800

2801

2802

2803

2804

2805

2806

2807

2808

2809

2810

2811

2812

2813

2814

2815

2816

2817

2818

2819

2820

2821

2822

2823

2824

2825

2826

2827

2828

2829

2830

2831

2832

2833

2834

2835

2836

2837

2838

2839

2840

2841

2842

2843

2844

2845

2846

2847

2848

2849

2850

2851

2852

2853

2854

2855

2856

2857

2858

2859

2860

2861

2862

2863

2864

2865

2866

2867

2868

2869

2870

2871

2872

2873

2874

2875

2876

2877

2878

2879

2880

2881

2882

2883

2884

2885

2886

2887

2888

2889

2890

2891

2892

2893

2894

2895

2896

2897

2898

2899

2900

2901

2902

2903

2904

2905

2906

2907

2908

2909

2910

2911

2912

2913

2914

2915

2916

2917

2918

2919

2920

2921

2922

2923

2924

2925

2926

2927

2928

2929

2930

2931

2932

2933

2934

2935

2936

2937

2938

2939

2940

2941

2942

2943

2944

2945

2946

2947

2948

2949

2950

2951

2952

2953

2954

2955

2956

2957

2958

2959

2960

2961

2962

2963

2964

2965

2966

2967

2968

2969

2970

2971

2972

2973

2974

2975

2976

2977

2978

2979

2980

2981

2982

2983

2984

2985

2986

2987

2988

2989

2990

2991

2992

2993

2994

2995

2996

2997

2998

2999

3000

3001

3002

3003

3004

3005

3006

3007

3008

3009

3010

3011

3012

3013

3014

3015

3016

3017

3018

3019

3020

3021

3022

3023

3024

3025

3026

3027

3028

3029

3030

3031

3032

3033

3034

3035

3036

3037

3038

3039

3040

3041

3042

3043

3044

3045

3046

3047

3048

3049

3050

3051

3052

3053

3054

3055

3056

3057

3058

3059

3060

3061

3062

3063

3064

3065

3066

3067

3068

3069

3070

3071

3072

3073

3074

3075

3076

3077

3078

3079

3080

3081

3082

3083

3084

3085

3086

3087

3088

3089

3090

3091

3092

3093

3094

3095

3096

3097

3098

3099

3100

3101

3102

3103

3104

3105

3106

3107

3108

3109

3110

3111

3112

3113

3114

3115

3116

3117

3118

3119

3120

3121

3122

3123

3124

3125

3126

3127

3128

3129

3130

3131

3132

3133

3134

3135

3136

3137

3138

3139

3140

3141

3142

3143

3144

3145

3146

3147

3148

3149

3150

3151

3152

3153

3154

3155

3156

3157

3158

3159

3160

3161

3162

3163

3164

3165

3166

3167

3168

3169

3170

3171

3172

3173

3174

3175

3176

3177

3178

3179

3180

3181

3182

3183

3184

3185

3186

3187

3188

3189

3190

3191

3192

3193

3194

3195

3196

3197

3198

3199

3200

3201

3202

3203

3204

3205

3206

3207

3208

3209

3210

3211

3212

3213

3214

3215

3216

3217

3218

3219

3220

3221

3222

3223

3224

3225

3226

3227

3228

3229

3230

3231

3232

3233

3234

3235

3236

3237

3238

3239

3240

3241

3242

3243

3244

3245

3246

3247

3248

3249

3250

3251

3252

3253

3254

3255

3256

3257

3258

3259

3260

3261

3262

3263

3264

3265

3266

3267

3268

3269

3270

3271

3272

3273

3274

3275

3276

3277

3278

3279

3280

3281

3282

3283

3284

3285

3286

3287

3288

3289

3290

3291

3292

3293

3294

3295

3296

3297

3298

3299

3300

3301

3302

3303

3304

3305

3306

3307

3308

3309

3310

3311

3312

3313

3314

3315

3316

3317

3318

3319

3320

3321

3322

3323

3324

3325

3326

3327

3328

3329

3330

3331

3332

3333

3334

3335

3336

3337

3338

3339

3340

3341

3342

3343

3344

3345

3346

3347

3348

3349

3350

3351

3352

3353

3354

3355

3356

3357

3358

3359

3360

3361

3362

3363

3364

3365

3366

3367

3368

3369

3370

3371

3372

3373

3374

3375

3376

3377

3378

3379

3380

3381

3382

3383

3384

3385

3386

3387

3388

3389

3390

3391

3392

3393

3394

3395

3396

3397

3398

3399

3400

3401

3402

3403

3404

3405

3406

3407

3408

3409

3410

3411

3412

3413

3414

3415

3416

3417

3418

3419

3420

3421

3422

3423

3424

3425

3426

3427

3428

3429

3430

3431

3432

3433

3434

3435

3436

3437

3438

3439

3440

3441

3442

3443

3444

3445

3446

3447

3448

3449

3450

3451

3452

3453

3454

3455

3456

3457

3458

3459

3460

3461

3462

3463

3464

3465

3466

3467

3468

3469

3470

3471

3472

3473

3474

3475

3476

3477

3478

3479

3480

3481

3482

3483

3484

3485

3486

3487

3488

3489

3490

3491

3492

3493

3494

3495

3496

3497

3498

3499

3500

3501

3502

3503

3504

3505

3506

3507

3508

3509

3510

3511

3512

3513

3514

3515

3516

3517

3518

3519

3520

3521

3522

3523

3524

3525

3526

3527

3528

3529

3530

3531

3532

3533

3534

3535

3536

3537

3538

3539

3540

3541

3542

3543

3544

3545

3546

3547

3548

3549

3550

3551

3552

3553

3554

3555

3556

3557

3558

3559

3560

3561

3562

3563

3564

3565

3566

3567

3568

3569

3570

3571

3572

3573

3574

3575

3576

3577

3578

3579

3580

3581

3582

3583

3584

3585

3586

3587

3588

3589

3590

3591

3592

3593

3594

3595

3596

3597

3598

3599

3600

3601

3602

3603

3604

3605

3606

3607

3608

3609

3610

3611

3612

3613

3614

3615

3616

3617

3618

3619

3620

3621

3622

3623

3624

3625

3626

3627

3628

3629

3630

3631

3632

3633

3634

3635

3636

3637

3638

3639

3640

3641

3642

3643

3644

3645

3646

3647

3648

3649

3650

3651

3652

3653

3654

3655

3656

3657

3658

3659

3660

3661

3662

3663

3664

3665

3666

3667

3668

3669

3670

3671

3672

3673

3674

3675

3676

3677

3678

3679

3680

3681

3682

3683

3684

3685

3686

3687

3688

3689

3690

3691

3692

3693

3694

3695

3696

3697

3698

3699

3700

3701

3702

3703

3704

3705

3706

3707

3708

3709

3710

3711

3712

3713

3714

3715

3716

3717

3718

3719

3720

3721

3722

3723

3724

3725

3726

3727

3728

3729

3730

3731

3732

3733

3734

3735

3736

3737

3738

3739

3740

3741

3742

3743

3744

3745

3746

3747

3748

3749

3750

3751

3752

3753

3754

3755

3756

3757

3758

3759

3760

3761

3762

3763

3764

3765

3766

3767

3768

3769

3770

3771

3772

3773

3774

3775

3776

3777

3778

3779

3780

3781

3782

3783

3784

3785

3786

3787

3788

3789

3790

3791

3792

3793

3794

3795

3796

3797

3798

3799

3800

3801

3802

3803

3804

3805

3806

3807

3808

3809

3810

3811

3812

3813

3814

3815

3816

3817

3818

3819

3820

3821

3822

3823

3824

3825

3826

# -*- coding: utf-8 -*- 

r""" 

Elliptic curves over number fields 

 

An elliptic curve `E` over a number field `K` can be given 

by a Weierstrass equation whose coefficients lie in `K` or by 

using ``base_extend`` on an elliptic curve defined over a subfield. 

 

One major difference to elliptic curves over `\QQ` is that there 

might not exist a global minimal equation over `K`, when `K` does 

not have class number one. 

Another difference is the lack of understanding of modularity for 

general elliptic curves over general number fields. 

 

Currently Sage can obtain local information about `E/K_v` for finite places 

`v`, it has an interface to Denis Simon's script for 2-descent, it can compute 

the torsion subgroup of the Mordell-Weil group `E(K)`, and it can work with 

isogenies defined over `K`. 

 

EXAMPLES:: 

 

sage: K.<i> = NumberField(x^2+1) 

sage: E = EllipticCurve([0,4+i]) 

sage: E.discriminant() 

-3456*i - 6480 

sage: P= E([i,2]) 

sage: P+P 

(-2*i + 9/16 : -9/4*i - 101/64 : 1) 

 

:: 

 

sage: E.has_good_reduction(2+i) 

True 

sage: E.local_data(4+i) 

Local data at Fractional ideal (i + 4): 

Reduction type: bad additive 

Local minimal model: Elliptic Curve defined by y^2 = x^3 + (i+4) over Number Field in i with defining polynomial x^2 + 1 

Minimal discriminant valuation: 2 

Conductor exponent: 2 

Kodaira Symbol: II 

Tamagawa Number: 1 

sage: E.tamagawa_product_bsd() 

1 

 

:: 

 

sage: E.simon_two_descent() 

(1, 1, [(i : 2 : 1)]) 

 

:: 

 

sage: E.torsion_order() 

1 

 

:: 

 

sage: E.isogenies_prime_degree(3) 

[Isogeny of degree 3 from Elliptic Curve defined by y^2 = x^3 + (i+4) over Number Field in i with defining polynomial x^2 + 1 to Elliptic Curve defined by y^2 = x^3 + (-27*i-108) over Number Field in i with defining polynomial x^2 + 1] 

 

AUTHORS: 

 

- Robert Bradshaw 2007 

 

- John Cremona 

 

- Chris Wuthrich 

 

REFERENCE: 

 

- [Sil] Silverman, Joseph H. The arithmetic of elliptic curves. Second edition. Graduate Texts in 

Mathematics, 106. Springer, 2009. 

 

- [Sil2] Silverman, Joseph H. Advanced topics in the arithmetic of elliptic curves. Graduate Texts in 

Mathematics, 151. Springer, 1994. 

""" 

from __future__ import absolute_import 

 

#***************************************************************************** 

# Copyright (C) 2007 Robert Bradshaw <robertwb@math.washington.edu> 

# William Stein <wstein@gmail.com> 

# 

# This program is free software: you can redistribute it and/or modify 

# it under the terms of the GNU General Public License as published by 

# the Free Software Foundation, either version 2 of the License, or 

# (at your option) any later version. 

# http://www.gnu.org/licenses/ 

#***************************************************************************** 

 

from .ell_field import EllipticCurve_field 

from .ell_generic import is_EllipticCurve 

from .ell_point import EllipticCurvePoint_number_field 

from .constructor import EllipticCurve 

from sage.rings.all import PolynomialRing, ZZ, QQ, RealField, Integer 

from sage.misc.all import cached_method, verbose, prod, union, flatten 

from six import reraise as raise_ 

 

class EllipticCurve_number_field(EllipticCurve_field): 

r""" 

Elliptic curve over a number field. 

 

EXAMPLES:: 

 

sage: K.<i>=NumberField(x^2+1) 

sage: EllipticCurve([i, i - 1, i + 1, 24*i + 15, 14*i + 35]) 

Elliptic Curve defined by y^2 + i*x*y + (i+1)*y = x^3 + (i-1)*x^2 + (24*i+15)*x + (14*i+35) over Number Field in i with defining polynomial x^2 + 1 

""" 

def __init__(self, K, ainvs): 

r""" 

EXAMPLES: 

 

A curve from the database of curves over `\QQ`, but over a larger field: 

 

sage: K.<i>=NumberField(x^2+1) 

sage: EllipticCurve(K,'389a1') 

Elliptic Curve defined by y^2 + y = x^3 + x^2 + (-2)*x over Number Field in i with defining polynomial x^2 + 1 

 

Making the field of definition explicitly larger:: 

 

sage: EllipticCurve(K,[0,-1,1,0,0]) 

Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 over Number Field in i with defining polynomial x^2 + 1 

 

""" 

self._known_points = [] 

EllipticCurve_field.__init__(self, K, ainvs) 

 

_point = EllipticCurvePoint_number_field 

 

def base_extend(self, R): 

""" 

Return the base extension of ``self`` to `R`. 

 

EXAMPLES:: 

 

sage: E = EllipticCurve('11a3') 

sage: K = QuadraticField(-5, 'a') 

sage: E.base_extend(K) 

Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 over Number Field in a with defining polynomial x^2 + 5 

 

Check that non-torsion points are remembered when extending 

the base field (see :trac:`16034`):: 

 

sage: E = EllipticCurve([1, 0, 1, -1751, -31352]) 

sage: K.<d> = QuadraticField(5) 

sage: E.gens() 

[(52 : 111 : 1)] 

sage: EK = E.base_extend(K) 

sage: EK.gens() 

[(52 : 111 : 1)] 

 

""" 

E = super(EllipticCurve_number_field, self).base_extend(R) 

if isinstance(E, EllipticCurve_number_field): 

E._known_points = [E([R(_) for _ in P.xy()]) for P in self._known_points if not P.is_zero()] 

return E 

 

def simon_two_descent(self, verbose=0, lim1=2, lim3=4, limtriv=2, 

maxprob=20, limbigprime=30, known_points=None): 

r""" 

Return lower and upper bounds on the rank of the Mordell-Weil 

group `E(K)` and a list of points. 

 

This method is used internally by the :meth:`~rank`, 

:meth:`~rank_bounds` and :meth:`~gens` methods. 

 

INPUT: 

 

- ``self`` -- an elliptic curve `E` over a number field `K` 

 

- ``verbose`` -- 0, 1, 2, or 3 (default: 0), the verbosity level 

 

- ``lim1`` -- (default: 2) limit on trivial points on quartics 

 

- ``lim3`` -- (default: 4) limit on points on ELS quartics 

 

- ``limtriv`` -- (default: 2) limit on trivial points on `E` 

 

- ``maxprob`` -- (default: 20) 

 

- ``limbigprime`` -- (default: 30) to distinguish between 

small and large prime numbers. Use probabilistic tests for 

large primes. If 0, don't use probabilistic tests. 

 

- ``known_points`` -- (default: None) list of known points on 

the curve 

 

OUTPUT: a triple ``(lower, upper, list)`` consisting of 

 

- ``lower`` (integer) -- lower bound on the rank 

 

- ``upper`` (integer) -- upper bound on the rank 

 

- ``list`` -- list of points in `E(K)` 

 

The integer ``upper`` is in fact an upper bound on the 

dimension of the 2-Selmer group, hence on the dimension of 

`E(K)/2E(K)`. It is equal to the dimension of the 2-Selmer 

group except possibly if `E(K)[2]` has dimension 1. In that 

case, ``upper`` may exceed the dimension of the 2-Selmer group 

by an even number, due to the fact that the algorithm does not 

perform a second descent. 

 

.. note:: 

 

For non-quadratic number fields, this code does return, but 

it takes a long time. 

 

ALGORITHM: 

 

Uses Denis Simon's PARI/GP scripts from 

http://www.math.unicaen.fr/~simon/. 

 

EXAMPLES:: 

 

sage: K.<a> = NumberField(x^2 + 23, 'a') 

sage: E = EllipticCurve(K, '37') 

sage: E == loads(dumps(E)) 

True 

sage: E.simon_two_descent() 

(2, 2, [(0 : 0 : 1), (1/8*a + 5/8 : -3/16*a - 7/16 : 1)]) 

sage: E.simon_two_descent(lim1=3, lim3=20, limtriv=5, maxprob=7, limbigprime=10) 

(2, 2, [(-1 : 0 : 1), (-1/8*a + 5/8 : -3/16*a - 9/16 : 1)]) 

 

:: 

 

sage: K.<a> = NumberField(x^2 + 7, 'a') 

sage: E = EllipticCurve(K, [0,0,0,1,a]); E 

Elliptic Curve defined by y^2 = x^3 + x + a over Number Field in a with defining polynomial x^2 + 7 

 

sage: v = E.simon_two_descent(verbose=1); v 

elliptic curve: Y^2 = x^3 + Mod(1, y^2 + 7)*x + Mod(y, y^2 + 7) 

Trivial points on the curve = [[1, 1, 0], [Mod(1/2*y + 3/2, y^2 + 7), Mod(-y - 2, y^2 + 7), 1]] 

#S(E/K)[2] = 2 

#E(K)/2E(K) = 2 

#III(E/K)[2] = 1 

rank(E/K) = 1 

listpoints = [[Mod(1/2*y + 3/2, y^2 + 7), Mod(-y - 2, y^2 + 7), 1]] 

(1, 1, [(1/2*a + 3/2 : -a - 2 : 1)]) 

 

sage: v = E.simon_two_descent(verbose=2) 

K = bnfinit(y^2 + 7); 

a = Mod(y,K.pol); 

bnfellrank(K, [0, 0, 0, 1, a], [[Mod(1/2*y + 3/2, y^2 + 7), Mod(-y - 2, y^2 + 7)]]); 

elliptic curve: Y^2 = x^3 + Mod(1, y^2 + 7)*x + Mod(y, y^2 + 7) 

A = Mod(0, y^2 + 7) 

B = Mod(1, y^2 + 7) 

C = Mod(y, y^2 + 7) 

<BLANKLINE> 

Computing L(S,2) 

L(S,2) = [Mod(Mod(-1/2*y + 1/2, y^2 + 7)*x^2 + Mod(-1/2*y - 1/2, y^2 + 7)*x + Mod(-y - 1, y^2 + 7), x^3 + Mod(1, y^2 + 7)*x + Mod(y, y^2 + 7)), Mod(Mod(-1, y^2 + 7)*x^2 + Mod(-1/2*y - 1/2, y^2 + 7)*x + Mod(1, y^2 + 7), x^3 + Mod(1, y^2 + 7)*x + Mod(y, y^2 + 7)), Mod(-1, x^3 + Mod(1, y^2 + 7)*x + Mod(y, y^2 + 7)), Mod(x^2 + 2, x^3 + Mod(1, y^2 + 7)*x + Mod(y, y^2 + 7)), Mod(Mod(1, y^2 + 7)*x + Mod(1/2*y + 3/2, y^2 + 7), x^3 + Mod(1, y^2 + 7)*x + Mod(y, y^2 + 7)), Mod(Mod(1, y^2 + 7)*x + Mod(1/2*y - 3/2, y^2 + 7), x^3 + Mod(1, y^2 + 7)*x + Mod(y, y^2 + 7))] 

<BLANKLINE> 

Computing the Selmer group 

#LS2gen = 2 

LS2gen = [Mod(Mod(-1/2*y + 1/2, y^2 + 7)*x^2 + Mod(-1/2*y - 1/2, y^2 + 7)*x + Mod(-y - 1, y^2 + 7), x^3 + Mod(1, y^2 + 7)*x + Mod(y, y^2 + 7)), Mod(Mod(1, y^2 + 7)*x^2 + Mod(1/2*y + 1/2, y^2 + 7)*x + Mod(-1, y^2 + 7), x^3 + Mod(1, y^2 + 7)*x + Mod(y, y^2 + 7))] 

Search for trivial points on the curve 

Trivial points on the curve = [[Mod(1/2*y + 3/2, y^2 + 7), Mod(-y - 2, y^2 + 7)], [1, 1, 0], [Mod(1/2*y + 3/2, y^2 + 7), Mod(-y - 2, y^2 + 7), 1]] 

zc = Mod(Mod(-1/2*y + 1/2, y^2 + 7)*x^2 + Mod(-1/2*y - 1/2, y^2 + 7)*x + Mod(-y - 1, y^2 + 7), x^3 + Mod(1, y^2 + 7)*x + Mod(y, y^2 + 7)) 

Hilbert symbol (Mod(1, y^2 + 7),Mod(-2*y + 2, y^2 + 7)) = 

sol of quadratic equation = [1, 1, 0]~ 

zc*z1^2 = Mod(Mod(4, y^2 + 7)*x + Mod(-2*y + 6, y^2 + 7), x^3 + Mod(1, y^2 + 7)*x + Mod(y, y^2 + 7)) 

quartic: (-1)*Y^2 = x^4 + (3*y - 9)*x^2 + (-8*y + 16)*x + (9/2*y - 11/2) 

reduced: Y^2 = -x^4 + (-3*y + 9)*x^2 + (-8*y + 16)*x + (-9/2*y + 11/2) 

not ELS at [2, [0, 1]~, 1, 1, [1, -2; 1, 0]] 

zc = Mod(Mod(1, y^2 + 7)*x^2 + Mod(1/2*y + 1/2, y^2 + 7)*x + Mod(-1, y^2 + 7), x^3 + Mod(1, y^2 + 7)*x + Mod(y, y^2 + 7)) 

comes from the trivial point [Mod(1/2*y + 3/2, y^2 + 7), Mod(-y - 2, y^2 + 7)] 

m1 = 1 

m2 = 1 

#S(E/K)[2] = 2 

#E(K)/2E(K) = 2 

#III(E/K)[2] = 1 

rank(E/K) = 1 

listpoints = [[Mod(1/2*y + 3/2, y^2 + 7), Mod(-y - 2, y^2 + 7)]] 

v = [1, 1, [[Mod(1/2*y + 3/2, y^2 + 7), Mod(-y - 2, y^2 + 7)]]] 

sage: v 

(1, 1, [(1/2*a + 3/2 : -a - 2 : 1)]) 

 

A curve with 2-torsion:: 

 

sage: K.<a> = NumberField(x^2 + 7) 

sage: E = EllipticCurve(K, '15a') 

sage: E.simon_two_descent() # long time (3s on sage.math, 2013), points can vary 

(1, 3, [...]) 

 

Check that the bug reported in :trac:`15483` is fixed:: 

 

sage: K.<s> = QuadraticField(229) 

sage: c4 = 2173 - 235*(1 - s)/2 

sage: c6 = -124369 + 15988*(1 - s)/2 

sage: E = EllipticCurve([-c4/48, -c6/864]) 

sage: E.simon_two_descent() 

(0, 0, []) 

 

sage: R.<t> = QQ[] 

sage: L.<g> = NumberField(t^3 - 9*t^2 + 13*t - 4) 

sage: E1 = EllipticCurve(L,[1-g*(g-1),-g^2*(g-1),-g^2*(g-1),0,0]) 

sage: E1.rank() # long time (about 5 s) 

0 

 

sage: K = CyclotomicField(43).subfields(3)[0][0] 

sage: E = EllipticCurve(K, '37') 

sage: E.simon_two_descent() # long time (4s on sage.math, 2013) 

(3, 

3, 

[(0 : 0 : 1), 

(-1/2*zeta43_0^2 - 1/2*zeta43_0 + 7 : -3/2*zeta43_0^2 - 5/2*zeta43_0 + 18 : 1)]) 

""" 

verbose = int(verbose) 

if known_points is None: 

known_points = self._known_points 

known_points = [self(P) for P in known_points] 

 

# We deliberately do not use known_points as a key in the 

# following caching code, so that calling E.gens() a second 

# time (when known_points may have increased) will not cause 

# another execution of simon_two_descent. 

try: 

result = self._simon_two_descent_data[lim1,lim3,limtriv,maxprob,limbigprime] 

if verbose == 0: 

return result 

except AttributeError: 

self._simon_two_descent_data = {} 

except KeyError: 

pass 

 

from .gp_simon import simon_two_descent 

t = simon_two_descent(self, verbose=verbose, 

lim1=lim1, lim3=lim3, limtriv=limtriv, 

maxprob=maxprob, limbigprime=limbigprime, 

known_points=known_points) 

self._simon_two_descent_data[lim1,lim3,limtriv,maxprob,limbigprime] = t 

self._known_points.extend([P for P in t[2] 

if P not in self._known_points]) 

return t 

 

def division_field(self, p, names, map=False, **kwds): 

""" 

Given an elliptic curve over a number field `F` and a prime number `p`, 

construct the field `F(E[p])`. 

 

INPUT: 

 

- ``p`` -- a prime number (an element of `\ZZ`) 

 

- ``names`` -- a variable name for the number field 

 

- ``map`` -- (default: ``False``) also return an embedding of 

the :meth:`base_field` into the resulting field. 

 

- ``kwds`` -- additional keywords passed to 

:func:`sage.rings.number_field.splitting_field.splitting_field`. 

 

OUTPUT: 

 

If ``map`` is ``False``, the division field as an absolute number 

field. If ``map`` is ``True``, a tuple ``(K, phi)`` where ``phi`` 

is an embedding of the base field in the division field ``K``. 

 

.. WARNING:: 

 

This takes a very long time when the degree of the division 

field is large (e.g. when `p` is large or when the Galois 

representation is surjective). The ``simplify`` flag also 

has a big influence on the running time: sometimes 

``simplify=False`` is faster, sometimes ``simplify=True`` 

(the default) is faster. 

 

EXAMPLES: 

 

The 2-division field is the same as the splitting field of 

the 2-division polynomial (therefore, it has degree 1, 2, 3 or 6):: 

 

sage: E = EllipticCurve('15a1') 

sage: K.<b> = E.division_field(2); K 

Number Field in b with defining polynomial x 

sage: E = EllipticCurve('14a1') 

sage: K.<b> = E.division_field(2); K 

Number Field in b with defining polynomial x^2 + 5*x + 92 

sage: E = EllipticCurve('196b1') 

sage: K.<b> = E.division_field(2); K 

Number Field in b with defining polynomial x^3 + x^2 - 114*x - 127 

sage: E = EllipticCurve('19a1') 

sage: K.<b> = E.division_field(2); K 

Number Field in b with defining polynomial x^6 + 10*x^5 + 24*x^4 - 212*x^3 + 1364*x^2 + 24072*x + 104292 

 

For odd primes `p`, the division field is either the splitting 

field of the `p`-division polynomial, or a quadratic extension 

of it. :: 

 

sage: E = EllipticCurve('50a1') 

sage: F.<a> = E.division_polynomial(3).splitting_field(simplify_all=True); F 

Number Field in a with defining polynomial x^6 - 3*x^5 + 4*x^4 - 3*x^3 - 2*x^2 + 3*x + 3 

sage: K.<b> = E.division_field(3, simplify_all=True); K 

Number Field in b with defining polynomial x^6 - 3*x^5 + 4*x^4 - 3*x^3 - 2*x^2 + 3*x + 3 

 

If we take any quadratic twist, the splitting field of the 

3-division polynomial remains the same, but the 3-division field 

becomes a quadratic extension:: 

 

sage: E = E.quadratic_twist(5) # 50b3 

sage: F.<a> = E.division_polynomial(3).splitting_field(simplify_all=True); F 

Number Field in a with defining polynomial x^6 - 3*x^5 + 4*x^4 - 3*x^3 - 2*x^2 + 3*x + 3 

sage: K.<b> = E.division_field(3, simplify_all=True); K 

Number Field in b with defining polynomial x^12 - 3*x^11 + 8*x^10 - 15*x^9 + 30*x^8 - 63*x^7 + 109*x^6 - 144*x^5 + 150*x^4 - 120*x^3 + 68*x^2 - 24*x + 4 

 

Try another quadratic twist, this time over a subfield of `F`:: 

 

sage: G.<c>,_,_ = F.subfields(3)[0] 

sage: E = E.base_extend(G).quadratic_twist(c); E 

Elliptic Curve defined 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 - 10*x^10 + 55*x^8 - 60*x^6 + 75*x^4 + 1350*x^2 + 2025 

 

Some higher-degree examples:: 

 

sage: E = EllipticCurve('11a1') 

sage: K.<b> = E.division_field(2); K 

Number Field in b with defining polynomial x^6 + 2*x^5 - 48*x^4 - 436*x^3 + 1668*x^2 + 28792*x + 73844 

sage: K.<b> = E.division_field(3); K # long time (3s on sage.math, 2014) 

Number Field in b with defining polynomial x^48 ... 

sage: K.<b> = E.division_field(5); K 

Number Field in b with defining polynomial x^4 - x^3 + x^2 - x + 1 

sage: E.division_field(5, 'b', simplify=False) 

Number Field in b with defining polynomial x^4 + x^3 + 11*x^2 + 41*x + 101 

sage: E.base_extend(K).torsion_subgroup() # long time (2s on sage.math, 2014) 

Torsion Subgroup isomorphic to Z/5 + Z/5 associated to the Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) over Number Field in b with defining polynomial x^4 - x^3 + x^2 - x + 1 

 

sage: E = EllipticCurve('27a1') 

sage: K.<b> = E.division_field(3); K 

Number Field in b with defining polynomial x^2 + 3*x + 9 

sage: K.<b> = E.division_field(2); K 

Number Field in b with defining polynomial x^6 + 6*x^5 + 24*x^4 - 52*x^3 - 228*x^2 + 744*x + 3844 

sage: K.<b> = E.division_field(2, simplify_all=True); K 

Number Field in b with defining polynomial x^6 - 3*x^5 + 5*x^3 - 3*x + 1 

sage: K.<b> = E.division_field(5); K # long time (4s on sage.math, 2014) 

Number Field in b with defining polynomial x^48 ... 

sage: K.<b> = E.division_field(7); K # long time (8s on sage.math, 2014) 

Number Field in b with defining polynomial x^72 ... 

 

Over a number field:: 

 

sage: R.<x> = PolynomialRing(QQ) 

sage: K.<i> = NumberField(x^2 + 1) 

sage: E = EllipticCurve([0,0,0,0,i]) 

sage: L.<b> = E.division_field(2); L 

Number Field in b with defining polynomial x^4 - x^2 + 1 

sage: L.<b>, phi = E.division_field(2, map=True); phi 

Ring morphism: 

From: Number Field in i with defining polynomial x^2 + 1 

To: Number Field in b with defining polynomial x^4 - x^2 + 1 

Defn: i |--> -b^3 

sage: L.<b>, phi = E.division_field(3, map=True) 

sage: L 

Number Field in b with defining polynomial x^24 - 6*x^22 - 12*x^21 - 21*x^20 + 216*x^19 + 48*x^18 + 804*x^17 + 1194*x^16 - 13488*x^15 + 21222*x^14 + 44196*x^13 - 47977*x^12 - 102888*x^11 + 173424*x^10 - 172308*x^9 + 302046*x^8 + 252864*x^7 - 931182*x^6 + 180300*x^5 + 879567*x^4 - 415896*x^3 + 1941012*x^2 + 650220*x + 443089 

sage: phi 

Ring morphism: 

From: Number Field in i with defining polynomial x^2 + 1 

To: Number Field in b with defining polynomial x^24 ... 

Defn: i |--> -215621657062634529/183360797284413355040732*b^23 ... 

 

AUTHORS: 

 

- Jeroen Demeyer (2014-01-06): :trac:`11905`, use 

``splitting_field`` method, moved from ``gal_reps.py``, make 

it work over number fields. 

""" 

p = Integer(p) 

if not p.is_prime(): 

raise ValueError("p must be a prime number") 

 

verbose("Adjoining X-coordinates of %s-torsion points"%p) 

F = self.base_ring() 

f = self.division_polynomial(p) 

if p == 2: 

# For p = 2, the division field is the splitting field of 

# the division polynomial. 

return f.splitting_field(names, map=map, **kwds) 

 

# Compute splitting field of X-coordinates. 

# The Galois group of the division field is a subgroup of GL(2,p). 

# The Galois group of the X-coordinates is a subgroup of GL(2,p)/{-1,+1}. 

# We need the map to change the elliptic curve invariants to K. 

deg_mult = F.degree()*p*(p+1)*(p-1)*(p-1)//2 

K, F_to_K = f.splitting_field(names, degree_multiple=deg_mult, map=True, **kwds) 

 

verbose("Adjoining Y-coordinates of %s-torsion points"%p) 

 

# THEOREM (Cremona, http://trac.sagemath.org/ticket/11905#comment:21). 

# Let K be a field, E an elliptic curve over K and p an odd 

# prime number. Assume that K contains all roots of the 

# p-division polynomial of E. Then either K contains all 

# p-torsion points on E, or it doesn't contain any p-torsion 

# point. 

# 

# PROOF. Let G be the absolute Galois group of K (every element 

# in it fixes all elements of K). For any p-torsion point P 

# over the algebraic closure and any sigma in G, we must have 

# either sigma(P) = P or sigma(P) = -P (since K contains the 

# X-coordinate of P). Now assume that K does not contain all 

# p-torsion points. Then there exists a point P1 and a sigma in 

# G such that sigma(P1) = -P1. Now take a different p-torsion 

# point P2. Since sigma(P2) must be P2 or -P2 and 

# sigma(P1+P2) = sigma(P1)+sigma(P2) = sigma(P1)-P2 must 

# be P1+P2 or -(P1+P2), it follows that sigma(P2) = -sigma(P2). 

# Therefore, K cannot contain any p-torsion point. 

# 

# This implies that it suffices to adjoin the Y-coordinate 

# of just one point. 

 

# First factor f over F and then compute a root X of f over K. 

g = f.factor()[0][0] 

X = g.map_coefficients(F_to_K).roots(multiplicities=False)[0] 

 

# Polynomial defining the corresponding Y-coordinate 

a1,a2,a3,a4,a6 = (F_to_K(ai) for ai in self.a_invariants()) 

rhs = X*(X*(X + a2) + a4) + a6 

RK = PolynomialRing(K, 'x') 

ypol = RK([-rhs, a1*X + a3, 1]) 

L = ypol.splitting_field(names, map=map, **kwds) 

if map: 

L, K_to_L = L 

return L, F_to_K.post_compose(K_to_L) 

else: 

return L 

 

def height_pairing_matrix(self, points=None, precision=None): 

r""" 

Returns the height pairing matrix of the given points. 

 

INPUT: 

 

- points -- either a list of points, which must be on this 

curve, or (default) None, in which case self.gens() will be 

used. 

 

- precision -- number of bits of precision of result 

(default: None, for default RealField precision) 

 

EXAMPLES:: 

 

sage: E = EllipticCurve([0, 0, 1, -1, 0]) 

sage: E.height_pairing_matrix() 

[0.0511114082399688] 

 

For rank 0 curves, the result is a valid 0x0 matrix:: 

 

sage: EllipticCurve('11a').height_pairing_matrix() 

[] 

sage: E=EllipticCurve('5077a1') 

sage: E.height_pairing_matrix([E.lift_x(x) for x in [-2,-7/4,1]], precision=100) 

[ 1.3685725053539301120518194471 -1.3095767070865761992624519454 -0.63486715783715592064475542573] 

[ -1.3095767070865761992624519454 2.7173593928122930896610589220 1.0998184305667292139777571432] 

[-0.63486715783715592064475542573 1.0998184305667292139777571432 0.66820516565192793503314205089] 

 

sage: E = EllipticCurve('389a1') 

sage: E = EllipticCurve('389a1') 

sage: P,Q = E.point([-1,1,1]),E.point([0,-1,1]) 

sage: E.height_pairing_matrix([P,Q]) 

[0.686667083305587 0.268478098806726] 

[0.268478098806726 0.327000773651605] 

 

Over a number field:: 

 

sage: x = polygen(QQ) 

sage: K.<t> = NumberField(x^2+47) 

sage: EK = E.base_extend(K) 

sage: EK.height_pairing_matrix([EK(P),EK(Q)]) 

[0.686667083305587 0.268478098806726] 

[0.268478098806726 0.327000773651605] 

 

:: 

 

sage: K.<i> = QuadraticField(-1) 

sage: E = EllipticCurve([0,0,0,i,i]) 

sage: P = E(-9+4*i,-18-25*i) 

sage: Q = E(i,-i) 

sage: E.height_pairing_matrix([P,Q]) 

[ 2.16941934493768 -0.870059380421505] 

[-0.870059380421505 0.424585837470709] 

sage: E.regulator_of_points([P,Q]) 

0.164101403936070 

""" 

if points is None: 

points = self.gens() 

else: 

for P in points: 

assert P.curve() == self 

 

r = len(points) 

if precision is None: 

RR = RealField() 

else: 

RR = RealField(precision) 

from sage.matrix.all import MatrixSpace 

M = MatrixSpace(RR, r) 

mat = M() 

for j in range(r): 

mat[j,j] = points[j].height(precision=precision) 

for j in range(r): 

for k in range(j+1,r): 

mat[j,k]=((points[j]+points[k]).height(precision=precision) - mat[j,j] - mat[k,k])/2 

mat[k,j]=mat[j,k] 

return mat 

 

def regulator_of_points(self, points=[], precision=None): 

""" 

Returns the regulator of the given points on this curve. 

 

INPUT: 

 

- ``points`` -(default: empty list) a list of points on this curve 

 

- ``precision`` - int or None (default: None): the precision 

in bits of the result (default real precision if None) 

 

EXAMPLES:: 

 

sage: E = EllipticCurve('37a1') 

sage: P = E(0,0) 

sage: Q = E(1,0) 

sage: E.regulator_of_points([P,Q]) 

0.000000000000000 

sage: 2*P == Q 

True 

 

:: 

 

sage: E = EllipticCurve('5077a1') 

sage: points = [E.lift_x(x) for x in [-2,-7/4,1]] 

sage: E.regulator_of_points(points) 

0.417143558758384 

sage: E.regulator_of_points(points,precision=100) 

0.41714355875838396981711954462 

 

:: 

 

sage: E = EllipticCurve('389a') 

sage: E.regulator_of_points() 

1.00000000000000 

sage: points = [P,Q] = [E(-1,1),E(0,-1)] 

sage: E.regulator_of_points(points) 

0.152460177943144 

sage: E.regulator_of_points(points, precision=100) 

0.15246017794314375162432475705 

sage: E.regulator_of_points(points, precision=200) 

0.15246017794314375162432475704945582324372707748663081784028 

sage: E.regulator_of_points(points, precision=300) 

0.152460177943143751624324757049455823243727077486630817840280980046053225683562463604114816 

 

Examples over number fields:: 

 

sage: K.<a> = QuadraticField(97) 

sage: E = EllipticCurve(K,[1,1]) 

sage: P = E(0,1) 

sage: P.height() 

0.476223106404866 

sage: E.regulator_of_points([P]) 

0.476223106404866 

 

:: 

 

sage: E = EllipticCurve('11a1') 

sage: x = polygen(QQ) 

sage: K.<t> = NumberField(x^2+47) 

sage: EK = E.base_extend(K) 

sage: T = EK(5,5) 

sage: T.order() 

5 

sage: P = EK(-2, -1/2*t - 1/2) 

sage: P.order() 

+Infinity 

sage: EK.regulator_of_points([P,T]) # random very small output 

-1.23259516440783e-32 

sage: EK.regulator_of_points([P,T]).abs() < 1e-30 

True 

 

:: 

 

sage: E = EllipticCurve('389a1') 

sage: P,Q = E.gens() 

sage: E.regulator_of_points([P,Q]) 

0.152460177943144 

sage: K.<t> = NumberField(x^2+47) 

sage: EK = E.base_extend(K) 

sage: EK.regulator_of_points([EK(P),EK(Q)]) 

0.152460177943144 

 

:: 

 

sage: K.<i> = QuadraticField(-1) 

sage: E = EllipticCurve([0,0,0,i,i]) 

sage: P = E(-9+4*i,-18-25*i) 

sage: Q = E(i,-i) 

sage: E.height_pairing_matrix([P,Q]) 

[ 2.16941934493768 -0.870059380421505] 

[-0.870059380421505 0.424585837470709] 

sage: E.regulator_of_points([P,Q]) 

0.164101403936070 

 

""" 

if points is None: 

points = [] 

mat = self.height_pairing_matrix(points=points, precision=precision) 

return mat.det(algorithm="hessenberg") 

 

 

def is_local_integral_model(self,*P): 

r""" 

Tests if self is integral at the prime ideal `P`, or at all the 

primes if `P` is a list or tuple. 

 

INPUT: 

 

- ``*P`` -- a prime ideal, or a list or tuple of primes. 

 

EXAMPLES:: 

 

sage: K.<i> = NumberField(x^2+1) 

sage: P1,P2 = K.primes_above(5) 

sage: E = EllipticCurve([i/5,i/5,i/5,i/5,i/5]) 

sage: E.is_local_integral_model(P1,P2) 

False 

sage: Emin = E.local_integral_model(P1,P2) 

sage: Emin.is_local_integral_model(P1,P2) 

True 

""" 

if len(P) == 1: 

P = P[0] 

if isinstance(P, (tuple, list)): 

return all(self.is_local_integral_model(x) for x in P) 

return all(x.valuation(P) >= 0 for x in self.ainvs()) 

 

def local_integral_model(self,*P): 

r""" 

Return a model of self which is integral at the prime ideal 

`P`. 

 

.. note:: 

 

The integrality at other primes is not affected, even if 

`P` is non-principal. 

 

INPUT: 

 

- ``*P`` -- a prime ideal, or a list or tuple of primes. 

 

EXAMPLES:: 

 

sage: K.<i> = NumberField(x^2+1) 

sage: P1,P2 = K.primes_above(5) 

sage: E = EllipticCurve([i/5,i/5,i/5,i/5,i/5]) 

sage: E.local_integral_model((P1,P2)) 

Elliptic Curve defined by y^2 + (-i)*x*y + (-25*i)*y = x^3 + 5*i*x^2 + 125*i*x + 3125*i over Number Field in i with defining polynomial x^2 + 1 

""" 

if len(P) == 1: P=P[0] 

if isinstance(P,(tuple,list)): 

E=self 

for Pi in P: E=E.local_integral_model(Pi) 

return E 

ai = self.a_invariants() 

e = min([(ai[i].valuation(P)/[1,2,3,4,6][i]) for i in range(5)]).floor() 

pi = self.base_field().uniformizer(P, 'negative') 

return EllipticCurve([ai[i]/pi**(e*[1,2,3,4,6][i]) for i in range(5)]) 

 

def is_global_integral_model(self): 

r""" 

Return whether ``self`` is integral at all primes. 

 

EXAMPLES:: 

 

sage: K.<i> = NumberField(x^2+1) 

sage: E = EllipticCurve([i/5,i/5,i/5,i/5,i/5]) 

sage: P1,P2 = K.primes_above(5) 

sage: Emin = E.global_integral_model() 

sage: Emin.is_global_integral_model() 

True 

""" 

return all(x.is_integral() for x in self.a_invariants()) 

 

def global_integral_model(self): 

r""" 

Return a model of self which is integral at all primes. 

 

EXAMPLES:: 

 

sage: K.<i> = NumberField(x^2+1) 

sage: E = EllipticCurve([i/5,i/5,i/5,i/5,i/5]) 

sage: P1,P2 = K.primes_above(5) 

sage: E.global_integral_model() 

Elliptic Curve defined by y^2 + (-i)*x*y + (-25*i)*y = x^3 + 5*i*x^2 + 125*i*x + 3125*i over Number Field in i with defining polynomial x^2 + 1 

 

:trac:`7935`:: 

 

sage: K.<a> = NumberField(x^2-38) 

sage: E = EllipticCurve([a,1/2]) 

sage: E.global_integral_model() 

Elliptic Curve defined by y^2 = x^3 + 1444*a*x + 27436 over Number Field in a with defining polynomial x^2 - 38 

 

:trac:`9266`:: 

 

sage: K.<s> = NumberField(x^2-5) 

sage: w = (1+s)/2 

sage: E = EllipticCurve(K,[2,w]) 

sage: E.global_integral_model() 

Elliptic Curve defined by y^2 = x^3 + 2*x + (1/2*s+1/2) over Number Field in s with defining polynomial x^2 - 5 

 

:trac:`12151`:: 

 

sage: K.<v> = NumberField(x^2 + 161*x - 150) 

sage: E = EllipticCurve([25105/216*v - 3839/36, 634768555/7776*v - 98002625/1296, 634768555/7776*v - 98002625/1296, 0, 0]) 

sage: E.global_integral_model() 

Elliptic Curve defined by y^2 + (2094779518028859*v-1940492905300351)*x*y + (477997268472544193101178234454165304071127500*v-442791377441346852919930773849502871958097500)*y = x^3 + (26519784690047674853185542622500*v-24566525306469707225840460652500)*x^2 over Number Field in v with defining polynomial x^2 + 161*x - 150 

 

:trac:`14476`:: 

 

sage: R.<t> = QQ[] 

sage: K.<g> = NumberField(t^4 - t^3 - 3*t^2 - t + 1) 

sage: E = EllipticCurve([ -43/625*g^3 + 14/625*g^2 - 4/625*g + 706/625, -4862/78125*g^3 - 4074/78125*g^2 - 711/78125*g + 10304/78125, -4862/78125*g^3 - 4074/78125*g^2 - 711/78125*g + 10304/78125, 0,0]) 

sage: E.global_integral_model() 

Elliptic Curve defined by y^2 + (15*g^3-48*g-42)*x*y + (-111510*g^3-162162*g^2-44145*g+37638)*y = x^3 + (-954*g^3-1134*g^2+81*g+576)*x^2 over Number Field in g with defining polynomial t^4 - t^3 - 3*t^2 - t + 1 

 

""" 

K = self.base_field() 

ai = self.a_invariants() 

Ps = [[ ff[0] for ff in a.denominator_ideal().factor() ] for a in ai if not a.is_integral() ] 

Ps = union(flatten(Ps)) 

for P in Ps: 

pi = K.uniformizer(P,'positive') 

e = min([(ai[i].valuation(P)/[1,2,3,4,6][i]) for i in range(5)]).floor() 

if e < 0 : 

ai = [ai[i]/pi**(e*[1,2,3,4,6][i]) for i in range(5)] 

if all(a.is_integral() for a in ai): 

break 

for z in ai: 

assert z.is_integral(), "bug in global_integral_model: %s" % list(ai) 

return EllipticCurve(list(ai)) 

 

integral_model = global_integral_model 

 

def _reduce_model(self): 

r""" 

Returns a reduced model for this elliptic curve. 

 

Transforms the elliptic curve to a model which is optimally scaled 

with respect to units and in which `a_1`, `a_2`, `a_3` are 

reduced modulo 2, 3, 2 respectively. 

 

.. note:: 

 

This only works on integral models, i.e. it requires that 

`a_1`, `a_2` and `a_3` lie in the ring of integers of the base 

field. 

 

EXAMPLES:: 

 

sage: K.<a>=NumberField(x^2-38) 

sage: E=EllipticCurve([a, -5*a + 19, -39*a + 237, 368258520200522046806318224*a - 2270097978636731786720858047, 8456608930180227786550494643437985949781*a - 52130038506835491453281450568107193773505]) 

sage: E.ainvs() 

(a, 

-5*a + 19, 

-39*a + 237, 

368258520200522046806318224*a - 2270097978636731786720858047, 

8456608930180227786550494643437985949781*a - 52130038506835491453281450568107193773505) 

sage: E._reduce_model().ainvs() 

(a, 

a + 1, 

a + 1, 

368258520200522046806318444*a - 2270097978636731786720859345, 

8456608930173478039472018047583706316424*a - 52130038506793883217874390501829588391299) 

sage: EllipticCurve([101,202,303,404,505])._reduce_model().ainvs() 

(1, 1, 0, -2509254, 1528863051) 

sage: EllipticCurve([-101,-202,-303,-404,-505])._reduce_model().ainvs() 

(1, -1, 0, -1823195, 947995262) 

 

sage: E = EllipticCurve([a/4, 1]) 

sage: E._reduce_model() 

Traceback (most recent call last): 

... 

TypeError: _reduce_model() requires an integral model. 

""" 

K = self.base_ring() 

ZK = K.maximal_order() 

try: 

(a1, a2, a3, a4, a6) = [ZK(a) for a in self.a_invariants()] 

except TypeError: 

import sys 

raise_(TypeError, "_reduce_model() requires an integral model.", sys.exc_info()[2]) 

 

# N.B. Must define s, r, t in the right order. 

if ZK.absolute_degree() == 1: 

s = ((-a1)/2).round('up') 

r = ((-a2 + s*a1 +s*s)/3).round() 

t = ((-a3 - r*a1)/2).round('up') 

else: 

pariK = K.__pari__() 

s = K(pariK.nfeltdiveuc(-a1, 2)) 

r = K(pariK.nfeltdiveuc(-a2 + s*a1 + s*s, 3)) 

t = K(pariK.nfeltdiveuc(-a3 - r*a1, 2)) 

 

return self.rst_transform(r, s, t) 

 

def _scale_by_units(self): 

r""" Return a model reduced with respect to scaling by units. 

 

OUTPUT: 

 

A model for this elliptic curve, optimally scaled with respect 

to scaling by units, with respect to the logarithmic embedding 

of |c4|^(1/4)+|c6|^(1/6). No scaling by roots of unity is 

carried out, so there is no change when the unit rank is 0. 

 

EXAMPLES:: 

 

sage: K.<a> = NumberField(x^2-10) 

sage: u = K.units()[0] 

sage: E = EllipticCurve([0, 0, 0, 4536*a + 14148, -163728*a - 474336]) 

sage: E1 = E.scale_curve(u^5) 

sage: E1.ainvs() 

(0, 

0, 

0, 

28087920796764302856*a + 88821804456186580548, 

-77225139016967233228487820912*a - 244207331916752959911655344864) 

sage: E1._scale_by_units().ainvs() 

(0, 0, 0, 4536*a + 14148, -163728*a - 474336) 

 

A totally real cubic example:: 

 

sage: K.<a> = NumberField(x^3-x^2-6*x+5) 

sage: E = EllipticCurve([a + 1, a^2 + a - 1, a + 1, 44*a^2 + a - 258, -215*a^2 + 53*a + 1340]) 

sage: u1, u2 = K.units() 

sage: u = u1^2/u2^3 

sage: E1 = E.scale_curve(u) 

sage: E1._scale_by_units().ainvs() == E.ainvs() 

True 

 

A complex quartic example:: 

 

sage: K.<a> = CyclotomicField(5) 

sage: E = EllipticCurve([a + 1, a^2 + a - 1, a + 1, 44*a^2 + a - 258, -215*a^2 + 53*a + 1340]) 

sage: u = K.units()[0] 

sage: E1 = E.scale_curve(u^5) 

sage: E1._scale_by_units().ainvs() == E.ainvs() 

True 

""" 

K = self.base_field() 

r1, r2 = K.signature() 

if r1+r2 == 1: # unit rank is 0 

return self 

 

prec = 1000 # lower precision works badly! 

embs = K.places(prec=prec) 

degs = [1]*r1 + [2]*r2 

fu = K.units() 

from sage.matrix.all import Matrix 

U = Matrix([[e(u).abs().log()*d for d,e in zip(degs,embs)] for u in fu]) 

A = U*U.transpose() 

Ainv = A.inverse() 

 

c4, c6 = self.c_invariants() 

c4s = [e(c4) for e in embs] 

c6s = [e(c6) for e in embs] 

from sage.modules.all import vector 

v = vector([(x4.abs().nth_root(4)+x6.abs().nth_root(6)).log()*d for x4,x6,d in zip(c4s,c6s,degs)]) 

es = [e.round() for e in -Ainv*U*v] 

u = prod([uj**ej for uj,ej in zip(fu,es)]) 

return self.scale_curve(u) 

 

def local_data(self, P=None, proof=None, algorithm="pari", globally=False): 

r""" 

Local data for this elliptic curve at the prime `P`. 

 

INPUT: 

 

- ``P`` -- either None, a prime ideal of the base field of self, or an element of the base field that generates a prime ideal. 

 

- ``proof`` -- whether to only use provably correct methods 

(default controlled by global proof module). Note that the 

proof module is number_field, not elliptic_curves, since the 

functions that actually need the flag are in number fields. 

 

- ``algorithm`` (string, default: "pari") -- Ignored unless the 

base field is `\QQ`. If "pari", use the PARI C-library 

``ellglobalred`` implementation of Tate's algorithm over 

`\QQ`. If "generic", use the general number field 

implementation. 

 

- ``globally`` -- whether the local algorithm uses global generators 

for the prime ideals. Default is False, which won't require any 

information about the class group. If True, a generator for `P` 

will be used if `P` is principal. Otherwise, or if ``globally`` 

is False, the minimal model returned will preserve integrality 

at other primes, but not minimality. 

 

OUTPUT: 

 

If `P` is specified, returns the ``EllipticCurveLocalData`` 

object associated to the prime `P` for this curve. Otherwise, 

returns a list of such objects, one for each prime `P` in the 

support of the discriminant of this model. 

 

.. note:: 

 

The model is not required to be integral on input. 

 

EXAMPLES:: 

 

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): 

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 

Minimal discriminant valuation: 1 

Conductor exponent: 1 

Kodaira Symbol: I1 

Tamagawa Number: 1, 

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 

Minimal discriminant valuation: 2 

Conductor exponent: 1 

Kodaira Symbol: I2 

Tamagawa Number: 2] 

sage: E.local_data(K.ideal(3)) 

Local data at Fractional ideal (3): 

Reduction type: good 

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 

Minimal discriminant valuation: 0 

Conductor exponent: 0 

Kodaira Symbol: I0 

Tamagawa Number: 1 

sage: E.local_data(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 

Minimal discriminant valuation: 1 

Conductor exponent: 1 

Kodaira Symbol: I1 

Tamagawa Number: 1 

 

An example raised in :trac:`3897`:: 

 

sage: E = EllipticCurve([1,1]) 

sage: E.local_data(3) 

Local data at Principal ideal (3) of Integer Ring: 

Reduction type: good 

Local minimal model: Elliptic Curve defined by y^2 = x^3 + x + 1 over Rational Field 

Minimal discriminant valuation: 0 

Conductor exponent: 0 

Kodaira Symbol: I0 

Tamagawa Number: 1 

 

 

""" 

if proof is None: 

import sage.structure.proof.proof 

# We use the "number_field" flag because the actual proof dependence is in PARI's number field functions. 

proof = sage.structure.proof.proof.get_flag(None, "number_field") 

 

if P is None: 

primes = self.base_ring()(self.integral_model().discriminant()).support() 

return [self._get_local_data(pr, proof) for pr in primes] 

 

from sage.schemes.elliptic_curves.ell_local_data import check_prime 

P = check_prime(self.base_field(),P) 

 

return self._get_local_data(P,proof,algorithm,globally) 

 

def _get_local_data(self, P, proof, algorithm="pari", globally=False): 

r""" 

Internal function to create data for this elliptic curve at the prime `P`. 

 

This function handles the caching of local data. It is called 

by local_data() which is the user interface and which parses 

the input parameters `P` and proof. 

 

INPUT: 

 

- ``P`` -- either None or a prime ideal of the base field of self. 

 

- ``proof`` -- whether to only use provably correct methods 

(default controlled by global proof module). Note that the 

proof module is number_field, not elliptic_curves, since the 

functions that actually need the flag are in number fields. 

 

- ``algorithm`` (string, default: "pari") -- Ignored unless the 

base field is `\QQ`. If "pari", use the PARI C-library 

``ellglobalred`` implementation of Tate's algorithm over 

`\QQ`. If "generic", use the general number field 

implementation. 

 

- ``globally`` -- whether the local algorithm uses global generators 

for the prime ideals. Default is False, which won't require any 

information about the class group. If True, a generator for `P` 

will be used if `P` is principal. Otherwise, or if ``globally`` 

is False, the minimal model returned will preserve integrality 

at other primes, but not minimality. 

 

EXAMPLES:: 

 

sage: K.<i> = NumberField(x^2+1) 

sage: E = EllipticCurve(K,[0,1,0,-160,308]) 

sage: p = K.ideal(i+1) 

sage: E._get_local_data(p, False) 

Local data at Fractional ideal (i + 1): 

Reduction type: good 

Local minimal model: Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 + (-10)*x + (-10) over Number Field in i with defining polynomial x^2 + 1 

Minimal discriminant valuation: 0 

Conductor exponent: 0 

Kodaira Symbol: I0 

Tamagawa Number: 1 

 

Verify that we cache based on the proof value and the algorithm choice:: 

 

sage: E._get_local_data(p, False) is E._get_local_data(p, True) 

False 

 

sage: E._get_local_data(p, None, "pari") is E._get_local_data(p, None, "generic") 

False 

""" 

try: 

return self._local_data[P, proof, algorithm, globally] 

except AttributeError: 

self._local_data = {} 

except KeyError: 

pass 

from sage.schemes.elliptic_curves.ell_local_data import EllipticCurveLocalData 

self._local_data[P, proof, algorithm, globally] = EllipticCurveLocalData(self, P, proof, algorithm, globally) 

return self._local_data[P, proof, algorithm, globally] 

 

def local_minimal_model(self, P, proof = None, algorithm="pari"): 

r""" 

Returns a model which is integral at all primes and minimal at `P`. 

 

INPUT: 

 

- ``P`` -- either None or a prime ideal of the base field of self. 

 

- ``proof`` -- whether to only use provably correct methods 

(default controlled by global proof module). Note that the 

proof module is number_field, not elliptic_curves, since the 

functions that actually need the flag are in number fields. 

 

- ``algorithm`` (string, default: "pari") -- Ignored unless the 

base field is `\QQ`. If "pari", use the PARI C-library 

``ellglobalred`` implementation of Tate's algorithm over 

`\QQ`. If "generic", use the general number field 

implementation. 

 

OUTPUT: 

 

A model of the curve which is minimal (and integral) at `P`. 

 

.. note:: 

 

The model is not required to be integral on input. 

 

For principal `P`, a generator is used as a uniformizer, 

and integrality or minimality at other primes is not 

affected. For non-principal `P`, the minimal model 

returned will preserve integrality at other primes, but not 

minimality. 

 

EXAMPLES:: 

 

sage: K.<a>=NumberField(x^2-5) 

sage: E=EllipticCurve([20, 225, 750, 1250*a + 6250, 62500*a + 15625]) 

sage: P=K.ideal(a) 

sage: E.local_minimal_model(P).ainvs() 

(0, 1, 0, 2*a - 34, -4*a + 66) 

""" 

if proof is None: 

import sage.structure.proof.proof 

# We use the "number_field" flag because the actual proof dependence is in PARI's number field functions. 

proof = sage.structure.proof.proof.get_flag(None, "number_field") 

 

return self.local_data(P, proof, algorithm).minimal_model() 

 

def has_good_reduction(self, P): 

r""" 

Return True if this elliptic curve has good reduction at the prime `P`. 

 

INPUT: 

 

- ``P`` -- a prime ideal of the base field of self, or a field 

element generating such an ideal. 

 

OUTPUT: 

 

(bool) -- True if the curve has good reduction at `P`, else False. 

 

.. note:: 

 

This requires determining a local integral minimal model; 

we do not just check that the discriminant of the current 

model has valuation zero. 

 

EXAMPLES:: 

 

sage: E=EllipticCurve('14a1') 

sage: [(p,E.has_good_reduction(p)) for p in prime_range(15)] 

[(2, False), (3, True), (5, True), (7, False), (11, True), (13, True)] 

 

sage: K.<a>=NumberField(x^3-2) 

sage: P17a, P17b = [P for P,e in K.factor(17)] 

sage: E = EllipticCurve([0,0,0,0,2*a+1]) 

sage: [(p,E.has_good_reduction(p)) for p in [P17a,P17b]] 

[(Fractional ideal (4*a^2 - 2*a + 1), True), 

(Fractional ideal (2*a + 1), False)] 

""" 

return self.local_data(P).has_good_reduction() 

 

def has_bad_reduction(self, P): 

r""" 

Return True if this elliptic curve has bad reduction at the prime `P`. 

 

INPUT: 

 

- ``P`` -- a prime ideal of the base field of self, or a field 

element generating such an ideal. 

 

OUTPUT: 

 

(bool) True if the curve has bad reduction at `P`, else False. 

 

.. note:: 

 

This requires determining a local integral minimal model; 

we do not just check that the discriminant of the current 

model has valuation zero. 

 

EXAMPLES:: 

 

sage: E=EllipticCurve('14a1') 

sage: [(p,E.has_bad_reduction(p)) for p in prime_range(15)] 

[(2, True), (3, False), (5, False), (7, True), (11, False), (13, False)] 

 

sage: K.<a>=NumberField(x^3-2) 

sage: P17a, P17b = [P for P,e in K.factor(17)] 

sage: E = EllipticCurve([0,0,0,0,2*a+1]) 

sage: [(p,E.has_bad_reduction(p)) for p in [P17a,P17b]] 

[(Fractional ideal (4*a^2 - 2*a + 1), False), 

(Fractional ideal (2*a + 1), True)] 

""" 

return self.local_data(P).has_bad_reduction() 

 

def has_multiplicative_reduction(self, P): 

r""" 

Return True if this elliptic curve has (bad) multiplicative reduction at the prime `P`. 

 

.. note:: 

 

See also ``has_split_multiplicative_reduction()`` and 

``has_nonsplit_multiplicative_reduction()``. 

 

INPUT: 

 

- ``P`` -- a prime ideal of the base field of self, or a field 

element generating such an ideal. 

 

OUTPUT: 

 

(bool) True if the curve has multiplicative reduction at `P`, 

else False. 

 

EXAMPLES:: 

 

sage: E=EllipticCurve('14a1') 

sage: [(p,E.has_multiplicative_reduction(p)) for p in prime_range(15)] 

[(2, True), (3, False), (5, False), (7, True), (11, False), (13, False)] 

 

sage: K.<a>=NumberField(x^3-2) 

sage: P17a, P17b = [P for P,e in K.factor(17)] 

sage: E = EllipticCurve([0,0,0,0,2*a+1]) 

sage: [(p,E.has_multiplicative_reduction(p)) for p in [P17a,P17b]] 

[(Fractional ideal (4*a^2 - 2*a + 1), False), (Fractional ideal (2*a + 1), False)] 

""" 

return self.local_data(P).has_multiplicative_reduction() 

 

def has_split_multiplicative_reduction(self, P): 

r""" 

Return True if this elliptic curve has (bad) split multiplicative reduction at the prime `P`. 

 

INPUT: 

 

- ``P`` -- a prime ideal of the base field of self, or a field 

element generating such an ideal. 

 

OUTPUT: 

 

(bool) True if the curve has split multiplicative reduction at 

`P`, else False. 

 

EXAMPLES:: 

 

sage: E=EllipticCurve('14a1') 

sage: [(p,E.has_split_multiplicative_reduction(p)) for p in prime_range(15)] 

[(2, False), (3, False), (5, False), (7, True), (11, False), (13, False)] 

 

sage: K.<a>=NumberField(x^3-2) 

sage: P17a, P17b = [P for P,e in K.factor(17)] 

sage: E = EllipticCurve([0,0,0,0,2*a+1]) 

sage: [(p,E.has_split_multiplicative_reduction(p)) for p in [P17a,P17b]] 

[(Fractional ideal (4*a^2 - 2*a + 1), False), (Fractional ideal (2*a + 1), False)] 

""" 

return self.local_data(P).has_split_multiplicative_reduction() 

 

def has_nonsplit_multiplicative_reduction(self, P): 

r""" 

Return True if this elliptic curve has (bad) non-split multiplicative reduction at the prime `P`. 

 

INPUT: 

 

- ``P`` -- a prime ideal of the base field of self, or a field 

element generating such an ideal. 

 

OUTPUT: 

 

(bool) True if the curve has non-split multiplicative 

reduction at `P`, else False. 

 

EXAMPLES:: 

 

sage: E=EllipticCurve('14a1') 

sage: [(p,E.has_nonsplit_multiplicative_reduction(p)) for p in prime_range(15)] 

[(2, True), (3, False), (5, False), (7, False), (11, False), (13, False)] 

 

sage: K.<a>=NumberField(x^3-2) 

sage: P17a, P17b = [P for P,e in K.factor(17)] 

sage: E = EllipticCurve([0,0,0,0,2*a+1]) 

sage: [(p,E.has_nonsplit_multiplicative_reduction(p)) for p in [P17a,P17b]] 

[(Fractional ideal (4*a^2 - 2*a + 1), False), (Fractional ideal (2*a + 1), False)] 

""" 

return self.local_data(P).has_nonsplit_multiplicative_reduction() 

 

def has_additive_reduction(self, P): 

r""" 

Return True if this elliptic curve has (bad) additive reduction at the prime `P`. 

 

INPUT: 

 

- ``P`` -- a prime ideal of the base field of self, or a field 

element generating such an ideal. 

 

OUTPUT: 

 

(bool) True if the curve has additive reduction at `P`, else False. 

 

EXAMPLES:: 

 

sage: E=EllipticCurve('27a1') 

sage: [(p,E.has_additive_reduction(p)) for p in prime_range(15)] 

[(2, False), (3, True), (5, False), (7, False), (11, False), (13, False)] 

 

sage: K.<a>=NumberField(x^3-2) 

sage: P17a, P17b = [P for P,e in K.factor(17)] 

sage: E = EllipticCurve([0,0,0,0,2*a+1]) 

sage: [(p,E.has_additive_reduction(p)) for p in [P17a,P17b]] 

[(Fractional ideal (4*a^2 - 2*a + 1), False), 

(Fractional ideal (2*a + 1), True)] 

""" 

return self.local_data(P).has_additive_reduction() 

 

def tamagawa_number(self, P, proof = None): 

r""" 

Returns the Tamagawa number of this elliptic curve at the prime `P`. 

 

INPUT: 

 

- ``P`` -- either None or a prime ideal of the base field of self. 

 

- ``proof`` -- whether to only use provably correct methods 

(default controlled by global proof module). Note that the 

proof module is number_field, not elliptic_curves, since the 

functions that actually need the flag are in number fields. 

 

OUTPUT: 

 

(positive integer) The Tamagawa number of the curve at `P`. 

 

EXAMPLES:: 

 

sage: K.<a>=NumberField(x^2-5) 

sage: E=EllipticCurve([20, 225, 750, 625*a + 6875, 31250*a + 46875]) 

sage: [E.tamagawa_number(P) for P in E.discriminant().support()] 

[1, 1, 1, 1] 

sage: K.<a> = QuadraticField(-11) 

sage: E = EllipticCurve('11a1').change_ring(K) 

sage: [E.tamagawa_number(P) for P in K(11).support()] 

[10] 

""" 

if proof is None: 

import sage.structure.proof.proof 

# We use the "number_field" flag because the actual proof dependence is in PARI's number field functions. 

proof = sage.structure.proof.proof.get_flag(None, "number_field") 

 

return self.local_data(P, proof).tamagawa_number() 

 

def tamagawa_numbers(self): 

""" 

Return a list of all Tamagawa numbers for all prime divisors of the 

conductor (in order). 

 

EXAMPLES:: 

 

sage: e = EllipticCurve('30a1') 

sage: e.tamagawa_numbers() 

[2, 3, 1] 

sage: vector(e.tamagawa_numbers()) 

(2, 3, 1) 

sage: K.<a>=NumberField(x^2+3) 

sage: eK = e.base_extend(K) 

sage: eK.tamagawa_numbers() 

[4, 6, 1] 

""" 

return [self.tamagawa_number(p) for p in self.conductor().prime_factors()] 

 

def tamagawa_exponent(self, P, proof = None): 

r""" 

Returns the Tamagawa index of this elliptic curve at the prime `P`. 

 

INPUT: 

 

- ``P`` -- either None or a prime ideal of the base field of self. 

 

- ``proof`` -- whether to only use provably correct methods 

(default controlled by global proof module). Note that the 

proof module is number_field, not elliptic_curves, since the 

functions that actually need the flag are in number fields. 

 

OUTPUT: 

 

(positive integer) The Tamagawa index of the curve at P. 

 

EXAMPLES:: 

 

sage: K.<a>=NumberField(x^2-5) 

sage: E=EllipticCurve([20, 225, 750, 625*a + 6875, 31250*a + 46875]) 

sage: [E.tamagawa_exponent(P) for P in E.discriminant().support()] 

[1, 1, 1, 1] 

sage: K.<a> = QuadraticField(-11) 

sage: E = EllipticCurve('11a1').change_ring(K) 

sage: [E.tamagawa_exponent(P) for P in K(11).support()] 

[10] 

""" 

if proof is None: 

import sage.structure.proof.proof 

# We use the "number_field" flag because the actual proof dependence is in PARI's number field functions. 

proof = sage.structure.proof.proof.get_flag(None, "number_field") 

 

return self.local_data(P, proof).tamagawa_exponent() 

 

def tamagawa_product_bsd(self): 

r""" 

Given an elliptic curve `E` over a number field `K`, this function returns the 

integer `C(E/K)` that appears in the Birch and Swinnerton-Dyer conjecture accounting 

for the local information at finite places. If the model is a global minimal model then `C(E/K)` is 

simply the product of the Tamagawa numbers `c_v` where `v` runs over all prime ideals of `K`. Otherwise, if the model has to be changed at a place `v` a correction factor appears. 

The definition is such that `C(E/K)` times the periods at the infinite places is invariant 

under change of the Weierstrass model. See [Tate1966]_ and [DD2010]_ for details. 

 

.. note:: 

 

This definition is slightly different from the definition of ``tamagawa_product`` 

for curves defined over `\QQ`. Over the rational number it is always defined to be the product 

of the Tamagawa numbers, so the two definitions only agree when the model is global minimal. 

 

OUTPUT: 

 

A rational number 

 

EXAMPLES:: 

 

sage: K.<i> = NumberField(x^2+1) 

sage: E = EllipticCurve([0,2+i]) 

sage: E.tamagawa_product_bsd() 

1 

 

sage: E = EllipticCurve([(2*i+1)^2,i*(2*i+1)^7]) 

sage: E.tamagawa_product_bsd() 

4 

 

An example where the Neron model changes over K:: 

 

sage: K.<t> = NumberField(x^5-10*x^3+5*x^2+10*x+1) 

sage: E = EllipticCurve(K,'75a1') 

sage: E.tamagawa_product_bsd() 

5 

sage: da = E.local_data() 

sage: [dav.tamagawa_number() for dav in da] 

[1, 1] 

 

An example over `\QQ` (:trac:`9413`):: 

 

sage: E = EllipticCurve('30a') 

sage: E.tamagawa_product_bsd() 

6 

""" 

da = self.local_data() 

pr = 1 

for dav in da: 

pp = dav.prime() 

cv = dav.tamagawa_number() 

# uu is the quotient of the Neron differential at pp divided by 

# the differential associated to this particular equation E 

uu = self.isomorphism_to(dav.minimal_model()).u 

if self.base_field().absolute_degree() == 1: 

p = pp.gens_reduced()[0] 

f = 1 

v = ZZ(uu).valuation(p) 

else: 

p = pp.smallest_integer() 

f = pp.residue_class_degree() 

v = uu.valuation(pp) 

uu_abs_val = p**(f*v) 

pr *= cv * uu_abs_val 

return pr 

 

def kodaira_symbol(self, P, proof = None): 

r""" 

Returns the Kodaira Symbol of this elliptic curve at the prime `P`. 

 

INPUT: 

 

- ``P`` -- either None or a prime ideal of the base field of self. 

 

- ``proof`` -- whether to only use provably correct methods 

(default controlled by global proof module). Note that the 

proof module is number_field, not elliptic_curves, since the 

functions that actually need the flag are in number fields. 

 

OUTPUT: 

 

The Kodaira Symbol of the curve at P, represented as a string. 

 

EXAMPLES:: 

 

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)] 

sage: [E.kodaira_symbol(P) for P in bad_primes] 

[I0, I1, I1, II] 

sage: K.<a> = QuadraticField(-11) 

sage: E = EllipticCurve('11a1').change_ring(K) 

sage: [E.kodaira_symbol(P) for P in K(11).support()] 

[I10] 

""" 

if proof is None: 

import sage.structure.proof.proof 

# We use the "number_field" flag because the actual proof dependence is in PARI's number field functions. 

proof = sage.structure.proof.proof.get_flag(None, "number_field") 

 

return self.local_data(P, proof).kodaira_symbol() 

 

 

def conductor(self): 

r""" 

Returns the conductor of this elliptic curve as a fractional 

ideal of the base field. 

 

OUTPUT: 

 

(fractional ideal) The conductor of the curve. 

 

EXAMPLES:: 

 

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) 

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) 

 

A not so well known curve with everywhere good reduction:: 

 

sage: K.<a>=NumberField(x^2-38) 

sage: E=EllipticCurve([0,0,0, 21796814856932765568243810*a - 134364590724198567128296995, 121774567239345229314269094644186997594*a - 750668847495706904791115375024037711300]) 

sage: E.conductor() 

Fractional ideal (1) 

 

An example which used to fail (see :trac:`5307`):: 

 

sage: K.<w>=NumberField(x^2+x+6) 

sage: E=EllipticCurve([w,-1,0,-w-6,0]) 

sage: E.conductor() 

Fractional ideal (86304, w + 5898) 

 

An example raised in :trac:`11346`:: 

 

sage: K.<g> = NumberField(x^2 - x - 1) 

sage: E1 = EllipticCurve(K,[0,0,0,-1/48,-161/864]) 

sage: [(p.smallest_integer(),e) for p,e in E1.conductor().factor()] 

[(2, 4), (3, 1), (5, 1)] 

""" 

try: 

return self._conductor 

except AttributeError: 

pass 

 

# Note: for number fields other than QQ we could initialize 

# N=K.ideal(1) or N=OK.ideal(1), which are the same, but for 

# K == QQ it has to be ZZ.ideal(1). 

OK = self.base_ring().ring_of_integers() 

self._conductor = prod([d.prime()**(d.conductor_valuation()) \ 

for d in self.local_data()],\ 

OK.ideal(1)) 

return self._conductor 

 

def minimal_discriminant_ideal(self): 

r""" 

Return the minimal discriminant ideal of this elliptic curve. 

 

OUTPUT: 

 

The integral ideal `D` whose valuation at every prime `P` is 

that of the local minimal model for `E` at `P`. If `E` has a 

global minimal model, this will be the principal ideal 

generated by the discriminant of any such model, but otherwise 

it can be a proper divisor of the discriminant of any model. 

 

EXAMPLES:: 

 

sage: K.<a> = NumberField(x^2-x-57) 

sage: K.class_number() 

3 

sage: E = EllipticCurve([a,-a,a,-5692-820*a,-259213-36720*a]) 

sage: K.ideal(E.discriminant()) 

Fractional ideal (90118662980*a + 636812084644) 

sage: K.ideal(E.discriminant()).factor() 

(Fractional ideal (2))^2 * (Fractional ideal (3, a + 2))^12 

 

Here the minimal discriminant ideal is principal but there is 

no global minimal model since the quotient is the 12th power 

of a non-principal ideal:: 

 

sage: E.minimal_discriminant_ideal() 

Fractional ideal (4) 

sage: E.minimal_discriminant_ideal().factor() 

(Fractional ideal (2))^2 

 

If (and only if) the curve has everywhere good reduction the 

result is the unit ideal:: 

 

sage: K.<a> = NumberField(x^2-26) 

sage: E = EllipticCurve([a,a-1,a+1,4*a+10,2*a+6]) 

sage: E.conductor() 

Fractional ideal (1) 

sage: E.discriminant() 

-104030*a - 530451 

sage: E.minimal_discriminant_ideal() 

Fractional ideal (1) 

 

Over `\QQ`, the result returned is an ideal of `\ZZ` rather 

than a fractional ideal of `\QQ`:: 

 

sage: E = EllipticCurve([1,2,3,4,5]) 

sage: E.minimal_discriminant_ideal() 

Principal ideal (10351) of Integer Ring 

""" 

dat = self.local_data() 

# we treat separately the case where there are no bad primes, 

# which cannot happen over QQ, since ideals of QQ behave 

# differently to (fractional) ideals of other number fields. 

if len(dat) == 0: 

return self.base_field().ideal(1) 

return prod([d.prime()**d.discriminant_valuation() for d in dat]) 

 

def non_minimal_primes(self): 

r""" 

Returns a list of primes at which this elliptic curve is not minimal. 

 

OUTPUT: 

 

A list of prime ideals (or prime numbers when the base field 

is `\QQ`, empty if this is a global minimal model. 

 

EXAMPLES:: 

 

sage: K.<a> = NumberField(x^2-10) 

sage: E = EllipticCurve([0, 0, 0, -22500, 750000*a]) 

sage: E.non_minimal_primes() 

[Fractional ideal (2, a), Fractional ideal (5, a)] 

sage: K.ideal(E.discriminant()).factor() 

(Fractional ideal (2, a))^24 * (Fractional ideal (3, a + 1))^5 * (Fractional ideal (3, a + 2))^5 * (Fractional ideal (5, a))^24 * (Fractional ideal (7)) 

sage: E.minimal_discriminant_ideal().factor() 

(Fractional ideal (2, a))^12 * (Fractional ideal (3, a + 1))^5 * (Fractional ideal (3, a + 2))^5 * (Fractional ideal (7)) 

 

Over `\QQ`, the primes returned are integers, not ideals:: 

 

sage: E = EllipticCurve([0,0,0,-3024,46224]) 

sage: E.non_minimal_primes() 

[2, 3] 

sage: Emin = E.global_minimal_model() 

sage: Emin.non_minimal_primes() 

[] 

 

If the model is not globally integral, a ``ValueError`` is 

raised:: 

 

sage: E = EllipticCurve([0,0,0,1/2,1/3]) 

sage: E.non_minimal_primes() 

Traceback (most recent call last): 

... 

ValueError: non_minimal_primes only defined for integral models 

""" 

if not self.is_global_integral_model(): 

raise ValueError("non_minimal_primes only defined for integral models") 

dat = self.local_data() 

D = self.discriminant() 

primes = [d.prime() for d in dat] 

if self.base_field() is QQ: 

primes = [P.gen() for P in primes] 

vals = [d.discriminant_valuation() for d in dat] 

return [P for P,v in zip(primes,vals) if D.valuation(P) > v] 

 

def is_global_minimal_model(self): 

r""" 

Returns whether this elliptic curve is a global minimal model. 

 

OUTPUT: 

 

Boolean, False if E is not integral, or if E is non-minimal at 

some prime, else True. 

 

EXAMPLES:: 

 

sage: K.<a> = NumberField(x^2-10) 

sage: E = EllipticCurve([0, 0, 0, -22500, 750000*a]) 

sage: E.is_global_minimal_model() 

False 

sage: E.non_minimal_primes() 

[Fractional ideal (2, a), Fractional ideal (5, a)] 

 

sage: E = EllipticCurve([0,0,0,-3024,46224]) 

sage: E.is_global_minimal_model() 

False 

sage: E.non_minimal_primes() 

[2, 3] 

sage: Emin = E.global_minimal_model() 

sage: Emin.is_global_minimal_model() 

True 

 

A necessary condition to be a global minimal model is that the 

model must be globally integral:: 

 

sage: E = EllipticCurve([0,0,0,1/2,1/3]) 

sage: E.is_global_minimal_model() 

False 

sage: Emin.is_global_minimal_model() 

True 

sage: Emin.ainvs() 

(0, 1, 1, -2, 0) 

""" 

if not self.is_global_integral_model(): 

return False 

return self.non_minimal_primes() == [] 

 

def global_minimality_class(self): 

r""" 

Returns the obstruction to this curve having a global minimal model. 

 

OUTPUT: 

 

An ideal class of the base number field, which is trivial if 

and only if the elliptic curve has a global minimal model, and 

which can be used to find global and semi-global minimal 

models. 

 

EXAMPLES: 

 

A curve defined over a field of class number 2 with no global 

minimal model was a nontrivial minimality class:: 

 

sage: K.<a> = NumberField(x^2-10) 

sage: K.class_number() 

2 

sage: E = EllipticCurve([0, 0, 0, -22500, 750000*a]) 

sage: E.global_minimality_class() 

Fractional ideal class (10, 5*a) 

sage: E.global_minimality_class().order() 

2 

 

Over the same field, a curve defined by a non-minimal model 

has trivial class, showing that a global minimal model does 

exist:: 

 

sage: K.<a> = NumberField(x^2-10) 

sage: E = EllipticCurve([0,0,0,4536*a+14148,-163728*a- 474336]) 

sage: E.is_global_minimal_model() 

False 

sage: E.global_minimality_class() 

Trivial principal fractional ideal class 

 

Over a field of class number 1 the result is always the 

trivial class:: 

 

sage: K.<a> = NumberField(x^2-5) 

sage: E = EllipticCurve([0, 0, 0, K(16), K(64)]) 

sage: E.global_minimality_class() 

Trivial principal fractional ideal class 

 

sage: E = EllipticCurve([0, 0, 0, 16, 64]) 

sage: E.base_field() 

Rational Field 

sage: E.global_minimality_class() 

1 

""" 

K = self.base_field() 

Cl = K.class_group() 

if K.class_number() == 1: 

return Cl(1) 

D = self.discriminant() 

dat = self.local_data() 

primes = [d.prime() for d in dat] 

vals = [d.discriminant_valuation() for d in dat] 

I = prod([P**((D.valuation(P)-v)//12) for P,v in zip(primes,vals)], 

K.ideal(1)) 

return Cl(I) 

 

def has_global_minimal_model(self): 

r""" 

Returns whether this elliptic curve has a global minimal model. 

 

OUTPUT: 

 

Boolean, True iff a global minimal model exists, i.e. an 

integral model which is minimal at every prime. 

 

EXAMPLES:: 

 

sage: K.<a> = NumberField(x^2-10) 

sage: E = EllipticCurve([0,0,0,4536*a+14148,-163728*a-474336]) 

sage: E.is_global_minimal_model() 

False 

sage: E.has_global_minimal_model() 

True 

""" 

return self.global_minimality_class().is_one() 

 

def global_minimal_model(self, proof = None, semi_global=False): 

r""" 

Returns a model of self that is integral, and minimal. 

 

.. note:: 

 

Over fields of class number greater than 1, a global 

minimal model may not exist. If it does not, set the 

parameter ``semi_global`` to ``True`` to obtain a model 

minimal at all but one prime. 

 

INPUT: 

 

- ``proof`` -- whether to only use provably correct methods 

(default controlled by global proof module). Note that the 

proof module is number_field, not elliptic_curves, since the 

functions that actually need the flag are in number fields. 

 

- ``semi_global`` (boolean, default False) -- if there is no 

global minimal mode, return a semi-global minimal model 

(minimal at all but one prime) instead, if True; raise an 

error if False. No effect if a global minimal model exists. 

 

OUTPUT: 

 

A global integral and minimal model, or an integral model 

minimal at all but one prime of there is no global minimal 

model and the flag ``semi_global`` is True. 

 

EXAMPLES:: 

 

sage: K.<a> = NumberField(x^2-38) 

sage: E = EllipticCurve([0,0,0, 21796814856932765568243810*a - 134364590724198567128296995, 121774567239345229314269094644186997594*a - 750668847495706904791115375024037711300]) 

sage: E2 = E.global_minimal_model() 

sage: E2 

Elliptic Curve defined by y^2 + a*x*y + (a+1)*y = x^3 + (a+1)*x^2 + (4*a+15)*x + (4*a+21) over Number Field in a with defining polynomial x^2 - 38 

sage: E2.local_data() 

[] 

 

See :trac:`11347`:: 

 

sage: K.<g> = NumberField(x^2 - x - 1) 

sage: E = EllipticCurve(K,[0,0,0,-1/48,161/864]).integral_model().global_minimal_model(); E 

Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 over Number Field in g with defining polynomial x^2 - x - 1 

sage: [(p.norm(), e) for p, e in E.conductor().factor()] 

[(9, 1), (5, 1)] 

sage: [(p.norm(), e) for p, e in E.discriminant().factor()] 

[(-5, 2), (9, 1)] 

 

See :trac:`14472`, this used not to work over a relative extension:: 

 

sage: K1.<w> = NumberField(x^2+x+1) 

sage: m = polygen(K1) 

sage: K2.<v> = K1.extension(m^2-w+1) 

sage: E = EllipticCurve([0*v,-432]) 

sage: E.global_minimal_model() 

Elliptic Curve defined by y^2 + y = x^3 over Number Field in v with defining polynomial x^2 - w + 1 over its base field 

 

See :trac:`18662`: for fields of class number greater than 1, 

even when global minimal models did exist, their computation 

was not implemented. Now it is:: 

 

sage: K.<a> = NumberField(x^2-10) 

sage: K.class_number() 

2 

sage: E = EllipticCurve([0,0,0,-186408*a - 589491, 78055704*a + 246833838]) 

sage: E.discriminant().norm() 

16375845905239507992576 

sage: E.discriminant().norm().factor() 

2^31 * 3^27 

sage: E.has_global_minimal_model() 

True 

sage: Emin = E.global_minimal_model(); Emin 

Elliptic Curve defined by y^2 + (a+1)*x*y + (a+1)*y = x^3 + (-a)*x^2 + (a-12)*x + (-2*a+2) over Number Field in a with defining polynomial x^2 - 10 

sage: Emin.discriminant().norm() 

3456 

sage: Emin.discriminant().norm().factor() 

2^7 * 3^3 

 

If there is no global minimal model, this method will raise an 

error unless you set the parameter ``semi_global`` to ``True``:: 

 

sage: K.<a> = NumberField(x^2-10) 

sage: K.class_number() 

2 

sage: E = EllipticCurve([a,a,0,3*a+8,4*a+3]) 

sage: E.has_global_minimal_model() 

False 

sage: E.global_minimal_model() 

Traceback (most recent call last): 

... 

ValueError: Elliptic Curve defined by y^2 + a*x*y = x^3 + a*x^2 + (3*a+8)*x + (4*a+3) over Number Field in a with defining polynomial x^2 - 10 has no global minimal model! For a semi-global minimal model use semi_global=True 

sage: E.global_minimal_model(semi_global=True) 

Elliptic Curve defined by y^2 + a*x*y = x^3 + a*x^2 + (3*a+8)*x + (4*a+3) over Number Field in a with defining polynomial x^2 - 10 

 

An example of a curve with everywhere good reduction but which 

has no model with unit discriminant:: 

 

sage: K.<a> = NumberField(x^2-x-16) 

sage: K.class_number() 

2 

sage: E = EllipticCurve([0,0,0,-15221331*a - 53748576, -79617688290*a - 281140318368]) 

sage: Emin = E.global_minimal_model(semi_global=True) 

sage: Emin.ainvs() 

(a, a - 1, a, 605*a - 2728, 15887*a - 71972) 

sage: Emin.discriminant() 

-17*a - 16 

sage: Emin.discriminant().norm() 

-4096 

sage: Emin.minimal_discriminant_ideal() 

Fractional ideal (1) 

sage: E.conductor() 

Fractional ideal (1) 

""" 

if proof is None: 

import sage.structure.proof.proof 

# We use the "number_field" flag because the actual proof dependence is in PARI's number field functions. 

proof = sage.structure.proof.proof.get_flag(None, "number_field") 

 

if self.has_global_minimal_model() or semi_global: 

if self.base_ring().class_number() == 1: 

E = self.global_integral_model() 

for P in E.base_ring()(E.discriminant()).support(): 

E = E.local_data(P,proof, globally=True).minimal_model() 

else: 

from .kraus import semi_global_minimal_model 

E, P = semi_global_minimal_model(self) 

return E._scale_by_units()._reduce_model() 

 

raise ValueError("%s has no global minimal model! For a semi-global minimal model use semi_global=True" % self) 

 

def reduction(self,place): 

r""" 

Return the reduction of the elliptic curve at a place of good reduction. 

 

INPUT: 

 

- ``place`` -- a prime ideal in the base field of the curve 

 

OUTPUT: 

 

An elliptic curve over a finite field, the residue field of the place. 

 

EXAMPLES:: 

 

sage: K.<i> = QuadraticField(-1) 

sage: EK = EllipticCurve([0,0,0,i,i+3]) 

sage: v = K.fractional_ideal(2*i+3) 

sage: EK.reduction(v) 

Elliptic Curve defined by y^2 = x^3 + 5*x + 8 over Residue field of Fractional ideal (2*i + 3) 

sage: EK.reduction(K.ideal(1+i)) 

Traceback (most recent call last): 

... 

ValueError: The curve must have good reduction at the place. 

sage: EK.reduction(K.ideal(2)) 

Traceback (most recent call last): 

... 

ValueError: The ideal must be prime. 

sage: K=QQ.extension(x^2+x+1,"a") 

sage: E=EllipticCurve([1024*K.0,1024*K.0]) 

sage: E.reduction(2*K) 

Elliptic Curve defined by y^2 + (abar+1)*y = x^3 over Residue field in abar of Fractional ideal (2) 

""" 

K = self.base_field() 

OK = K.ring_of_integers() 

try: 

place = K.ideal(place) 

except TypeError: 

raise TypeError("The parameter must be an ideal of the base field of the elliptic curve") 

if not place.is_prime(): 

raise ValueError("The ideal must be prime.") 

disc = self.discriminant() 

if not K.ideal(disc).valuation(place) == 0: 

local_data=self.local_data(place) 

if local_data.has_good_reduction(): 

Fv = OK.residue_field(place) 

return local_data.minimal_model().change_ring(Fv) 

raise ValueError("The curve must have good reduction at the place.") 

Fv = OK.residue_field(place) 

return self.change_ring(Fv) 

 

def _torsion_bound(self,number_of_places = 20): 

r""" 

An upper bound on the order of the torsion subgroup. 

 

INPUT: 

 

- ``number_of_places`` (positive integer, default = 20) -- the 

number of places that will be used to find the bound. 

 

OUTPUT: 

 

(integer) An upper bound on the torsion order. 

 

ALGORITHM: 

 

An upper bound on the order of the torsion.group of the 

elliptic curve is obtained by counting points modulo several 

primes of good reduction. Note that the upper bound returned 

by this function is a multiple of the order of the torsion 

group, and in general will be greater than the order. 

 

EXAMPLES:: 

 

sage: CDB=CremonaDatabase() 

sage: [E._torsion_bound() for E in CDB.iter([14])] 

[6, 6, 6, 6, 6, 6] 

sage: [E.torsion_order() for E in CDB.iter([14])] 

[6, 6, 2, 6, 2, 6] 

 

An example over a relative number field (see :trac:`16011`):: 

 

sage: R.<x> = QQ[] 

sage: F.<a> = QuadraticField(5) 

sage: K.<b> = F.extension(x^2-3) 

sage: E = EllipticCurve(K,[0,0,0,b,1]) 

sage: E.torsion_subgroup().order() 

1 

 

""" 

E = self 

bound = ZZ(0) 

k = 0 

K = E.base_field() 

disc = E.discriminant() 

p = Integer(1) 

# runs through primes, decomposes them into prime ideals 

while k < number_of_places : 

p = p.next_prime() 

f = K.primes_above(p) 

# runs through prime ideals above p 

for qq in f: 

fqq = qq.residue_class_degree() 

charqq = qq.smallest_integer() 

# take only places with small residue field (so that the 

# number of points will be small) 

if fqq == 1 or charqq**fqq < 3*number_of_places: 

# check if the model is integral at the place 

if min([K.ideal(a).valuation(qq) for a in E.a_invariants()]) >= 0: 

eqq = qq.absolute_ramification_index() 

# check if the formal group at the place is torsion-free 

# if so the torsion injects into the reduction 

if eqq < charqq - 1 and disc.valuation(qq) == 0: 

Etilda = E.reduction(qq) 

Npp = Etilda.cardinality() 

bound = bound.gcd(Npp) 

if bound == 1: 

return bound 

k += 1 

return bound 

 

@cached_method 

def torsion_subgroup(self): 

r""" 

Returns the torsion subgroup of this elliptic curve. 

 

OUTPUT: 

 

(``EllipticCurveTorsionSubgroup``) The 

``EllipticCurveTorsionSubgroup`` associated to this elliptic 

curve. 

 

EXAMPLES:: 

 

sage: E = EllipticCurve('11a1') 

sage: K.<t>=NumberField(x^4 + x^3 + 11*x^2 + 41*x + 101) 

sage: EK = E.base_extend(K) 

sage: tor = EK.torsion_subgroup() # long time (2s on sage.math, 2014) 

sage: tor # long time 

Torsion Subgroup isomorphic to Z/5 + Z/5 associated to the Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) over Number Field in t with defining polynomial x^4 + x^3 + 11*x^2 + 41*x + 101 

sage: tor.gens() # long time 

((16 : 60 : 1), (t : 1/11*t^3 + 6/11*t^2 + 19/11*t + 48/11 : 1)) 

 

:: 

 

sage: E = EllipticCurve('15a1') 

sage: K.<t>=NumberField(x^2 + 2*x + 10) 

sage: EK=E.base_extend(K) 

sage: EK.torsion_subgroup() 

Torsion Subgroup isomorphic to Z/4 + Z/4 associated to the Elliptic Curve defined by y^2 + x*y + y = x^3 + x^2 + (-10)*x + (-10) over Number Field in t with defining polynomial x^2 + 2*x + 10 

 

:: 

 

sage: E = EllipticCurve('19a1') 

sage: K.<t>=NumberField(x^9-3*x^8-4*x^7+16*x^6-3*x^5-21*x^4+5*x^3+7*x^2-7*x+1) 

sage: EK=E.base_extend(K) 

sage: EK.torsion_subgroup() 

Torsion Subgroup isomorphic to Z/9 associated to the Elliptic Curve defined by y^2 + y = x^3 + x^2 + (-9)*x + (-15) over Number Field in t with defining polynomial x^9 - 3*x^8 - 4*x^7 + 16*x^6 - 3*x^5 - 21*x^4 + 5*x^3 + 7*x^2 - 7*x + 1 

 

:: 

 

sage: K.<i> = QuadraticField(-1) 

sage: EK = EllipticCurve([0,0,0,i,i+3]) 

sage: EK.torsion_subgroup () 

Torsion Subgroup isomorphic to Trivial group associated to the Elliptic Curve defined by y^2 = x^3 + i*x + (i+3) over Number Field in i with defining polynomial x^2 + 1 

""" 

from .ell_torsion import EllipticCurveTorsionSubgroup 

return EllipticCurveTorsionSubgroup(self) 

 

@cached_method 

def torsion_order(self): 

r""" 

Returns the order of the torsion subgroup of this elliptic curve. 

 

OUTPUT: 

 

(integer) the order of the torsion subgroup of this elliptic curve. 

 

EXAMPLES:: 

 

sage: E = EllipticCurve('11a1') 

sage: K.<t> = NumberField(x^4 + x^3 + 11*x^2 + 41*x + 101) 

sage: EK = E.base_extend(K) 

sage: EK.torsion_order() # long time (2s on sage.math, 2014) 

25 

 

:: 

 

sage: E = EllipticCurve('15a1') 

sage: K.<t> = NumberField(x^2 + 2*x + 10) 

sage: EK = E.base_extend(K) 

sage: EK.torsion_order() 

16 

 

:: 

 

sage: E = EllipticCurve('19a1') 

sage: K.<t> = NumberField(x^9-3*x^8-4*x^7+16*x^6-3*x^5-21*x^4+5*x^3+7*x^2-7*x+1) 

sage: EK = E.base_extend(K) 

sage: EK.torsion_order() 

9 

 

:: 

 

sage: K.<i> = QuadraticField(-1) 

sage: EK = EllipticCurve([0,0,0,i,i+3]) 

sage: EK.torsion_order() 

1 

""" 

return self.torsion_subgroup().order() 

 

def torsion_points(self): 

r""" 

Returns a list of the torsion points of this elliptic curve. 

 

OUTPUT: 

 

(list) A sorted list of the torsion points. 

 

EXAMPLES:: 

 

sage: E = EllipticCurve('11a1') 

sage: E.torsion_points() 

[(0 : 1 : 0), (5 : -6 : 1), (5 : 5 : 1), (16 : -61 : 1), (16 : 60 : 1)] 

sage: K.<t> = NumberField(x^4 + x^3 + 11*x^2 + 41*x + 101) 

sage: EK = E.base_extend(K) 

sage: EK.torsion_points() # long time (1s on sage.math, 2014) 

[(0 : 1 : 0), 

(16 : 60 : 1), 

(5 : 5 : 1), 

(5 : -6 : 1), 

(16 : -61 : 1), 

(t : 1/11*t^3 + 6/11*t^2 + 19/11*t + 48/11 : 1), 

(-3/55*t^3 - 7/55*t^2 - 2/55*t - 133/55 : 6/55*t^3 + 3/55*t^2 + 25/11*t + 156/55 : 1), 

(-9/121*t^3 - 21/121*t^2 - 127/121*t - 377/121 : -7/121*t^3 + 24/121*t^2 + 197/121*t + 16/121 : 1), 

(5/121*t^3 - 14/121*t^2 - 158/121*t - 453/121 : -49/121*t^3 - 129/121*t^2 - 315/121*t - 207/121 : 1), 

(10/121*t^3 + 49/121*t^2 + 168/121*t + 73/121 : 32/121*t^3 + 60/121*t^2 - 261/121*t - 807/121 : 1), 

(1/11*t^3 - 5/11*t^2 + 19/11*t - 40/11 : -6/11*t^3 - 3/11*t^2 - 26/11*t - 321/11 : 1), 

(14/121*t^3 - 15/121*t^2 + 90/121*t + 232/121 : 16/121*t^3 - 69/121*t^2 + 293/121*t - 46/121 : 1), 

(3/55*t^3 + 7/55*t^2 + 2/55*t + 78/55 : 7/55*t^3 - 24/55*t^2 + 9/11*t + 17/55 : 1), 

(-5/121*t^3 + 36/121*t^2 - 84/121*t + 24/121 : 34/121*t^3 - 27/121*t^2 + 305/121*t + 708/121 : 1), 

(-26/121*t^3 + 20/121*t^2 - 219/121*t - 995/121 : 15/121*t^3 + 156/121*t^2 - 232/121*t + 2766/121 : 1), 

(1/11*t^3 - 5/11*t^2 + 19/11*t - 40/11 : 6/11*t^3 + 3/11*t^2 + 26/11*t + 310/11 : 1), 

(-26/121*t^3 + 20/121*t^2 - 219/121*t - 995/121 : -15/121*t^3 - 156/121*t^2 + 232/121*t - 2887/121 : 1), 

(-5/121*t^3 + 36/121*t^2 - 84/121*t + 24/121 : -34/121*t^3 + 27/121*t^2 - 305/121*t - 829/121 : 1), 

(3/55*t^3 + 7/55*t^2 + 2/55*t + 78/55 : -7/55*t^3 + 24/55*t^2 - 9/11*t - 72/55 : 1), 

(14/121*t^3 - 15/121*t^2 + 90/121*t + 232/121 : -16/121*t^3 + 69/121*t^2 - 293/121*t - 75/121 : 1), 

(t : -1/11*t^3 - 6/11*t^2 - 19/11*t - 59/11 : 1), 

(10/121*t^3 + 49/121*t^2 + 168/121*t + 73/121 : -32/121*t^3 - 60/121*t^2 + 261/121*t + 686/121 : 1), 

(5/121*t^3 - 14/121*t^2 - 158/121*t - 453/121 : 49/121*t^3 + 129/121*t^2 + 315/121*t + 86/121 : 1), 

(-9/121*t^3 - 21/121*t^2 - 127/121*t - 377/121 : 7/121*t^3 - 24/121*t^2 - 197/121*t - 137/121 : 1), 

(-3/55*t^3 - 7/55*t^2 - 2/55*t - 133/55 : -6/55*t^3 - 3/55*t^2 - 25/11*t - 211/55 : 1)] 

 

:: 

 

sage: E = EllipticCurve('15a1') 

sage: K.<t> = NumberField(x^2 + 2*x + 10) 

sage: EK = E.base_extend(K) 

sage: EK.torsion_points() 

[(-7 : -5*t - 2 : 1), 

(-7 : 5*t + 8 : 1), 

(-13/4 : 9/8 : 1), 

(-2 : -2 : 1), 

(-2 : 3 : 1), 

(-t - 2 : -t - 7 : 1), 

(-t - 2 : 2*t + 8 : 1), 

(-1 : 0 : 1), 

(t : t - 5 : 1), 

(t : -2*t + 4 : 1), 

(0 : 1 : 0), 

(1/2 : -5/4*t - 2 : 1), 

(1/2 : 5/4*t + 1/2 : 1), 

(3 : -2 : 1), 

(8 : -27 : 1), 

(8 : 18 : 1)] 

 

:: 

 

sage: K.<i> = QuadraticField(-1) 

sage: EK = EllipticCurve(K,[0,0,0,0,-1]) 

sage: EK.torsion_points () 

[(-2 : -3*i : 1), (-2 : 3*i : 1), (0 : -i : 1), (0 : i : 1), (0 : 1 : 0), (1 : 0 : 1)] 

""" 

T = self.torsion_subgroup() # cached 

return sorted(T.points()) # these are also cached in T 

 

def rank_bounds(self, **kwds): 

r""" 

Returns the lower and upper bounds using :meth:`~simon_two_descent`. 

The results of :meth:`~simon_two_descent` are cached. 

 

.. NOTE:: 

 

The optional parameters control the Simon two descent algorithm; 

see the documentation of :meth:`~simon_two_descent` for more 

details. 

 

INPUT: 

 

- ``verbose`` -- 0, 1, 2, or 3 (default: 0), the verbosity level 

 

- ``lim1`` -- (default: 2) limit on trivial points on quartics 

 

- ``lim3`` -- (default: 4) limit on points on ELS quartics 

 

- ``limtriv`` -- (default: 2) limit on trivial points on elliptic curve 

 

- ``maxprob`` -- (default: 20) 

 

- ``limbigprime`` -- (default: 30) to distinguish between 

small and large prime numbers. Use probabilistic tests for 

large primes. If 0, don't use probabilistic tests. 

 

- ``known_points`` -- (default: None) list of known points on 

the curve 

 

OUTPUT: 

 

lower and upper bounds for the rank of the Mordell-Weil group 

 

 

.. NOTE:: 

 

For non-quadratic number fields, this code does 

return, but it takes a long time. 

 

EXAMPLES:: 

 

sage: K.<a> = NumberField(x^2 + 23, 'a') 

sage: E = EllipticCurve(K, '37') 

sage: E == loads(dumps(E)) 

True 

sage: E.rank_bounds() 

(2, 2) 

 

Here is a curve with two-torsion, again the bounds coincide:: 

 

sage: Qrt5.<rt5>=NumberField(x^2-5) 

sage: E=EllipticCurve([0,5-rt5,0,rt5,0]) 

sage: E.rank_bounds() 

(1, 1) 

 

Finally an example with non-trivial 2-torsion in Sha. So the 

2-descent will not be able to determine the rank, but can only 

give bounds:: 

 

sage: E = EllipticCurve("15a5") 

sage: K.<t> = NumberField(x^2-6) 

sage: EK = E.base_extend(K) 

sage: EK.rank_bounds(lim1=1,lim3=1,limtriv=1) 

(0, 2) 

 

IMPLEMENTATION: 

 

Uses Denis Simon's PARI/GP scripts from 

http://www.math.unicaen.fr/~simon/. 

 

""" 

lower, upper, gens = self.simon_two_descent(**kwds) 

# this was corrected in trac 13593. upper is the dimension 

# of the 2-selmer group, so we can certainly remove the 

# 2-torsion of the Mordell-Weil group. 

upper -= self.two_torsion_rank() 

return lower, upper 

 

def rank(self, **kwds): 

r""" 

Return the rank of this elliptic curve, if it can be determined. 

 

.. NOTE:: 

 

The optional parameters control the Simon two descent algorithm; 

see the documentation of :meth:`~simon_two_descent` for more 

details. 

 

INPUT: 

 

- ``verbose`` -- 0, 1, 2, or 3 (default: 0), the verbosity level 

 

- ``lim1`` -- (default: 2) limit on trivial points on quartics 

 

- ``lim3`` -- (default: 4) limit on points on ELS quartics 

 

- ``limtriv`` -- (default: 2) limit on trivial points on elliptic curve 

 

- ``maxprob`` -- (default: 20) 

 

- ``limbigprime`` -- (default: 30) to distinguish between 

small and large prime numbers. Use probabilistic tests for 

large primes. If 0, don't use probabilistic tests. 

 

- ``known_points`` -- (default: None) list of known points on 

the curve 

 

OUTPUT: 

 

If the upper and lower bounds given by Simon two-descent are 

the same, then the rank has been uniquely identified and we 

return this. Otherwise, we raise a ValueError with an error 

message specifying the upper and lower bounds. 

 

.. NOTE:: 

 

For non-quadratic number fields, this code does return, but it takes 

a long time. 

 

EXAMPLES:: 

 

sage: K.<a> = NumberField(x^2 + 23, 'a') 

sage: E = EllipticCurve(K, '37') 

sage: E == loads(dumps(E)) 

True 

sage: E.rank() 

2 

 

Here is a curve with two-torsion in the Tate-Shafarevich group, 

so here the bounds given by the algorithm do not uniquely 

determine the rank:: 

 

sage: E = EllipticCurve("15a5") 

sage: K.<t> = NumberField(x^2-6) 

sage: EK = E.base_extend(K) 

sage: EK.rank(lim1=1, lim3=1, limtriv=1) 

Traceback (most recent call last): 

... 

ValueError: There is insufficient data to determine the rank - 

2-descent gave lower bound 0 and upper bound 2 

 

IMPLEMENTATION: 

 

Uses Denis Simon's PARI/GP scripts from 

http://www.math.unicaen.fr/~simon/. 

 

""" 

lower, upper = self.rank_bounds(**kwds) 

if lower == upper: 

return lower 

else: 

raise ValueError('There is insufficient data to determine the rank - 2-descent gave lower bound %s and upper bound %s' % (lower, upper)) 

 

def gens(self, **kwds): 

r""" 

Return some points of infinite order on this elliptic curve. 

 

Contrary to what the name of this method suggests, the points 

it returns do not always generate a subgroup of full rank in 

the Mordell-Weil group, nor are they necessarily linearly 

independent. Moreover, the number of points can be smaller or 

larger than what one could expect after calling :meth:`~rank` 

or :meth:`~rank_bounds`. 

 

.. NOTE:: 

 

The optional parameters control the Simon two descent algorithm; 

see the documentation of :meth:`~simon_two_descent` for more 

details. 

 

INPUT: 

 

- ``verbose`` -- 0, 1, 2, or 3 (default: 0), the verbosity level 

 

- ``lim1`` -- (default: 2) limit on trivial points on quartics 

 

- ``lim3`` -- (default: 4) limit on points on ELS quartics 

 

- ``limtriv`` -- (default: 2) limit on trivial points on elliptic curve 

 

- ``maxprob`` -- (default: 20) 

 

- ``limbigprime`` -- (default: 30) to distinguish between 

small and large prime numbers. Use probabilistic tests for 

large primes. If 0, don't use probabilistic tests. 

 

- ``known_points`` -- (default: None) list of known points on 

the curve 

 

OUTPUT: 

 

A set of points of infinite order given by the Simon two-descent. 

 

.. NOTE:: 

 

For non-quadratic number fields, this code does return, but it takes 

a long time. 

 

EXAMPLES:: 

 

sage: K.<a> = NumberField(x^2 + 23, 'a') 

sage: E = EllipticCurve(K,[0,0,0,101,0]) 

sage: E.gens() 

[(23831509/8669448*a - 2867471/8669448 : 76507317707/18049790736*a - 424166479633/18049790736 : 1), 

(-2031032029/969232392*a + 58813561/969232392 : -15575984630401/21336681877488*a + 451041199309/21336681877488 : 1), 

(-186948623/4656964 : 549438861195/10049728312*a : 1)] 

 

It can happen that no points are found if the height bounds 

used in the search are too small (see :trac:`10745`):: 

 

sage: K.<y> = NumberField(x^4 + x^2 - 7) 

sage: E = EllipticCurve(K, [1, 0, 5*y^2 + 16, 0, 0]) 

sage: E.gens(lim1=1, lim3=1) 

[] 

sage: E.rank(), E.gens(lim3=12) # long time (about 4s) 

(1, 

[(369/25*y^3 + 539/25*y^2 + 1178/25*y + 1718/25 : -29038/125*y^3 - 43003/125*y^2 - 92706/125*y - 137286/125 : 1)]) 

 

Here is a curve of rank 2:: 

 

sage: K.<t> = NumberField(x^2-17) 

sage: E = EllipticCurve(K,[-4,0]) 

sage: E.gens() 

[(-1/2*t + 1/2 : -1/2*t + 1/2 : 1), (-t + 3 : -2*t + 10 : 1)] 

sage: E.rank() 

2 

 

Test that points of finite order are not included (see :trac:`13593`):: 

 

sage: E = EllipticCurve("17a3") 

sage: K.<t> = NumberField(x^2+3) 

sage: EK = E.base_extend(K) 

sage: EK.rank() 

0 

sage: EK.gens() 

[] 

 

IMPLEMENTATION: 

 

For curves over quadratic fields which are base-changes from 

`\QQ`, we delegate the work to :meth:`gens_quadratic` where 

methods over `\QQ` suffice. Otherwise, we use Denis Simon's 

PARI/GP scripts from http://www.math.unicaen.fr/~simon/. 

""" 

try: 

return self.gens_quadratic(**kwds) 

except ValueError: 

_ = self.simon_two_descent(**kwds) 

return self._known_points 

 

def period_lattice(self, embedding): 

r""" 

Returns the period lattice of the elliptic curve for the given 

embedding of its base field with respect to the differential 

`dx/(2y + a_1x + a_3)`. 

 

INPUT: 

 

- ``embedding`` - an embedding of the base number field into `\RR` or `\CC`. 

 

.. note:: 

 

The precision of the embedding is ignored: we only use the 

given embedding to determine which embedding into ``QQbar`` 

to use. Once the lattice has been initialized, periods can 

be computed to arbitrary precision. 

 

 

EXAMPLES: 

 

First define a field with two real embeddings:: 

 

sage: K.<a> = NumberField(x^3-2) 

sage: E=EllipticCurve([0,0,0,a,2]) 

sage: embs=K.embeddings(CC); len(embs) 

3 

 

For each embedding we have a different period lattice:: 

 

sage: E.period_lattice(embs[0]) 

Period lattice associated to Elliptic Curve defined by y^2 = x^3 + a*x + 2 over Number Field in a with defining polynomial x^3 - 2 with respect to the embedding Ring morphism: 

From: Number Field in a with defining polynomial x^3 - 2 

To: Algebraic Field 

Defn: a |--> -0.6299605249474365? - 1.091123635971722?*I 

 

sage: E.period_lattice(embs[1]) 

Period lattice associated to Elliptic Curve defined by y^2 = x^3 + a*x + 2 over Number Field in a with defining polynomial x^3 - 2 with respect to the embedding Ring morphism: 

From: Number Field in a with defining polynomial x^3 - 2 

To: Algebraic Field 

Defn: a |--> -0.6299605249474365? + 1.091123635971722?*I 

 

sage: E.period_lattice(embs[2]) 

Period lattice associated to Elliptic Curve defined by y^2 = x^3 + a*x + 2 over Number Field in a with defining polynomial x^3 - 2 with respect to the embedding Ring morphism: 

From: Number Field in a with defining polynomial x^3 - 2 

To: Algebraic Field 

Defn: a |--> 1.259921049894873? 

 

Although the original embeddings have only the default 

precision, we can obtain the basis with higher precision 

later:: 

 

sage: L=E.period_lattice(embs[0]) 

sage: L.basis() 

(1.86405007647981 - 0.903761485143226*I, -0.149344633143919 - 2.06619546272945*I) 

 

sage: L.basis(prec=100) 

(1.8640500764798108425920506200 - 0.90376148514322594749786960975*I, -0.14934463314391922099120107422 - 2.0661954627294548995621225062*I) 

""" 

from sage.schemes.elliptic_curves.period_lattice import PeriodLattice_ell 

return PeriodLattice_ell(self,embedding) 

 

def height_function(self): 

""" 

Return the canonical height function attached to self. 

 

EXAMPLES:: 

 

sage: K.<a> = NumberField(x^2 - 5) 

sage: E = EllipticCurve(K, '11a3') 

sage: E.height_function() 

EllipticCurveCanonicalHeight object associated to Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 over Number Field in a with defining polynomial x^2 - 5 

 

""" 

if not hasattr(self, '_height_function'): 

from sage.schemes.elliptic_curves.height import EllipticCurveCanonicalHeight 

self._height_function = EllipticCurveCanonicalHeight(self) 

return self._height_function 

 

########################################################## 

# Isogeny class 

########################################################## 

def isogeny_class(self): 

r""" 

Returns the isogeny class of this elliptic curve. 

 

OUTPUT: 

 

An instance of the class 

:class:`sage.schemes.elliptic_curves.isogeny_class.IsogenyClass_EC_NumberField`. 

From this object may be obtained a list of curves in the 

class, a matrix of the degrees of the isogenies between them, 

and the isogenies themselves. 

 

.. note:: 

 

The curves in the isogeny class will all be minimal models 

if these exist (for example, when the class number is 

`1`); otherwise they will be minimal at all but one prime. 

 

EXAMPLES:: 

 

sage: K.<i> = QuadraticField(-1) 

sage: E = EllipticCurve(K, [0,0,0,0,1]) 

sage: C = E.isogeny_class(); C 

Isogeny class of Elliptic Curve defined by y^2 = x^3 + 1 over Number Field in i with defining polynomial x^2 + 1 

 

The curves in the class (sorted):: 

 

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)] 

 

The matrix of degrees of cyclic isogenies between curves:: 

 

sage: C.matrix() 

[1 3 6 2] 

[3 1 2 6] 

[6 2 1 3] 

[2 6 3 1] 

 

The array of isogenies themselves is not filled out but only 

contains those used to construct the class, the other entries 

containing the integer 0. This will be changed when the 

class :class:`EllipticCurveIsogeny` allowed composition. In 

this case we used `2`-isogenies to go from 0 to 2 and from 1 

to 3, and `3`-isogenies to go from 0 to 1 and from 2 to 3:: 

 

sage: isogs = C.isogenies() 

sage: [((i,j),isogs[i][j].degree()) for i in range(4) for j in range(4) if isogs[i][j]!=0] 

[((0, 1), 3), 

((0, 3), 2), 

((1, 0), 3), 

((1, 2), 2), 

((2, 1), 2), 

((2, 3), 3), 

((3, 0), 2), 

((3, 2), 3)] 

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)), 

((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))] 

 

The isogeny class may be visualized by obtaining its graph and 

plotting it:: 

 

sage: G = C.graph() 

sage: G.show(edge_labels=True) # long time 

 

sage: K.<i> = QuadraticField(-1) 

sage: E = EllipticCurve([1+i, -i, i, 1, 0]) 

sage: C = E.isogeny_class(); C 

Isogeny class of Elliptic Curve defined by y^2 + (i+1)*x*y + i*y = x^3 + (-i)*x^2 + x over Number Field in i with defining polynomial x^2 + 1 

sage: len(C) 

6 

sage: C.matrix() 

[ 1 3 9 18 6 2] 

[ 3 1 3 6 2 6] 

[ 9 3 1 2 6 18] 

[18 6 2 1 3 9] 

[ 6 2 6 3 1 3] 

[ 2 6 18 9 3 1] 

sage: [E1.ainvs() for E1 in C] 

[(i + 1, i - 1, i, -i - 1, -i + 1), 

(i + 1, i - 1, i, 14*i + 4, 7*i + 14), 

(i + 1, i - 1, i, 59*i + 99, 372*i - 410), 

(i + 1, -i, i, -240*i - 399, 2869*i + 2627), 

(i + 1, -i, i, -5*i - 4, 2*i + 5), 

(i + 1, -i, i, 1, 0)] 

 

An example with CM by `\sqrt{-5}`:: 

 

sage: pol = PolynomialRing(QQ,'x')([1,0,3,0,1]) 

sage: K.<c> = NumberField(pol) 

sage: j = 1480640+565760*c^2 

sage: E = EllipticCurve(j=j) 

sage: E.has_cm() 

True 

sage: E.has_rational_cm() 

True 

sage: E.cm_discriminant() 

-20 

sage: C = E.isogeny_class() 

sage: len(C) 

2 

sage: C.matrix() 

[1 2] 

[2 1] 

sage: [E.ainvs() for E in C] 

[(0, 0, 0, 83490*c^2 - 147015, -64739840*c^2 - 84465260), 

(0, 0, 0, -161535*c^2 + 70785, -62264180*c^3 + 6229080*c)] 

sage: C.isogenies()[0][1] 

Isogeny of degree 2 from Elliptic Curve defined by y^2 = x^3 + (83490*c^2-147015)*x + (-64739840*c^2-84465260) over Number Field in c with defining polynomial x^4 + 3*x^2 + 1 to Elliptic Curve defined by y^2 = x^3 + (-161535*c^2+70785)*x + (-62264180*c^3+6229080*c) over Number Field in c with defining polynomial x^4 + 3*x^2 + 1 

 

An example with CM by `\sqrt{-23}` (class number `3`):: 

 

sage: pol = PolynomialRing(QQ,'x')([1,-3,5,-5,5,-3,1]) 

sage: L.<a> = NumberField(pol) 

sage: js = hilbert_class_polynomial(-23).roots(L,multiplicities=False); len(js) 

3 

sage: E = EllipticCurve(j=js[0]) 

sage: E.has_rational_cm() 

True 

sage: len(E.isogenies_prime_degree()) 

3 

sage: C = E.isogeny_class(); len(C) 

6 

 

The reason for the isogeny class having size six while the 

class number is only `3` is that the class also contains three 

curves with CM by the order of discriminant `-92=4\cdot(-23)`, 

which also has class number `3`. The curves in the class are 

sorted first by CM discriminant (then lexicographically using 

a-invariants):: 

 

sage: [F.cm_discriminant() for F in C] 

[-23, -23, -23, -92, -92, -92] 

 

`2` splits in the order with discriminant `-23`, into two 

primes of order `3` in the class group, each of which induces 

a `2`-isogeny to a curve with the same endomorphism ring; the 

third `2`-isogeny is to a curve with the smaller endomorphism 

ring:: 

 

sage: [phi.codomain().cm_discriminant() for phi in E.isogenies_prime_degree()] 

[-92, -23, -23] 

 

sage: C.matrix() 

[1 2 2 4 2 4] 

[2 1 2 2 4 4] 

[2 2 1 4 4 2] 

[4 2 4 1 3 3] 

[2 4 4 3 1 3] 

[4 4 2 3 3 1] 

 

The graph of this isogeny class has a shape which does not 

occur over `\QQ`: a triangular prism. Note that for curves 

without CM, the graph has an edge between two curves if and 

only if they are connected by an isogeny of prime degree, and 

this degree is uniquely determined by the two curves, but in 

the CM case this property does not hold, since for pairs of 

curves in the class with the same endomorphism ring `O`, the 

set of degrees of isogenies between them is the set of 

integers represented by a primitive integral binary quadratic 

form of discriminant `\text{disc}(O)`, and this form 

represents infinitely many primes. In the matrix we give a 

small prime represented by the appropriate form. In this 

example, the matrix is formed by four `3\times3` blocks. The 

isogenies of degree `2` indicated by the upper left `3\times3` 

block of the matrix could be replaced by isogenies of any 

degree represented by the quadratic form `2x^2+xy+3y^2` of 

discriminant `-23`. Similarly in the lower right block, the 

entries of `3` could be represented by any integers 

represented by the quadratic form `3x^2+2xy+8y^2` of 

discriminant `-92`. In the top right block and lower left 

blocks, by contrast, the prime entries `2` are unique 

determined:: 

 

sage: G = C.graph() 

sage: G.adjacency_matrix() 

[0 1 1 0 1 0] 

[1 0 1 1 0 0] 

[1 1 0 0 0 1] 

[0 1 0 0 1 1] 

[1 0 0 1 0 1] 

[0 0 1 1 1 0] 

 

To display the graph without any edge labels:: 

 

G.show() # long time 

 

To display the graph with edge labels: by default, for curves 

with rational CM, the labels are the coefficients of the 

associated quadratic forms:: 

 

G.show(edge_labels=True) # long time 

 

For an alternative view, first relabel the edges using only 2 

labels to distinguish between isogenies between curves with 

the same endomorphism ring and isogenies between curves with 

different endomorphism rings, then use a 3-dimensional plot 

which can be rotated:: 

 

sage: for i,j,l in G.edge_iterator(): G.set_edge_label(i,j,l.count(',')) 

sage: G.show3d(color_by_label=True) 

 

A class number `6` example. First we set up the fields: ``pol`` 

defines the same field as ``pol26`` but is simpler:: 

 

sage: pol26 = hilbert_class_polynomial(-4*26) 

sage: pol = x^6-x^5+2*x^4+x^3-2*x^2-x-1 

sage: K.<a> = NumberField(pol) 

sage: L.<b> = K.extension(x^2+26) 

 

Only `2` of the `j`-invariants with discriminant -104 are in 

`K`, though all are in `L`:: 

 

sage: len(pol26.roots(K)) 

2 

sage: len(pol26.roots(L)) 

6 

 

We create an elliptic curve defined over `K` with one of the 

`j`-invariants in `K`:: 

 

sage: j1 = pol26.roots(K)[0][0] 

sage: E = EllipticCurve(j=j1) 

sage: E.has_cm() 

True 

sage: E.has_rational_cm() 

False 

sage: E.has_rational_cm(L) 

True 

 

Over `K` the isogeny class has size `4`, with `2` curves for 

each of the `2` `K`-rational `j`-invariants:: 

 

sage: C = E.isogeny_class(); len(C) # long time (~11s) 

4 

sage: C.matrix() # long time 

[ 1 13 2 26] 

[13 1 26 2] 

[ 2 26 1 13] 

[26 2 13 1] 

sage: len(Set([EE.j_invariant() for EE in C.curves])) # long time 

2 

 

Over `L`, the isogeny class grows to size `6` (the class 

number):: 

 

sage: EL = E.change_ring(L) 

sage: CL = EL.isogeny_class(); len(CL) # long time (~80s) 

6 

sage: Set([EE.j_invariant() for EE in CL.curves]) == Set(pol26.roots(L,multiplicities=False)) # long time 

True 

 

In each position in the matrix of degrees, we see primes (or 

`1`). In fact the set of degrees of cyclic isogenies from 

curve `i` to curve `j` is infinite, and is the set of all 

integers represented by one of the primitive binary quadratic 

forms of discriminant `-104`, from which we have selected a 

small prime:: 

 

sage: CL.matrix() # long time # random (see :trac:`19229`) 

[1 2 3 3 5 5] 

[2 1 5 5 3 3] 

[3 5 1 3 2 5] 

[3 5 3 1 5 2] 

[5 3 2 5 1 3] 

[5 3 5 2 3 1] 

 

To see the array of binary quadratic forms:: 

 

sage: CL.qf_matrix() # long time # random (see :trac:`19229`) 

[[[1], [2, 0, 13], [3, -2, 9], [3, -2, 9], [5, -4, 6], [5, -4, 6]], 

[[2, 0, 13], [1], [5, -4, 6], [5, -4, 6], [3, -2, 9], [3, -2, 9]], 

[[3, -2, 9], [5, -4, 6], [1], [3, -2, 9], [2, 0, 13], [5, -4, 6]], 

[[3, -2, 9], [5, -4, 6], [3, -2, 9], [1], [5, -4, 6], [2, 0, 13]], 

[[5, -4, 6], [3, -2, 9], [2, 0, 13], [5, -4, 6], [1], [3, -2, 9]], 

[[5, -4, 6], [3, -2, 9], [5, -4, 6], [2, 0, 13], [3, -2, 9], [1]]] 

 

As in the non-CM case, the isogeny class may be visualized by 

obtaining its graph and plotting it. Since there are more 

edges than in the non-CM case, it may be preferable to omit 

the edge_labels:: 

 

sage: G = C.graph() 

sage: G.show(edge_labels=False) # long time 

 

It is possible to display a 3-dimensional plot, with colours 

to represent the different edge labels, in a form which can be 

rotated!:: 

 

sage: G.show3d(color_by_label=True) # long time 

 

TESTS: 

 

An example which failed until fixed at :trac:`19229`:: 

 

sage: K.<a> = NumberField(x^2-x+1) 

sage: E = EllipticCurve([a+1,1,1,0,0]) 

sage: C = E.isogeny_class(); len(C) 

4 

""" 

try: 

return self._isoclass 

except AttributeError: 

from sage.schemes.elliptic_curves.isogeny_class import IsogenyClass_EC_NumberField 

self._isoclass = IsogenyClass_EC_NumberField(self) 

return self._isoclass 

 

def isogenies_prime_degree(self, l=None): 

r""" 

Returns a list of `\ell`-isogenies from self, where `\ell` is a 

prime. 

 

INPUT: 

 

- ``l`` -- either None or a prime or a list of primes. 

 

OUTPUT: 

 

(list) `\ell`-isogenies for the given `\ell` or if `\ell` is None, all 

isogenies of prime degree (see below for the CM case). 

 

.. note:: 

 

Over `\QQ`, the codomains of the isogenies returned are 

standard minimal models. Over other number fields they are 

global minimal models if these exist, otherwise models 

which are minimal at all but one prime. 

 

.. note:: 

 

For curves with rational CM, isogenies of primes degree 

exist for infinitely many primes `\ell`, though there are 

only finitely many isogenous curves up to isomorphism. The 

list returned only includes one isogeny of prime degree for 

each codomain. 

 

EXAMPLES:: 

 

sage: K.<i> = QuadraticField(-1) 

sage: E = EllipticCurve(K, [0,0,0,0,1]) 

sage: isogs = E.isogenies_prime_degree() 

sage: [phi.degree() for phi in isogs] 

[2, 3] 

 

sage: pol = PolynomialRing(QQ,'x')([1,-3,5,-5,5,-3,1]) 

sage: L.<a> = NumberField(pol) 

sage: js = hilbert_class_polynomial(-23).roots(L,multiplicities=False); len(js) 

3 

sage: E = EllipticCurve(j=js[0]) 

sage: len(E.isogenies_prime_degree()) 

3 

 

TESTS:: 

 

sage: E.isogenies_prime_degree(4) 

Traceback (most recent call last): 

... 

ValueError: 4 is not prime. 

 

""" 

from .isogeny_small_degree import isogenies_prime_degree 

 

if l is not None and not isinstance(l, list): 

try: 

l = ZZ(l) 

except TypeError: 

raise ValueError("%s is not a prime integer" % l) 

try: 

if l.is_prime(proof=False): 

return isogenies_prime_degree(self, l) 

else: 

raise ValueError("%s is not prime." % l) 

except AttributeError: 

raise ValueError("%s is not prime." % l) 

 

if l is None: 

from .isogeny_class import possible_isogeny_degrees 

L = possible_isogeny_degrees(self) 

return self.isogenies_prime_degree(L) 

 

isogs = sum([self.isogenies_prime_degree(p) for p in l],[]) 

 

if self.has_rational_cm(): 

# eliminate any endomorphisms and repeated codomains 

isogs = [phi for phi in isogs if not self.is_isomorphic(phi.codomain())] 

codoms = [phi.codomain() for phi in isogs] 

isogs = [phi for i, phi in enumerate(isogs) 

if not any([E.is_isomorphic(codoms[i]) 

for E in codoms[:i]])] 

return isogs 

 

def is_isogenous(self, other, proof=True, maxnorm=100): 

""" 

Returns whether or not self is isogenous to other. 

 

INPUT: 

 

- ``other`` -- another elliptic curve. 

 

- ``proof`` (default True) -- If ``False``, the function will 

return ``True`` whenever the two curves have the same 

conductor and are isogenous modulo `p` for all primes `p` of 

norm up to ``maxnorm``. If ``True``, the function returns 

False when the previous condition does not hold, and if it 

does hold we compute the complete isogeny class to see if 

the curves are indeed isogenous. 

 

- ``maxnorm`` (integer, default 100) -- The maximum norm of 

primes `p` for which isogeny modulo `p` will be checked. 

 

OUTPUT: 

 

(bool) True if there is an isogeny from curve ``self`` to 

curve ``other``. 

 

EXAMPLES:: 

 

sage: x = polygen(QQ, 'x') 

sage: F = NumberField(x^2 -2, 's'); F 

Number Field in s with defining polynomial x^2 - 2 

sage: E1 = EllipticCurve(F, [7,8]) 

sage: E2 = EllipticCurve(F, [0,5,0,1,0]) 

sage: E3 = EllipticCurve(F, [0,-10,0,21,0]) 

sage: E1.is_isogenous(E2) 

False 

sage: E1.is_isogenous(E1) 

True 

sage: E2.is_isogenous(E2) 

True 

sage: E2.is_isogenous(E1) 

False 

sage: E2.is_isogenous(E3) 

True 

 

:: 

 

sage: x = polygen(QQ, 'x') 

sage: F = NumberField(x^2 -2, 's'); F 

Number Field in s with defining polynomial x^2 - 2 

sage: E = EllipticCurve('14a1') 

sage: EE = EllipticCurve('14a2') 

sage: E1 = E.change_ring(F) 

sage: E2 = EE.change_ring(F) 

sage: E1.is_isogenous(E2) 

True 

 

:: 

 

sage: x = polygen(QQ, 'x') 

sage: F = NumberField(x^2 -2, 's'); F 

Number Field in s with defining polynomial x^2 - 2 

sage: k.<a> = NumberField(x^3+7) 

sage: E = EllipticCurve(F, [7,8]) 

sage: EE = EllipticCurve(k, [2, 2]) 

sage: E.is_isogenous(EE) 

Traceback (most recent call last): 

... 

ValueError: Second argument must be defined over the same number field. 

 

Some examples from Cremona's 1981 tables:: 

 

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) 

sage: E2 = EllipticCurve([1+i,0,1,0,0]) 

sage: E2.conductor() 

Fractional ideal (-4*i - 7) 

sage: E1.is_isogenous(E2) # slower (~500ms) 

True 

sage: E1.is_isogenous(E2, proof=False) # faster (~170ms) 

True 

 

In this case E1 and E2 are in fact 9-isogenous, as may be 

deduced from the following:: 

 

sage: E3 = EllipticCurve([i + 1, 0, 1, -5*i - 5, -2*i - 5]) 

sage: E3.is_isogenous(E1) 

True 

sage: E3.is_isogenous(E2) 

True 

sage: E1.isogeny_degree(E2) 

9 

 

TESTS: 

 

Check that :trac:`15890` is fixed:: 

 

sage: K.<s> = QuadraticField(229) 

sage: c4 = 2173 - 235*(1 - s)/2 

sage: c6 = -124369 + 15988*(1 - s)/2 

sage: c4c = 2173 - 235*(1 + s)/2 

sage: c6c = -124369 + 15988*(1 + s)/2 

sage: E = EllipticCurve_from_c4c6(c4, c6) 

sage: Ec = EllipticCurve_from_c4c6(c4c, c6c) 

sage: E.is_isogenous(Ec) 

True 

 

Check that :trac:`17295` is fixed:: 

 

sage: k.<s> = QuadraticField(2) 

sage: K.<b> = k.extension(x^2 - 3) 

sage: E = EllipticCurve(k, [-3*s*(4 + 5*s), 2*s*(2 + 14*s + 11*s^2)]) 

sage: Ec = EllipticCurve(k, [3*s*(4 - 5*s), -2*s*(2 - 14*s + 11*s^2)]) 

sage: EK = E.base_extend(K) 

sage: EcK = Ec.base_extend(K) 

sage: EK.is_isogenous(EcK) # long time (about 3.5 s) 

True 

 

""" 

if not is_EllipticCurve(other): 

raise ValueError("Second argument is not an Elliptic Curve.") 

if self.is_isomorphic(other): 

return True 

K = self.base_field() 

if K != other.base_field(): 

raise ValueError("Second argument must be defined over the same number field.") 

 

E1 = self.integral_model() 

E2 = other.integral_model() 

N = E1.conductor() 

if N != E2.conductor(): 

return False 

 

PI = K.primes_of_degree_one_iter() 

while True: 

P = next(PI) 

if P.absolute_norm() > maxnorm: break 

if not P.divides(N): 

if E1.reduction(P).cardinality() != E2.reduction(P).cardinality(): 

return False 

 

if not proof: 

return True 

 

# We first try the easiest cases: primes for which X_0(l) has genus 0: 

 

for l in [2,3,5,7,13]: 

if any([E2.is_isomorphic(f.codomain()) for f in E1.isogenies_prime_degree(l)]): 

return True 

 

# Next we try the primes for which X_0^+(l) has genus 0 for 

# which isogeny-finding is faster than in general: 

 

from .isogeny_small_degree import hyperelliptic_primes 

for l in hyperelliptic_primes: 

if any([E2.is_isomorphic(f.codomain()) for f in E1.isogenies_prime_degree(l)]): 

return True 

 

# Next we try looking modulo some more primes: 

 

while True: 

if P.absolute_norm() > 10*maxnorm: break 

if not P.divides(N): 

OP = K.residue_field(P) 

if E1.change_ring(OP).cardinality() != E2.change_ring(OP).cardinality(): 

return False 

P = next(PI) 

 

# Finally we compute the full isogeny class of E1 and check if 

# E2 is isomorphic to any curve in the class: 

 

return any([E2.is_isomorphic(E3) for E3 in E1.isogeny_class().curves]) 

 

raise NotImplementedError("Curves appear to be isogenous (same conductor, isogenous modulo all primes of norm up to %s), but no isogeny has been constructed." % (10*maxnorm)) 

 

def isogeny_degree(self, other): 

""" 

Returns the minimal degree of an isogeny between self and 

other, or 0 if no isogeny exists. 

 

INPUT: 

 

- ``other`` -- another elliptic curve. 

 

OUTPUT: 

 

(int) The degree of an isogeny from ``self`` to ``other``, or 0. 

 

EXAMPLES:: 

 

sage: x = QQ['x'].0 

sage: F = NumberField(x^2 -2, 's'); F 

Number Field in s with defining polynomial x^2 - 2 

sage: E = EllipticCurve('14a1') 

sage: EE = EllipticCurve('14a2') 

sage: E1 = E.change_ring(F) 

sage: E2 = EE.change_ring(F) 

sage: E1.isogeny_degree(E2) 

2 

sage: E2.isogeny_degree(E2) 

1 

sage: E5 = EllipticCurve('14a5').change_ring(F) 

sage: E1.isogeny_degree(E5) 

6 

 

sage: E = EllipticCurve('11a1') 

sage: [E2.label() for E2 in cremona_curves([11..20]) if E.isogeny_degree(E2)] 

['11a1', '11a2', '11a3'] 

 

sage: K.<i> = QuadraticField(-1) 

sage: E = EllipticCurve([1+i, -i, i, 1, 0]) 

sage: C = E.isogeny_class() 

sage: [E.isogeny_degree(F) for F in C] 

[2, 6, 18, 9, 3, 1] 

""" 

# First deal with some easy cases: 

if self.conductor() != other.conductor(): 

return Integer(0) 

 

if self.is_isomorphic(other): 

return Integer(1) 

 

C = self.isogeny_class() 

i = C.index(self) # may not be 0 since curces are sorted 

try: 

return C.matrix()[i][C.index(other)] 

except ValueError: 

return ZZ(0) 

 

def lll_reduce(self, points, height_matrix=None, precision=None): 

""" 

Returns an LLL-reduced basis from a given basis, with transform 

matrix. 

 

INPUT: 

 

- ``points`` - a list of points on this elliptic 

curve, which should be independent. 

 

- ``height_matrix`` - the height-pairing matrix of 

the points, or ``None``. If ``None``, it will be computed. 

 

- ``precision`` - number of bits of precision of intermediate 

computations (default: ``None``, for default RealField 

precision; ignored if ``height_matrix`` is supplied) 

 

OUTPUT: A tuple (newpoints, U) where U is a unimodular integer 

matrix, new_points is the transform of points by U, such that 

new_points has LLL-reduced height pairing matrix 

 

.. note:: 

 

If the input points are not independent, the output 

depends on the undocumented behaviour of PARI's 

``qflllgram()`` function when applied to a gram matrix which 

is not positive definite. 

 

EXAMPLES: 

 

Some examples over `\QQ`:: 

 

sage: E = EllipticCurve([0, 1, 1, -2, 42]) 

sage: Pi = E.gens(); Pi 

[(-4 : 1 : 1), (-3 : 5 : 1), (-11/4 : 43/8 : 1), (-2 : 6 : 1)] 

sage: Qi, U = E.lll_reduce(Pi) 

sage: all(sum(U[i,j]*Pi[i] for i in range(4)) == Qi[j] for j in range(4)) 

True 

sage: sorted(Qi) 

[(-4 : 1 : 1), (-3 : 5 : 1), (-2 : 6 : 1), (0 : 6 : 1)] 

sage: U.det() 

1 

sage: E.regulator_of_points(Pi) 

4.59088036960573 

sage: E.regulator_of_points(Qi) 

4.59088036960574 

 

:: 

 

sage: E = EllipticCurve([1,0,1,-120039822036992245303534619191166796374,504224992484910670010801799168082726759443756222911415116]) 

sage: xi = [2005024558054813068,\ 

-4690836759490453344,\ 

4700156326649806635,\ 

6785546256295273860,\ 

6823803569166584943,\ 

7788809602110240789,\ 

27385442304350994620556,\ 

54284682060285253719/4,\ 

-94200235260395075139/25,\ 

-3463661055331841724647/576,\ 

-6684065934033506970637/676,\ 

-956077386192640344198/2209,\ 

-27067471797013364392578/2809,\ 

-25538866857137199063309/3721,\ 

-1026325011760259051894331/108241,\ 

9351361230729481250627334/1366561,\ 

10100878635879432897339615/1423249,\ 

11499655868211022625340735/17522596,\ 

110352253665081002517811734/21353641,\ 

414280096426033094143668538257/285204544,\ 

36101712290699828042930087436/4098432361,\ 

45442463408503524215460183165/5424617104,\ 

983886013344700707678587482584/141566320009,\ 

1124614335716851053281176544216033/152487126016] 

sage: points = [E.lift_x(x) for x in xi] 

sage: newpoints, U = E.lll_reduce(points) # long time (35s on sage.math, 2011) 

sage: [P[0] for P in newpoints] # long time 

[6823803569166584943, 5949539878899294213, 2005024558054813068, 5864879778877955778, 23955263915878682727/4, 5922188321411938518, 5286988283823825378, 175620639884534615751/25, -11451575907286171572, 3502708072571012181, 1500143935183238709184/225, 27180522378120223419/4, -5811874164190604461581/625, 26807786527159569093, 7404442636649562303, 475656155255883588, 265757454726766017891/49, 7272142121019825303, 50628679173833693415/4, 6951643522366348968, 6842515151518070703, 111593750389650846885/16, 2607467890531740394315/9, -1829928525835506297] 

 

An example to show the explicit use of the height pairing matrix:: 

 

sage: E = EllipticCurve([0, 1, 1, -2, 42]) 

sage: Pi = E.gens() 

sage: H = E.height_pairing_matrix(Pi,3) 

sage: E.lll_reduce(Pi,height_matrix=H) 

( 

[1 0 0 1] 

[0 1 0 1] 

[0 0 0 1] 

[(-4 : 1 : 1), (-3 : 5 : 1), (-2 : 6 : 1), (1 : -7 : 1)], [0 0 1 1] 

) 

 

Some examples over number fields (see :trac:`9411`):: 

 

sage: K.<a> = QuadraticField(-23, 'a') 

sage: E = EllipticCurve(K, [0,0,1,-1,0]) 

sage: P = E(-2,-(a+1)/2) 

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] 

) 

 

:: 

 

sage: K.<a> = QuadraticField(-5) 

sage: E = EllipticCurve(K,[0,a]) 

sage: points = [E.point([-211/841*a - 6044/841,-209584/24389*a + 53634/24389]),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] 

) 

""" 

r = len(points) 

if height_matrix is None: 

height_matrix = self.height_pairing_matrix(points, precision) 

U = height_matrix.__pari__().lllgram().sage() 

new_points = [sum([U[j, i]*points[j] for j in range(r)]) 

for i in range(r)] 

return new_points, U 

 

def galois_representation(self): 

r""" 

The compatible family of the Galois representation 

attached to this elliptic curve. 

 

Given an elliptic curve `E` over a number field `K` 

and a rational prime number `p`, the `p^n`-torsion 

`E[p^n]` points of `E` is a representation of the 

absolute Galois group of `K`. As `n` varies 

we obtain the Tate module `T_p E` which is a 

a representation of `G_K` on a free `\ZZ_p`-module 

of rank `2`. As `p` varies the representations 

are compatible. 

 

EXAMPLES:: 

 

sage: K = NumberField(x**2 + 1, 'a') 

sage: E = EllipticCurve('11a1').change_ring(K) 

sage: rho = E.galois_representation() 

sage: rho 

Compatible family of Galois representations associated to the Elliptic Curve defined by y^2 + y = x^3 + (-1)*x^2 + (-10)*x + (-20) over Number Field in a with defining polynomial x^2 + 1 

sage: rho.is_surjective(3) 

True 

sage: rho.is_surjective(5) # long time (4s on sage.math, 2014) 

False 

sage: rho.non_surjective() 

[5] 

""" 

from .gal_reps_number_field import GaloisRepresentation 

return GaloisRepresentation(self) 

 

@cached_method 

def cm_discriminant(self): 

""" 

Returns the CM discriminant of the `j`-invariant of this curve, or 0. 

 

OUTPUT: 

 

An integer `D` which is either `0` if this curve `E` does not 

have Complex Multiplication) (CM), or an imaginary quadratic 

discriminant if `j(E)` is the `j`-invariant of the order with 

discriminant `D`. 

 

.. note:: 

 

If `E` has CM but the discriminant `D` is not a square in 

the base field `K` then the extra endomorphisms will not be 

defined over `K`. See also :meth:`has_rational_cm`. 

 

EXAMPLES:: 

 

sage: EllipticCurve(j=0).cm_discriminant() 

-3 

sage: EllipticCurve(j=1).cm_discriminant() 

Traceback (most recent call last): 

... 

ValueError: Elliptic Curve defined by y^2 + x*y = x^3 + 36*x + 3455 over Rational Field does not have CM 

sage: EllipticCurve(j=1728).cm_discriminant() 

-4 

sage: EllipticCurve(j=8000).cm_discriminant() 

-8 

sage: K.<a> = QuadraticField(5) 

sage: EllipticCurve(j=282880*a + 632000).cm_discriminant() 

-20 

sage: K.<a> = NumberField(x^3 - 2) 

sage: EllipticCurve(j=31710790944000*a^2 + 39953093016000*a + 50337742902000).cm_discriminant() 

-108 

""" 

from sage.schemes.elliptic_curves.cm import is_cm_j_invariant 

flag, df = is_cm_j_invariant(self.j_invariant()) 

if flag: 

d, f = df 

return d*f**2 

else: # no CM 

return ZZ(0) 

 

@cached_method 

def has_cm(self): 

""" 

Returns whether or not this curve has a CM `j`-invariant. 

 

OUTPUT: 

 

``True`` if this curve has CM over the algebraic closure 

of the base field, otherwise ``False``. See also 

:meth:`cm_discriminant()` and :meth:`has_rational_cm`. 

 

.. note:: 

 

Even if `E` has CM in this sense (that its `j`-invariant is 

a CM `j`-invariant), if the associated negative 

discriminant `D` is not a square in the base field `K`, the 

extra endomorphisms will not be defined over `K`. See also 

the method :meth:`has_rational_cm` which tests whether `E` 

has extra endomorphisms defined over `K` or a given 

extension of `K`. 

 

EXAMPLES:: 

 

sage: EllipticCurve(j=0).has_cm() 

True 

sage: EllipticCurve(j=1).has_cm() 

False 

sage: EllipticCurve(j=1728).has_cm() 

True 

sage: EllipticCurve(j=8000).has_cm() 

True 

sage: K.<a> = QuadraticField(5) 

sage: EllipticCurve(j=282880*a + 632000).has_cm() 

True 

sage: K.<a> = NumberField(x^3 - 2) 

sage: EllipticCurve(j=31710790944000*a^2 + 39953093016000*a + 50337742902000).has_cm() 

True 

""" 

return not self.cm_discriminant().is_zero() 

 

@cached_method 

def has_rational_cm(self, field=None): 

""" 

Returns whether or not this curve has CM defined over its 

base field or a given extension. 

 

INPUT: 

 

- ``field`` -- a field, which should be an extension of the 

base field of the curve. If ``field`` is ``None`` (the 

default), it is taken to be the base field of the curve. 

 

OUTPUT: 

 

``True`` if the ring of endomorphisms of this curve over 

the given field is larger than `\ZZ`; otherwise ``False``. 

See also :meth:`cm_discriminant()` and :meth:`has_cm`. 

 

.. note:: 

 

If `E` has CM but the discriminant `D` is not a square in 

the given field `K` then the extra endomorphisms will not 

be defined over `K`, and this function will return 

``False``. See also :meth:`has_cm`. To obtain the CM 

discriminant, use :meth:`cm_discriminant()`. 

 

EXAMPLES:: 

 

sage: E = EllipticCurve(j=0) 

sage: E.has_cm() 

True 

sage: E.has_rational_cm() 

False 

sage: D = E.cm_discriminant(); D 

-3 

sage: E.has_rational_cm(QuadraticField(D)) 

True 

 

sage: E = EllipticCurve(j=1728) 

sage: E.has_cm() 

True 

sage: E.has_rational_cm() 

False 

sage: D = E.cm_discriminant(); D 

-4 

sage: E.has_rational_cm(QuadraticField(D)) 

True 

 

Higher degree examples:: 

 

sage: K.<a> = QuadraticField(5) 

sage: E = EllipticCurve(j=282880*a + 632000) 

sage: E.has_cm() 

True 

sage: E.has_rational_cm() 

False 

sage: E.cm_discriminant() 

-20 

sage: E.has_rational_cm(K.extension(x^2+5,'b')) 

True 

 

An error is raised if a field is given which is not an extension of the base field:: 

 

sage: E.has_rational_cm(QuadraticField(-20)) 

Traceback (most recent call last): 

... 

ValueError: Error in has_rational_cm: Number Field in a with defining polynomial x^2 + 20 is not an extension field of Number Field in a with defining polynomial x^2 - 5 

 

sage: K.<a> = NumberField(x^3 - 2) 

sage: E = EllipticCurve(j=31710790944000*a^2 + 39953093016000*a + 50337742902000) 

sage: E.has_cm() 

True 

sage: E.has_rational_cm() 

False 

sage: D = E.cm_discriminant(); D 

-108 

sage: E.has_rational_cm(K.extension(x^2+108,'b')) 

True 

""" 

D = self.cm_discriminant() 

if D.is_zero(): 

return False 

if field is None: 

return self.base_field()(D).is_square() 

if self.base_field().embeddings(field): 

D = field(D) 

return D.is_square() 

raise ValueError("Error in has_rational_cm: %s is not an extension field of %s" 

% (field,self.base_field())) 

 

 

def saturation(self, points, verbose=False, 

max_prime=0, one_prime=0, odd_primes_only=False, 

lower_ht_bound=None, reg=None, debug=False): 

r""" 

Given a list of rational points on `E` over `K`, compute the 

saturation in `E(K)` of the subgroup they generate. 

 

INPUT: 

 

- ``points (list)`` - list of points on E. Points of finite 

order are ignored; the remaining points should be independent, 

or an error is raised. 

 

- ``verbose`` (bool) - (default: ``False``), if ``True``, give 

verbose output. 

 

- ``max_prime`` (int, default 0), saturation is performed 

for all primes up to ``max_prime``. If ``max_prime`` is 0, 

perform saturation at *all* primes, i.e., compute the true 

saturation. 

 

- ``odd_primes_only`` (bool, default ``False``) -- only do 

saturation at odd primes. 

 

- ``one_prime`` (int, default 0) -- if nonzero, only do 

saturation at this prime. 

 

The following two inputs are optional, and may be provided to speed 

up the computation. 

 

- ``lower_ht_bound`` (real, default ``None``) -- lower bound of 

the regulator `E(K)`, if known. 

 

- ``reg`` (real, default ``None``), regulator of the span of 

points, if known. 

 

- ``debug`` (int, default 0) -- , used for debugging and 

testing. 

 

OUTPUT: 

 

- ``saturation`` (list) - points that form a basis for the 

saturation. 

 

- ``index`` (int) - the index of the group generated by the 

input points in their saturation. 

 

- ``regulator`` (real with default precision, or ``None``) - 

regulator of saturated points. 

 

EXAMPLES:: 

 

sage: K.<i> = QuadraticField(-1) 

sage: E = EllipticCurve('389a1') 

sage: EK = E.change_ring(K) 

sage: P = EK(-1,1); Q = EK(0,-1) 

 

sage: EK.saturation([2*P], max_prime=2) 

([(-1 : 1 : 1)], 2, 0.686667083305587) 

sage: EK.saturation([12*P], max_prime=2) 

([(26/361 : -5720/6859 : 1)], 4, 6.18000374975028) 

sage: EK.saturation([12*P], lower_ht_bound=0.1) 

([(-1 : 1 : 1)], 12, 0.686667083305587) 

sage: EK.saturation([2*P, Q], max_prime=2) 

([(-1 : 1 : 1), (0 : -1 : 1)], 2, 0.152460177943144) 

sage: EK.saturation([P+Q, P-Q], lower_ht_bound=.1, debug=2) 

([(-1 : 1 : 1), (1 : 0 : 1)], 2, 0.152460177943144) 

sage: EK.saturation([P+Q, 17*Q], lower_ht_bound=0.1) 

([(4 : 8 : 1), (0 : -1 : 1)], 17, 0.152460177943143) 

 

sage: R = EK(i-2,-i-3) 

sage: EK.saturation([P+R, P+Q, Q+R], lower_ht_bound=0.1) 

([(841/1369*i - 171/1369 : 41334/50653*i - 74525/50653 : 1), 

(4 : 8 : 1), 

(-1/25*i + 18/25 : -69/125*i - 58/125 : 1)], 

2, 

0.103174443217351) 

sage: EK.saturation([26*Q], lower_ht_bound=0.1) 

([(0 : -1 : 1)], 26, 0.327000773651605) 

 

Another number field:: 

 

sage: E = EllipticCurve('389a1') 

sage: K.<a> = NumberField(x^3-x+1) 

sage: EK = E.change_ring(K) 

sage: P = EK(-1,1); Q = EK(0,-1) 

sage: EK.saturation([P+Q, P-Q], lower_ht_bound=0.1) 

([(-1 : 1 : 1), (1 : 0 : 1)], 2, 0.152460177943144) 

sage: EK.saturation([3*P, P+5*Q], lower_ht_bound=0.1) 

([(-185/2209 : -119510/103823 : 1), (80041/34225 : -26714961/6331625 : 1)], 

15, 

0.152460177943144) 

 

A different curve:: 

 

sage: K.<a> = QuadraticField(3) 

sage: E = EllipticCurve('37a1') 

sage: EK = E.change_ring(K) 

sage: P = EK(0,0); Q = EK(2-a,2*a-4) 

sage: EK.saturation([3*P-Q, 3*P+Q], lower_ht_bound=.01) 

([(0 : 0 : 1), (1/2*a : -1/4*a - 1/4 : 1)], 6, 0.0317814530725985) 

 

The points must be linearly independent:: 

 

sage: EK.saturation([2*P, 3*Q, P-Q]) 

Traceback (most recent call last): 

... 

ValueError: points not linearly independent in saturation() 

 

Degenerate case:: 

 

sage: EK.saturation([]) 

([], 1, 1.00000000000000) 

 

ALGORITHM: 

 

For rank 1 subgroups, simply do trial division up to the maximal 

prime divisor. For higher rank subgroups, perform trial division 

on all linear combinations for small primes, and look for 

projections `E(K) \rightarrow \oplus E(k) \otimes \mathbf{F}_p` which 

are either full rank or provide `p`-divisible linear combinations, 

where the `k` here are residue fields of `K`. 

 

TESTS:: 

 

sage: K.<i> = QuadraticField(-1) 

sage: E = EllipticCurve('389a1') 

sage: EK = E.change_ring(K) 

sage: P = EK(-1,1); Q = EK(0,-1) 

 

sage: EK.saturation([P+Q, P-Q], lower_ht_bound=.1, debug=2) 

([(-1 : 1 : 1), (1 : 0 : 1)], 2, 0.152460177943144) 

sage: EK.saturation([5*P+6*Q, 5*P-3*Q], lower_ht_bound=.1) 

([(-3/4 : -15/8 : 1), (159965/16129 : -67536260/2048383 : 1)], 

45, 

0.152460177943144) 

sage: EK.saturation([5*P+6*Q, 5*P-3*Q], lower_ht_bound=.1, debug=2) 

([(-3/4 : -15/8 : 1), (159965/16129 : -67536260/2048383 : 1)], 

45, 

0.152460177943144) 

""" 

full_saturation = (max_prime == 0) and (one_prime == 0) 

Plist = [self(P) for P in points] 

Plist = [P for P in points if P.has_infinite_order()] 

n = len(Plist) 

index = ZZ(1) 

 

if n == 0: 

return Plist, index, RealField()(1) 

 

 

# compute the list of primes p at which p-saturation is 

# required. 

 

heights = [P.height() for P in Plist] 

if reg is None: 

reg = self.regulator_of_points(Plist) 

if reg / min(heights) < 1e-6: 

raise ValueError("points not linearly independent in saturation()") 

sat_reg = reg 

 

from sage.rings.all import prime_range 

if full_saturation: 

if lower_ht_bound is None: 

# TODO (robertb): verify this for rank > 1 

if verbose: 

print("Computing lower height bound..") 

lower_ht_bound = self.height_function().min(.1, 5) ** n 

if verbose: 

print("..done: %s" % lower_ht_bound) 

index_bound = (reg/lower_ht_bound).sqrt() 

prime_list = prime_range(index_bound.ceil() + 1) 

if verbose: 

print("Testing primes up to %s" % prime_list[-1]) 

else: 

if one_prime: 

prime_list = [one_prime] 

else: 

prime_list = prime_range(max_prime+1) 

if odd_primes_only and 2 in prime_list: 

prime_list.remove(2) 

 

# Now saturate at each prime in prime_list. The dict 

# lin_combs keeps the values of linear combinations of the 

# points, indexed by coefficient tuples, for efficiency; it is 

# rest whenever the point list changes. 

 

from sage.schemes.elliptic_curves.saturation import full_p_saturation 

lin_combs = dict() 

for p in prime_list: 

if full_saturation and (p > index_bound): break 

if verbose: 

print("Saturating at p=%s" % p) 

newPlist, expo = full_p_saturation(Plist, p, lin_combs, verbose) 

if expo: 

if verbose: 

print(" --gaining index %s^%s" % (p,expo)) 

pe = p**expo 

index *= pe 

if full_saturation: index_bound /= pe 

sat_reg /= pe**2 

Plist = newPlist 

else: 

if verbose: 

print(" --already %s-saturated" % p) 

 

return Plist, index, sat_reg 

 

 

def gens_quadratic(self, **kwds): 

""" 

Return generators for the Mordell-Weil group modulo torsion, for a 

curve which is a base change from `\QQ` to a quadratic field. 

 

EXAMPLES:: 

 

sage: E = EllipticCurve([1,2,3,40,50]) 

sage: E.conductor() 

2123582 

sage: E.gens() 

[(5 : 17 : 1)] 

sage: K.<i> = QuadraticField(-1) 

sage: EK = E.change_ring(K) 

sage: EK.gens_quadratic() 

[(5 : 17 : 1), (-13 : 48*i + 5 : 1)] 

 

sage: E.change_ring(QuadraticField(3, 'a')).gens_quadratic() 

[(5 : 17 : 1), (-1 : 2*a - 1 : 1), (11/4 : 33/4*a - 23/8 : 1)] 

 

sage: K.<a> = QuadraticField(-7) 

sage: E = EllipticCurve([0,0,0,197,0]) 

sage: E.conductor() 

2483776 

sage: E.gens() 

[(47995604297578081/7389879786648100 : -25038161802544048018837479/635266655830129794121000 : 1)] 

sage: K.<a> = QuadraticField(7) 

sage: E.change_ring(K).gens_quadratic() 

[(-1209642055/59583566*a + 1639995844/29791783 : -377240626321899/1720892553212*a + 138577803462855/245841793316 : 1), 

(1/28 : 393/392*a : 1), 

(-61*a + 162 : 1098*a - 2916 : 1)] 

 

sage: E = EllipticCurve([1, a]) 

sage: E.gens_quadratic() 

Traceback (most recent call last): 

... 

ValueError: gens_quadratic() requires the elliptic curve to be a base change from Q 

 

""" 

if not kwds: 

try: 

return list(self.__gens) 

except AttributeError: 

pass 

 

K = self.base_ring() 

if K.absolute_degree() != 2: 

raise ValueError("gens_quadratic() requires the base field to be quadratic") 

 

EE = self.descend_to(QQ) 

if not EE: 

raise ValueError("gens_quadratic() requires the elliptic curve to be a base change from Q") 

 

# In all cases there are exactly two distinct curves /Q whose 

# base-change to K is the original. NB These need not be 

# quadratic twists of each other! For example, '32a1' and 

# '32a2' are not quadratic twists of each other (each is its 

# own twist by -1) but they become isomorphic over 

# Q(sqrt(-1)). 

 

EQ1 = EE[0] 

EQ2 = EE[1] 

iso1 = EQ1.change_ring(K).isomorphism_to(self) 

iso2 = EQ2.change_ring(K).isomorphism_to(self) 

gens1 = [iso1(P) for P in EQ1.gens(**kwds)] 

gens2 = [iso2(P) for P in EQ2.gens(**kwds)] 

gens = self.saturation(gens1+gens2, max_prime=2)[0] 

self.__gens = gens 

return gens