Skip to content

Commit

Permalink
added another way to call minimalPolynomial
Browse files Browse the repository at this point in the history
  • Loading branch information
kschwede committed Jul 10, 2024
1 parent 8006988 commit 52b973c
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
8 changes: 8 additions & 0 deletions NumberFields/KarlsTestingFile.m2
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,24 @@ restart

loadPackage "NumberFields"
S = QQ[a,b,c]/ideal(a^3-2, a^2+a*b+b^2, sum(apply(11, t->c^t)))
T = QQ[a,b]/ideal(a^3-2, a^2+a*b+b^2)
psi = map(S, T)
R = time numberField(S)
minimalPolynomial( sum gens S)
minimalPolynomial( (gens R)#0)
minimalPolynomial( sum gens R)
minimalPolynomial( c, psi)

time simpleExt(R);
time simpleExt(R, Strategy=>kernel);
time simpleExt(R, Strategy=>null);
time simpleExt(R, Strategy=>minimalPolynomial);

S = QQ[x]/ideal(x^2+1)
T = QQ[y]/ideal(y^4+1)
psi = map(T, S, {y^2})
minimalPolynomial(y, psi)


-----------------
--Karl testing isFieldAutomorphism
Expand Down
33 changes: 33 additions & 0 deletions NumberFields/NumberFields.m2
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,39 @@ minimalPolynomial(RingElement) := opts -> (f1) -> (--we should only compute the
(entries (M1*(gens(kernel(A1)))))#0#0
)

minimalPolynomial(RingElement, RingMap) := opts -> (f1, psi1) -> (--this finds the minimal polynomial of an element f1 in L1, where the second argument is a field extension K1 -> L1
--
R1 := ring f1;
R2 := target psi1;
if not (R1 === R2) then error "minimalPolynomial: expected the target of the map to agree with the ring of the source";
C1 := source psi1;
D := (degree R1)/ (degree C1);
local y;
if (opts.Variable === null) then (y = local xx;) else (y = opts.Variable);
--y := local aa;
S1 := C1[y];
y = (gens S1)#0;
P1 := pushFwd(psi1);
A1 := (P1#2)(1_R1);
curf1 := 1;
pow1 := 1;
--while (gens(kernel(A1))==0) do (
while ((pow1 == 1) and (gens(kernel(A1))==0)) or (D%(pow1-1) != 0) or (gens(kernel(A1))==0) do (
if (debugLevel > 1) then print pow1;
pow1 += 1;
curf1=curf1*f1;
--A1 = A1|(P1#2)(f1^pow1);
A1 = A1|(P1#2)(curf1);
if (pow1 > D+1) then error "minimalPolyommial: something went wrong, is this a field?";
);
pow1 = pow1-1;
M1 := matrix({{1_S1}});
for i1 from 1 to (pow1) do (
M1 |= y^i1;
);
(entries (M1*(gens(kernel(A1)))))#0#0
)

minimalPolynomial(List) := opts -> L1 -> (
apply(L1, i -> minimalPolynomial(i))
)
Expand Down

0 comments on commit 52b973c

Please sign in to comment.