CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

| Download

GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it

Views: 418346
1
bnf = bnfinit(f,1);
2
n = poldegree(f);
3
un = lift(bnf.tufu);
4
r = #un;
5
6
p2v(n,b) = vector(n,j,polcoeff(b,j-1));
7
8
\\print units
9
print("[[ ");
10
for(i=1,#un, print(p2v(n,un[i]),","));
11
print("],\n");
12
13
\\print exponents
14
print("[ ");
15
{
16
for(i=1,#elms-1,
17
c = bnfisunit(bnf, Polrev(elms[i]));
18
if (#c==0, error("element must be a unit"));
19
c = vector(r,j,if(j==1,lift(c[r]),c[j-1]));
20
print(c,",");
21
);
22
}
23
print("],\n");
24
25
\\ get the rank of the group
26
rank=bnf.tu[1];
27
28
print(rank,"];");
29
30