Download A Tutorial for Pari/GP

Transcript
u = nfbasistoalg(nf, u)
The last line recovers the unit as an algebraic number. Type
ch = charpoly(u)
and we obtain the characteristic polynomial ch of u again. (Whose constant coefficient is 1, hence
u is indeed a unit.)
There is of course no reason for u to be a fundamental unit. Let us see if it is a square. Type
F = factor(subst(ch, x, x^2))
We see that ch(x^2) is a product of 2 polynomials of degree 4, hence u is a square. (Why?) We
now want to find its square root. A simple method is as follows:
NF = subst(nf,x,y);
r = F[1,1] % (x^2 - nfbasistoalg(NF, u))
to find the remainder of the characteristic polynomial of u2 divided by x^2 - u. This is a polynomial of degree 1 in x, with polmod coefficients, and we know that u2, being a root of both
polynomials, is the root of r, hence can be obtained by typing
u2 = -polcoeff(r,0) / polcoeff(r,1)
There is an important technicality in the above: why did we need to substitute NF to nf ? The
reason is that data related to nf is given in terms of the variable x, seen modulo nf.pol; but we
need x as a free variable for our polynomial divisions. Hence the substitution of x by y in our nf
data.
The most natural method is to try directly
nffactor(nf, y^2 - u)
Except that this won’t work for the same technical reason as above: the main variable of the
polynomial to be factored must have higher priority than the number field variable. This won’t be
possible here since nf was defined using the variable x which has the highest possible priority. So
we need to substitute variables around:
nffactor(NF, x^2 - nfbasistoalg(NF, subst(lift(u),x,y)))
(Of course, with better planning, we would just have defined nf in terms of the ’y variable, to
avoid all these substitutions.)
A much simpler approach is to consider the above as instances of a discrete logarithm problem,
where we want to express some elements an abelian group (of finite type) in terms of explicitly given
generators, and transfer all computations from abstract groups like Cl(K) and Z∗K to products of
simpler groups like Zn or Z/dZ. We shall do exactly that in the next section.
Before that, let us mention another famous (but in fact, simpler) discrete logarithm problem,
namely the one associated to the invertible elements modulo an ideal: (ZK /I)∗ . Just use idealstar
(this is an init function) and ideallog.
Many more functions on ideals are available. We mention here the complete list, referring to
Chapter 3 for detailed explanations:
idealadd, idealaddtoone, idealappr, idealchinese, idealcoprime, idealdiv, idealfactor, idealhnf, idealintersect, idealinv, ideallist, ideallog, idealmin, idealmul, idealnorm, idealpow, idealprimedec, idealred, idealstar, idealtwoelt, idealval, nfisideal.
40