default(realprecision,38);
K=bnfinit(x^3-x-1);
subgrouplist(bnrinit(K,10))
K=bnrinit(K,20);
default(realprecision,77);
nfnewprec(K);
default(realprecision,38);
subgrouplist(K)
subgrouplist(K, 2)
subgrouplist(K, 2, 1)
bnrconductor(bnfinit(K),4,Mat(3))

Qi = bnfinit(x^2+1);
bnrL1(bnrinit(Qi,10,1),1);
bnrisconductor(bnrinit(Qi,x-5),[1])
setrand(5);bnrL1(bnrinit(bnfinit(y^2+6),1,1),0);
bnrL1(bnrinit(bnfinit(x),[5,[1]]));
\\ #1399
bnrdisc(bnfinit(y^2+1), 12)

setrand(1);bnf=bnfinit(x^2-x-57);
test(m)=
{
  print(bnrisconductor(bnf,m), ", ", bnrclassno(bnf,m), ", ", bnrdisc(bnf,m));
}
test([[25,13;0,1],[1,1]])
test([[25,13;0,1],[1,0]])
test([[5,3;0,1],[1,0]])
test([5,3;0,1])

m=[idealfactor(bnf,[5,3;0,1]),[1,0]];
H=Mat(2);
bnr=bnrinit(bnf, idealstar(bnf,m,2));
f=[bnrclassno,bnrdisc,bnrconductor];
{
for (i=1,#f,
  print(f[i](bnr));
  print(f[i](bnr,H));
  print(f[i](bnf,m));
  print(f[i](bnf,m,H));
)
}
bnrdisc(bnf,m,H,1)
bnrdisc(bnf,m,H,2)
bnrdisc(bnf,m,H,3)
bnrdisc(bnf,[5,3;0,1],H,2)
bnrdisc(bnf,[5,3;0,1],H,3)
bnrclassno(bnf, idealprimedec(bnf,5)[1])

bnr=bnrinit(bnf,[7,[1,1]]);
bnrclassno(bnf,[7,Vecsmall([1,2])])
bnrclassno(bnf,[7,Vecsmall([1])])
bnrclassno(bnf,[7,Vecsmall([2])])
bnrclassno(bnf,[7,Vecsmall([])])
bnrclassno(bnf,[7,Vecsmall([1,2,3])])
bnrrootnumber(bnr, [2,1])
bnrrootnumber(bnr, [0,0])
bnrconductor(bnr,[0,0])
chi=[1,0];
bnrconductor(bnr,chi)
charorder(bnf,[1])
chareval(bnf,[1], idealprimedec(bnf,3)[1])
charorder(bnr,chi)
chareval(bnr,chi,2)
chareval(bnr,chi,1/7)
chareval(bnr,chi,x+1)
chareval(1,chi,1)
L=idealprimedec(bnf,3);
bnr=bnrinit(bnf,[L[1],[1,1]]);
chi=[3];
chareval(bnr,chi,1)
chareval(bnr,chi,L[1].gen[2])
chareval(bnr,chi,L[2].gen[2])

bnr=bnrinit(bnfinit(x^2-97),1); bnrrootnumber(bnr,[])

narrow(T)=bnfnarrow(bnfinit(T));
narrow(x^2-460)
narrow(x^6-x^5-12*x^4+5*x^3+23*x^2-6*x-9)
narrow(x^2-9004)
narrow(x^2-7980)

\\#1804
K=bnfinit(y^2-5);
bnr = bnrinit(K,[1,[1,1]]);
bnrdisc(bnr)
bnrdisc(bnr,,,1)
bnrdisc(bnr,,,2)
bnrdisc(K,[1,[1,0]],,2)
bnrdisc(K,[1,[0,0]],,2)
ideallog(K,1/2,idealstar(K,[1,[1,1]]))

setrand(1);
F = bnfinit(x^3-3);
f = idealmul(F, idealprimedec(F,3)[1], 5);
bnr = bnrinit(F, [f, [1]]);
C = bnr.cyc;
forvec(c = vector(#C,i,[0,C[i]-1]), print(bnrrootnumber(bnr,c)))

bnf=bnfinit(x^2+69);
id = [9,0;0,3];
bnrinit(bnf,id,1).clgp

bnf=bnfinit(x^2-x+6);bnr=bnrinit(bnf,[29,18;0,1],1);
bnrisprincipal(bnr,1)
bnrinit(bnf,idealfactor(bnf,1)).no \\ #1890

bnf=bnfinit(x^2-486);
P2 = idealprimedec(bnf,2)[1];
P3 = idealprimedec(bnf,3)[1];
bnrinit(bnf, [[P2,1;P3,15],[1,1]], 1);
