Initialise a number field assigning a polynomial (in this setting one can compute the norm a the trace of an element)
K=nfinit( polynomial);

Initialise a number field assigning a polynomial (“b” stands for Buchman algorithm. In this setting one can compute the class number of K)
K=bnfinit(polynomial);

The polynomial
K.pol

The signature r_1, r_2
K.sign

The discriminant
K.disc 

The ring of integers (generators)
K.zk

The class number 
K.no

The torsion units \mu_F ( output [group order, generator])
K.tu

The fundamental unit
K.fu

Example

f=x^4-2;
K=bnfinit(f);
K.pol
K.sign
K.zk
K.disc
K.no
K.tu
K.fu

? f=x^4-2;
? K=bnfinit(f);
? K.pol
%3 = x^4 - 2
? K.sign
%4 = [2, 1]
? K.zk
%5 = [1, x, x^2, x^3]
? K.disc
%6 = -2048
? K.no
%7 = 1
? K.tu
%8 = [2, -1]
? K.fu
%9 = [Mod(-x^2 + 1, x^4 - 2), Mod(x + 1, x^4 - 2)]

 
1) To determine the roots of a polynomial  f  in  Q[x] 
f=polynomial
polroots(f)
polroots(f)[1]

Example:
f=x^3+6*x^2-4*x+3
 polroots(x^3+6*x^2-4*x+3)
a1= polroots(f)[1]
a2=polroots(f)[2]
a3=polroots(f)[3]

? f=x^3+6*x^2-4*x+3
%9 = x^3 + 6*x^2 - 4*x + 3
?  polroots(x^3+6*x^2-4*x+3)
%10 = [-6.6674172575288525574899973418350112263 + 0.E-38*I, 0.33370862876442627874499867091750561314 - 0.58188305690114089007242562168673020760*I, 0.33370862876442627874499867091750561314 + 0.58188305690114089007242562168673020760*I]~
? a1= polroots(f)[1]
%11 = -6.6674172575288525574899973418350112263 + 0.E-38*I
? a2=polroots(f)[2]
%12 = 0.33370862876442627874499867091750561314 - 0.58188305690114089007242562168673020760*I
? a3=polroots(f)[3]
%13 = 0.33370862876442627874499867091750561314 + 0.58188305690114089007242562168673020760*I

 
1) To factor the ideals  (p) generated  by  primes  p  less or equal than  m 
(For determining the prime ideals which generate the class group of the number field associated to the polynomial f)
 
f=polynomial
pols(m)=forprime(p=2,m,print([p,lift(factormod(f,p))]))

Example:
f=x^3+6*x^2-4*x+3

 pols(40)
[2, [x + 1, 1; x^2 + x + 1, 1]]
[3, [x, 1; x + 1, 1; x + 2, 1]]
[5, Mat([x^3 + x^2 + x + 3, 1])]
[7, [x + 3, 1; x^2 + 3*x + 1, 1]]
[11, Mat([x^3 + 6*x^2 + 7*x + 3, 1])]
[13, Mat([x^3 + 6*x^2 + 9*x + 3, 1])]
[17, [x + 4, 1; x + 9, 1; x + 10, 1]]
[19, Mat([x^3 + 6*x^2 + 15*x + 3, 1])]
[23, Mat([x^3 + 6*x^2 + 19*x + 3, 1])]
[29, Mat([x^3 + 6*x^2 + 25*x + 3, 1])]
[31, [x + 8, 1; x + 11, 1; x + 18, 1]]
[37, [x + 17, 1; x^2 + 26*x + 35, 1]]

2) to get  relations in Cl(O_F) factor the principal ideals (k\alpha-m), for k,m integers in  some range [-m,m]
compute and factor the norm  N(k\alpha-m) of the generator k\alpha-m, factor it.

list(b)=for(k=1,b,for(m=-b,b,if(gcd(k,m)==1,print(["k=", k,"m=", m, "Norm(k*\alpha-m)=", factor(k^3*subst(f,x,m/k))]))))

