Created
June 26, 2019 14:52
-
-
Save defeo/279ed571ae769b2d488ce2cc542f09a2 to your computer and use it in GitHub Desktop.
An example of using PARI/GP from Sage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"## Calling the gp interpreter" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 12, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"1" | |
] | |
}, | |
"execution_count": 12, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"pari('''\n", | |
"K = bnfinit(x^6 + 76*x^4 + 2*x^3 + 2029*x^2 - 158*x + 18955);\n", | |
"bnfcertify(K);\n", | |
"''')" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 24, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"[6, 6]" | |
] | |
}, | |
"execution_count": 24, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"pari('''\n", | |
"Kr = bnrinit(K, [3, []], 1);\n", | |
"Kr.clgp.cyc;\n", | |
"''')" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 25, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"[[2, 2]~, [8593956863964095388700550617/769301709462933255625, 16098444239429967147468231312/769301709462933255625, -2686156049188005173225574261/769301709462933255625, 2692641749221581785342197419/769301709462933255625, 2782206691257299820849204216/769301709462933255625, -3618028590213142908830485998/769301709462933255625]~]" | |
] | |
}, | |
"execution_count": 25, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"a = pari('''\n", | |
"idealhnf(Kr, 5, x^2 + 2*x + 23);\n", | |
"bnrisprincipal(Kr,J);\n", | |
"''')\n", | |
"a" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"The variable a is a PARI type" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 21, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"<type 'cypari2.gen.Gen'>" | |
] | |
}, | |
"execution_count": 21, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"type(a)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"## Same thing via PARI library calls\n", | |
"\n", | |
"This is maybe cleaner, slightly more efficient, but not very different in its effects.\n", | |
"\n", | |
"We start with standard Sage objects" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"K.<a> = NumberField(x^6 + 76*x^4 + 2*x^3 + 2029*x^2 - 158*x + 18955)\n", | |
"J = K.ideal([5, a^2 + 2*a + 23])" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"note Sage knows something about class groups, at least" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"3" | |
] | |
}, | |
"execution_count": 2, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"G = K.class_group()\n", | |
"G(J).order()" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"You can call any gp function via `pari.<name of gp function>`, Sage does its best to convert parameters in a sensible manner" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 6, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"1" | |
] | |
}, | |
"execution_count": 6, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"pariK = pari.bnfinit(K.polynomial())\n", | |
"pari.bnfcertify(pariK)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"`pariK` is also a PARI type" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 10, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"<type 'cypari2.gen.Gen'>" | |
] | |
}, | |
"execution_count": 10, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"type(pariK)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"You can call gp functions on PARI types as if they were Python objects" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 7, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"[[[3, 0, 1; 0, 3, 2; 0, 0, 2], [2, 1, 0, 1, 2, 0, 1, 1, 0, 1, 0, 2; 1, 1, 1, 0, 1, 2, 2, 0, 1, 1, 0, 2; 0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 0], [0.281199574322962 + 13.9740860569621*I, -9.07777612513027 - 41.6762910670232*I; -0.562399148645924 + 6.28318530717959*I, -0.281199574322962 - 15.7706673382239*I; 0.281199574322962 + 11.1586551717562*I, 9.35897569945323 - 36.8008212024466*I], [-11.6900424554096 + 10.5184010159596*I, -1.68719744593777 + 0.591168704263008*I, -1.27539892142536 + 1.88702548086369*I, -8.54614840745037 + 6.83991646290986*I, -5.98088412377042 + 3.63081432174435*I, 1.47040439891402 + 3.43973985083573*I, -4.65931909663525 + 10.8306872612613*I, -6.20152111409451 + 7.61042869101458*I, 3.46942559064771 + 5.26647304795886*I, -5.19779648365776 + 1.21817360071248*I, 0.000560694623126584 + 7.34941705101257*I, 0, -2.50350347762782 + 2.52227490634191*I, -0.271548554946452 + 8.48675437362347*I, -7.69634283837777 + 0.560161930387458*I; 0.279517490453582 + 4.64461196043556*I, 3.37439489187554 + 9.03746135988073*I, 4.19813088146828 + 7.03484579594384*I, -2.16521256839213 + 2.43207169605654*I, 1.98662381211549 + 2.50643567967366*I, 0.310448286557850 + 3.25540492861449*I, 2.43507903946920 + 4.76208956436836*I, 1.67642503731501 + 5.83972887818970*I, 1.59204101112344 + 2.27275623157548*I, 6.55253493024281 + 4.96681631708016*I, -0.00112138924625317 + 6.28318530717959*I, 0, 3.40308290948730 + 10.0626261745089*I, 0.543097109892904 + 3.01863507762676 E-57*I, 2.26726269181532 + 11.1756376406426*I; 11.4105249649560 + 2.44423591988400*I, -1.68719744593777 + 4.91738340113927*I, -2.92273196004292 + 8.43077105080175*I, 10.7113609758425 + 7.65586426277674*I, 3.99426031165494 + 5.36309808726069*I, -1.78085268547187 + 4.85208225786043*I, 2.22424005716605 + 10.8956604706312*I, 4.52509607677950 + 10.3129733499195*I, -5.06146660177115 + 8.45771698053245*I, -1.35473844658505 + 2.75723471484678*I, 0.000560694623126584 + 5.21695356334661*I, 0, -0.899579431859483 + 12.0700701309865*I, -0.271548554946452 + 4.07961624073571*I, 5.42908014656245 + 8.91711470185336*I], [[17, [0, 0, 1, 1, 0, 0]~, 1, 1, [8, -5, -6, -130, -26, -208; -1, 7, 5, 182, -52, 26; -5, 1, 8, 26, 182, 130; 5, -1, -8, 8, 5, 6; 7, 2, -1, 1, 7, 5; 1, -7, -5, 5, 1, 8]], [3, [2, 0, 0, -1, 0, 0]~, 1, 3, [2, 0, 0, -26, 0, 0; 0, 2, 0, 0, 26, 0; 0, 0, 2, 0, 0, 26; 1, 0, 0, 2, 0, 0; 0, -1, 0, 0, 2, 0; 0, 0, -1, 0, 0, 2]], [7, [2, 0, 1, 1, 0, 0]~, 1, 1, [2, 1, 4, -78, -52, -26; 3, 5, -1, -26, 104, 52; 1, -3, 2, 52, -26, 78; 3, -2, -1, 2, -1, -4; -1, -4, -2, -3, 5, -1; 2, 1, -3, -1, -3, 2]], [5, [-27, -1, 2, 2, 0, -2]~, 1, 2, [-2, 2, 0, -26, -26, 0; -2, -4, -2, -26, 52, 26; 2, 2, -2, 26, -26, 26; 1, -1, 0, -2, -2, 0; -1, -2, -1, 2, -4, -2; 1, 1, -1, -2, 2, -2]], [43, [-14, 0, 1, 1, 0, 0]~, 1, 1, [-16, -7, -12, 390, -520, -572; -5, -21, 7, 52, -442, 520; -7, 5, -16, 520, 52, -390; -15, -20, -22, -16, 7, 12; 2, 17, -20, 5, -21, 7; 20, -2, 15, 7, 5, -16]], [37, [-10, 0, 1, 1, 0, 0]~, 1, 1, [-9, -5, 6, 52, 78, -286; 11, 2, 5, 364, -416, -78; -5, -11, -9, -78, 364, -52; -2, 3, -11, -9, 5, -6; 14, 16, 3, -11, 2, 5; -3, -14, 2, 5, -11, -9]], [5, [0, 0, 1, 1, 0, 0]~, 1, 1, [-1, -2, -3, -52, -26, 26; -1, -2, 2, -52, 104, 26; -2, 1, -1, 26, -52, 52; 2, -1, 1, -1, 2, 3; -2, -4, -1, 1, -2, 2; 1, 2, -2, 2, 1, -1]], [2, [0, 0, -76, -22, 3, 0]~, 2, 3, [0, 0, 0, 0, 0, -26; 0, 0, 0, 26, -26, 0; 0, 0, 0, 0, 26, 0; 0, 0, -1, 0, 0, 0; 1, 1, 0, 0, 0, 0; 0, -1, 0, 0, 0, 0]], [5, [-1, 0, 1, 1, 0, 0]~, 1, 1, [2, -1, 1, 26, -52, -78; 2, 4, 1, 26, -52, 52; -1, -2, 2, 52, 26, -26; -1, -2, -3, 2, 1, -1; 1, 2, -2, -2, 4, 1; 2, -1, 1, 1, -2, 2]], [5, [-24, -1, -1, -1, 0, -2]~, 1, 2, [0, -1, -2, 0, 52, 104; -1, -1, 1, -52, 52, -52; -1, 1, 0, -52, -52, 0; 0, 2, 4, 0, 1, 2; -2, -2, 2, 1, -1, 1; -2, 2, 0, 1, 1, 0]], [17, [-7, 0, 1, 1, 0, 0]~, 1, 1, [-6, 8, 13, -208, -130, -156; 5, -1, -8, 26, 182, 130; 8, -5, -6, 130, 26, 208; 8, -5, -6, -6, -8, -13; 1, -7, -5, -5, -1, -8; 5, -1, -8, -8, -5, -6]], [3, [2, 0, 0, 1, 0, 0]~, 1, 3, [1, 0, 0, -26, 0, 0; 0, 1, 0, 0, 26, 0; 0, 0, 1, 0, 0, 26; 1, 0, 0, 1, 0, 0; 0, -1, 0, 0, 1, 0; 0, 0, -1, 0, 0, 1]], [37, [-1, 0, 1, 1, 0, 0]~, 1, 1, [11, 2, 5, -364, 416, 78; 3, 14, -2, 338, 26, -416; 2, -3, 11, -416, 338, 364; 14, 16, 3, 11, -2, -5; 13, -1, 16, -3, 14, -2; -16, -13, -14, -2, -3, 11]], [7, [8, 0, 1, 1, 0, 0]~, 1, 1, [1, -3, -5, -52, 26, 104; -2, -1, 3, -78, 130, -26; -3, 2, 1, -26, -78, 52; 2, 1, 4, 1, 3, 5; -3, -5, 1, 2, -1, 3; -1, 3, -2, 3, 2, 1]], [43, [-9, 0, 1, 1, 0, 0]~, 1, 1, [8, -18, -37, -364, -260, -286; -19, -11, 18, 26, 338, 260; -18, 19, 8, 260, 26, 364; 14, -10, -11, 8, 18, 37; 1, -13, -10, 19, -11, 18; 10, -1, -14, 18, 19, 8]]], 0, [x^6 + 76*x^4 + 2*x^3 + 2029*x^2 - 158*x + 18955, [0, 3], -595053056, 1190673, [[1, 0.877438833123346 + 0.744861766619744*I, 0.662358978622373 - 0.562279512062301*I, 3.15668145121889 E-57 + 5.09901951359278*I, 3.79806468292327 - 4.47407773208003*I, -2.86707420409910 - 3.37738135699887*I; 1, -0.754877666246693 - 1.89400887073133 E-57*I, -1.32471795724475 - 1.65725776188992 E-57*I, 3.15668145121889 E-58 + 5.09901951359278*I, -1.57834072560945 E-57 + 3.84913595056727*I, -5.99769475731589 E-57 + 6.75476271399773*I; 1, 0.877438833123346 - 0.744861766619744*I, 0.662358978622373 + 0.562279512062301*I, 6.31336290243778 E-58 + 5.09901951359278*I, -3.79806468292327 - 4.47407773208003*I, 2.86707420409910 - 3.37738135699887*I], [1, 1.62230059974309, 0.100079466560072, 5.09901951359278, -0.676013049156756, -6.24445556109797; 1, 0.132577066503602, 1.22463849068467, -5.09901951359278, 8.27214241500330, 0.510307152899763; 1, -0.754877666246693, -1.32471795724475, 5.09901951359278, 3.84913595056727, 6.75476271399773; 1, -0.754877666246693, -1.32471795724475, -5.09901951359278, -3.84913595056727, -6.75476271399773; 1, 0.132577066503602, 1.22463849068467, 5.09901951359278, -8.27214241500330, -0.510307152899763; 1, 1.62230059974309, 0.100079466560072, -5.09901951359278, 0.676013049156756, 6.24445556109797], [1, 2, 0, 5, -1, -6; 1, 0, 1, -5, 8, 1; 1, -1, -1, 5, 4, 7; 1, -1, -1, -5, -4, -7; 1, 0, 1, 5, -8, -1; 1, 2, 0, -5, 1, 6], [6, 2, 0, 0, 0, 0; 2, 2, 6, 0, 0, 0; 0, 6, 4, 0, 0, 0; 0, 0, 0, -156, 52, 0; 0, 0, 0, 52, -52, -156; 0, 0, 0, 0, -156, -104], [1196, 364, 520, 0, 0, 0; 0, 52, 0, 0, 0, 0; 0, 0, 52, 0, 0, 0; 0, 0, 0, 46, 32, 26; 0, 0, 0, 0, 2, 0; 0, 0, 0, 0, 0, 2], [182, 52, -78, 0, 0, 0; 52, -156, 234, 0, 0, 0; -78, 234, -52, 0, 0, 0; 0, 0, 0, -7, 2, -3; 0, 0, 0, 2, 6, -9; 0, 0, 0, -3, -9, 2], [598, [-234, -156, -52, -5460, -4732, -6162; 104, -130, 156, 1430, 4030, 4732; -156, -104, -234, 4732, 1430, 5460; 210, -182, -237, -234, 156, 52; 55, -155, -182, -104, -130, 156; 182, -55, -210, 156, -104, -234]], [2, 13, 23]], [0.662358978622373 + 4.53674000153048*I, -1.32471795724475 + 5.09901951359278*I, 0.662358978622373 + 5.66129902565509*I], [1, 2/132297*x^5 + 420/44099*x^4 + 170/132297*x^3 + 63005/132297*x^2 + 8108/132297*x + 918319/132297, -70/132297*x^5 - 1/132297*x^4 - 5950/132297*x^3 - 75/44099*x^2 - 107384/132297*x + 7006/132297, 70/132297*x^5 + 1/132297*x^4 + 5950/132297*x^3 + 75/44099*x^2 + 239681/132297*x - 7006/132297, -420/44099*x^5 - 6/44099*x^4 - 63001/132297*x^3 - 1350/44099*x^2 - 918635/132297*x + 170207/132297, -1/132297*x^5 - 210/44099*x^4 - 85/132297*x^3 - 97651/132297*x^2 - 4054/132297*x - 2112872/132297], [1, 0, -25, -1, 521, 258; 0, 0, -1, 0, 155, 1; 0, 1, 0, -77, -1, 3121; 0, 1, 0, -23, -4, 421; 0, 0, 0, 3, 0, -255; 0, 0, -2, 0, 100, 5], [1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, -26, 0, 0, 0, 0, 0, 0, 0, -26, 0, 0, 0, 0, -26, -26; 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0, 26, 0, 0, 0, 0, 26, -26, 0, 0, 0, 0, 0, 0, 26; 0, 0, 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 26, 0, 0, 0, 0, 26, 0, 0, 0, 0, 26, 0, 0; 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, -1, 1, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, -1, 0, 0, 0; 0, 0, 0, 0, 1, 0, 0, 0, 0, -1, 1, 0, 0, 0, 0, 0, 0, -1, 0, -1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0; 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0]], [[18, [6, 3], [[21, 9, 15, 17, 12, 6; 0, 3, 0, 0, 1, 0; 0, 0, 3, 0, 0, 1; 0, 0, 0, 1, 0, 0; 0, 0, 0, 0, 1, 0; 0, 0, 0, 0, 0, 1], [3, 0, 0, 1, 0, 0; 0, 3, 0, 0, 2, 0; 0, 0, 3, 0, 0, 2; 0, 0, 0, 1, 0, 0; 0, 0, 0, 0, 1, 0; 0, 0, 0, 0, 0, 1]]], 5.18440676497097, 1, [2, -1], [2/132297*x^5 + 420/44099*x^4 + 170/132297*x^3 + 63005/132297*x^2 + 8108/132297*x + 918319/132297, 9149/132297*x^5 - 13099/132297*x^4 + 380774/132297*x^3 - 320940/44099*x^2 + 4853677/132297*x - 14595194/132297]], [[2, 0, -1; 0, 1, -1], [[5.58159021657356 + 3.11074911838774*I, 6.05143379791295 - 30.6642660471337*I, 3.93425717795600 + 7.20704741327769*I], [0.562399148645924 + 2.81543088520591*I, -1.12479829729185 - 12.5663706143592*I, 0.562399148645924 - 2.81543088520591*I], [-3.99089371764538 - 3.42729270396793*I, 0.198146839069514 + 31.4159265358979*I, -3.99089371764538 + 3.42729270396793*I]], [[-28.4348131051302 + 1.18615366079637*I, -17.8747839032853 + 96.6374101018366*I, -0.392246568912018 - 19.1769063199491*I], [-3.37439489187554 - 7.85512395135471*I, 6.74878978375108 + 46.7365732029582*I, -3.37439489187554 + 13.3636760567570*I]]], [0, [[[-15/17, -30/17, -31/17, -3/17, 6/17, -4/17]~, 2; [136/125, -179/125, 62/125, 23/125, 22/125, -16/125]~, 2; [2, -10, 5, 1, 0, -1]~, 1], Mat([[-1, 0, 0, -1, 0, 0]~, 1])], [-1, [0, 1, 0, 0, 0, 0]~, [35, -8, 31, 0, -9, 5]~]]], [[[3, 0, 0, 0, 0, 0; 0, 3, 0, 0, 0, 0; 0, 0, 3, 0, 0, 0; 0, 0, 0, 3, 0, 0; 0, 0, 0, 0, 3, 0; 0, 0, 0, 0, 0, 3], []], [676, [26, 26], [[-1, 1, -1, -1, 1, -1]~, [1, -1, 1, 0, 1, -1]~]], [[3, [2, 0, 0, -1, 0, 0]~, 1, 3, [2, 0, 0, -26, 0, 0; 0, 2, 0, 0, 26, 0; 0, 0, 2, 0, 0, 26; 1, 0, 0, 2, 0, 0; 0, -1, 0, 0, 2, 0; 0, 0, -1, 0, 0, 2]], 1; [3, [2, 0, 0, 1, 0, 0]~, 1, 3, [1, 0, 0, -26, 0, 0; 0, 1, 0, 0, 26, 0; 0, 0, 1, 0, 0, 26; 1, 0, 0, 1, 0, 0; 0, -1, 0, 0, 1, 0; 0, 0, -1, 0, 0, 1]], 1], [[[[[26], [[0, 2, 4, 0, 0, 0]~], [[-1, 1, -1, -1, 1, -1]~], [Vecsmall([])], 1, [3, 0, 0, 1, 0, 0; 0, 3, 0, 0, 2, 0; 0, 0, 3, 0, 0, 2; 0, 0, 0, 1, 0, 0; 0, 0, 0, 0, 1, 0; 0, 0, 0, 0, 0, 1]]], [[[26], [[1, 1, 2, 0, 0, 0]~], [[1, -1, 1, 0, 1, -1]~], [Vecsmall([])], 1, [3, 0, 0, 2, 0, 0; 0, 3, 0, 0, 1, 0; 0, 0, 3, 0, 0, 1; 0, 0, 0, 1, 0, 0; 0, 0, 0, 0, 1, 0; 0, 0, 0, 0, 0, 1]]]], [[], [], [], Vecsmall([])], Vecsmall([0, 1])], [1, 0; 0, 1]], [[2/3, 0, 0, -1/3, 0, 0]~, [2/3, 0, 0, 1/3, 0, 0]~], [1, 0, 0, 0; 0, -2, -3, 3], [36, [6, 6], [[756685, 1428, 527242, 336868, 552529, 341486; 0, 1, 0, 0, 0, 0; 0, 0, 1, 0, 0, 0; 0, 0, 0, 1, 0, 0; 0, 0, 0, 0, 1, 0; 0, 0, 0, 0, 0, 1], [84371, 15375, 82829, 53987, 8227, 26223; 0, 1, 0, 0, 0, 0; 0, 0, 1, 0, 0, 0; 0, 0, 0, 1, 0, 0; 0, 0, 0, 0, 1, 0; 0, 0, 0, 0, 0, 1]]], [[1, -1; 5, 3; -6, 8], [-2, 1, 1; 0, 13, 0; 0, 0, 13], 2]]" | |
] | |
}, | |
"execution_count": 7, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"bnr = pariK.bnrinit([K.ideal(3), []], 1)\n", | |
"bnr" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 8, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"[5, 0, 3, 2, 0, 1; 0, 5, 3, 0, 3, 1; 0, 0, 1, 0, 0, 0; 0, 0, 0, 1, 0, 0; 0, 0, 0, 0, 1, 0; 0, 0, 0, 0, 0, 1]" | |
] | |
}, | |
"execution_count": 8, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"J = bnr.idealhnf(5, x^2 + 2*x + 23)\n", | |
"J" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 9, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"[[2, 2]~, [13694382894386905565093434/4075835455990312918225, -16053853515884094650630301/4075835455990312918225, 19485717128825304913356678/4075835455990312918225, -1966720964160053605546863/4075835455990312918225, 3087573554179414244498718/4075835455990312918225, -274790244447287320115979/4075835455990312918225]~]" | |
] | |
}, | |
"execution_count": 9, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"bnr.bnrisprincipal(J)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "SageMath 8.1", | |
"language": "", | |
"name": "sagemath" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 2 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython2", | |
"version": "2.7.15rc1" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment