Download A Tutorial for Pari/GP

Transcript
From now on, we forget about T, and use only the polynomial A defining α, and the components
of the vector nf which gives information on our number field K. Type
u = Mod(x^3 - 5*x^2 - 8*x + 56, A) / 7
This is an element in K. There are three equivalent representations for number field elements:
polmod, polynomial, and column vector giving a decomposition in the integral basis nf.zk (not
on the power basis (1, x, x2 , . . .)). All three are equally valid when the number field is understood
(is given as first argument to the function). You will be able to use any one of them as long as
the function you call requires an nf argument as well. However, most PARI functions will return
elements as column vectors. It’s an important feature of number theoretic functions that, although
they may have a preferred format for input, they will accept a wealth of other different formats.
We already saw this for nfinit which accepts either a polynomial or an nf. It will be true for
ideals, congruence subgroups, etc.
Let’s stick with elements for the time being. How does one go from one representation to the
other? Between polynomials and polmods, it’s easy: lift and Mod will do the job. Next, from
polmods/polynomials to column vectors: type v = nfalgtobasis(nf, u). So u = α3 − α2 − α + 8,
right? Wrong! The coordinates of u are given with respect to the integral basis, not the power
basis (1, α, α2 , α3 ) (and they don’t coincide, type nf.zk if you forgot what the integral basis looked
like). As a polynomial in α, we simply have u = 71 (α3 − 5α2 − 8α + 56), which is trivially deduced
from the original polmod representation!
Of course v = nfalgtobasis(nf, lift(u)) would work equally well. Indeed we don’t need
the polmod information since nf already provides the defining polynomial. To go back to polmod
representation, use nfbasistoalg(nf, v). Notice that u is an algebraic integer since v has integer
coordinates (try denominator(v) == 1, which is of course overkill here, but not so in a program).
Let’s try this out. We may for instance compute u^3. Try it. Or, we can type 1/u. Better yet,
if we want to know the norm from K to Q of u, we type norm(u) (what else?); trace(u) works
as well. Notice that none of this would work on polynomials or column vectors since you don’t
have the opportunity to supply nf! But we could use nfeltpow(nf,u,3), nfeltdiv(nf,1,u)
(or nfeltpow(nf,u,-1)) which would work whatever representation was chosen. There is no
nfeltnorm function (nfelttrace does not exist either), but we can easily write one:
nfeltnorm(nf,u) = norm(nfbasistoalg(nf, u))
Notice that this is certainly not foolproof (try it with complex or quadratic arguments!), but we
could refine it if the need arose. You can also consider (u) as a principal ideal, and just type
idealnorm(nf,u)
Of course, in this way, we lose the sign information. We will talk about ideals later on.
If we want all the symmetric functions of u and not only the norm, we type charpoly(u).
Note that this gives the characteristic polynomial of u, and not in general the minimal polynomial.
36