e.g. $f=x^3+6*x^2-4*x+3$
? list(5)
["k=", 1, "m=", -5, "Norm(k*alpha-m)=", [2, 4; 3, 1]]
["k=", 1, "m=", -4, "Norm(k*alpha-m)=", [3, 1; 17, 1]]
["k=", 1, "m=", -3, "Norm(k*alpha-m)=", [2, 1; 3, 1; 7, 1]]
["k=", 1, "m=", -2, "Norm(k*alpha-m)=", Mat([3, 3])]
["k=", 1, "m=", -1, "Norm(k*alpha-m)=", [2, 2; 3, 1]]
["k=", 1, "m=", 0, "Norm(k*alpha-m)=", Mat([3, 1])]
["k=", 1, "m=", 1, "Norm(k*alpha-m)=", [2, 1; 3, 1]]
["k=", 1, "m=", 2, "Norm(k*alpha-m)=", Mat([3, 3])]
["k=", 1, "m=", 3, "Norm(k*alpha-m)=", [2, 3; 3, 2]]
["k=", 1, "m=", 4, "Norm(k*alpha-m)=", [3, 1; 7, 2]]
["k=", 1, "m=", 5, "Norm(k*alpha-m)=", [2, 1; 3, 1; 43, 1]]
["k=", 2, "m=", -5, "Norm(k*alpha-m)=", [3, 2; 31, 1]]
["k=", 2, "m=", -3, "Norm(k*alpha-m)=", [3, 2; 17, 1]]
["k=", 2, "m=", -1, "Norm(k*alpha-m)=", [3, 1; 17, 1]]
["k=", 2, "m=", 1, "Norm(k*alpha-m)=", [3, 1; 7, 1]]
["k=", 2, "m=", 3, "Norm(k*alpha-m)=", [3, 1; 37, 1]]
["k=", 2, "m=", 5, "Norm(k*alpha-m)=", [3, 2; 41, 1]]
["k=", 3, "m=", -5, "Norm(k*alpha-m)=", [2, 1; 293, 1]]
["k=", 3, "m=", -4, "Norm(k*alpha-m)=", Mat([449, 1])]
["k=", 3, "m=", -2, "Norm(k*alpha-m)=", [7, 1; 31, 1]]
["k=", 3, "m=", -1, "Norm(k*alpha-m)=", [2, 1; 67, 1]]
["k=", 3, "m=", 1, "Norm(k*alpha-m)=", Mat([2, 6])]
["k=", 3, "m=", 2, "Norm(k*alpha-m)=", Mat([89, 1])]
["k=", 3, "m=", 4, "Norm(k*alpha-m)=", Mat([17, 2])]
["k=", 3, "m=", 5, "Norm(k*alpha-m)=", [2, 2; 7, 1; 17, 1]]
["k=", 4, "m=", -5, "Norm(k*alpha-m)=", [3, 1; 7, 1; 47, 1]]
["k=", 4, "m=", -3, "Norm(k*alpha-m)=", [3, 1; 191, 1]]
["k=", 4, "m=", -1, "Norm(k*alpha-m)=", [3, 2; 31, 1]]
["k=", 4, "m=", 1, "Norm(k*alpha-m)=", [3, 2; 17, 1]]
["k=", 4, "m=", 3, "Norm(k*alpha-m)=", Mat([3, 5])]
["k=", 4, "m=", 5, "Norm(k*alpha-m)=", [3, 1; 199, 1]]
["k=", 5, "m=", -4, "Norm(k*alpha-m)=", [3, 1; 397, 1]]
["k=", 5, "m=", -3, "Norm(k*alpha-m)=", [2, 1; 3, 3; 17, 1]]
["k=", 5, "m=", -2, "Norm(k*alpha-m)=", [3, 1; 229, 1]]
["k=", 5, "m=", -1, "Norm(k*alpha-m)=", [2, 3; 3, 2; 7, 1]]
["k=", 5, "m=", 1, "Norm(k*alpha-m)=", [2, 1; 3, 2; 17, 1]]
["k=", 5, "m=", 2, "Norm(k*alpha-m)=", [3, 1; 101, 1]]
["k=", 5, "m=", 3, "Norm(k*alpha-m)=", [2, 2; 3, 1; 31, 1]]
["k=", 5, "m=", 4, "Norm(k*alpha-m)=", [3, 1; 173, 1]]
?