Pari is like a calculator:
> 1+1
> 1.2325325325325*86458756475757
We can change the precision to 1000 decimal digits:
> \p1000
> sqrt(2)
> \p38
Let's set up a number field
> K=nfinit(x^3+3*x^2-2*x+1)
> K.pol
We can determine the number of real embeddings and the number of *pairs* of complex conjugate embeddings:
> K.r1
> K.r2
Here's the actual roots of the defining polynomial:
> polroots(K.pol)
Let's set up some elements in our number field:
> a=Mod(2*x^2+3*x+1,K.pol)
> b=Mod(x^2-x+1,K.pol)
We can compute:
> a+b
> a-b
> a*b
> a/b
> 1/(a-1)
> (a^2-1)/a
Let's find the minimum polynomials of some values. We start with the roots of the defining polynomial of K:
> roots=polroots(K.pol)
> a1=roots[1]
> a2=roots[2]
> algdep(a1,3,20)
> algdep(a1+a2,3,20)
Sometimes we don't get the minimum polynomial, but we can factor the polynomial we get to find the minimum one:
> algdep(a1*a2,10,20)
> factor(algdep(a1*a2,10,20))
Let's set up a cyclotomic number field:
> L=nfinit(x^3-1)
Whoops that polynomial is not irreducible. Let's find the irreducible factor:
> factor(x^3-1)
> L=nfinit(x^2+x+1)
We can compute a Z-basis for the ring of integers:
> L.zk
We can check if -4 is a fundamental discriminant:
> isfundamental(-4)
There's a help menu:
> ?4
> ?6
You can get help on individual functions:
> ?nfdisc
Let's find the discriminant of L (two different ways):
> nfdisc(L.pol)
> L.disc
We can compute polynomial greatest common divisors:
> gcd(x^3+3*x^2-2, x^4+x^3+x^2-1)
We can find roots in Z/3Z:
> polrootsmod(x^3-3*x^2+2*x+3,3)
Or we can trick Pari into factoring a polynomial over Z/2Z (we factor over Z_2 and truncate to 1 term in the 2-adic power series, giving coefficients of the factors in Z/2Z):
> factorpadic(x^5+3*x^4+x^3-x^2-3*x-1,2,1)
We can compute the conjugates of a root of the defining polynomial which are actually in the field, if there's n of them for a degree n field, then the field is Galois:
> ?nfgaloisconj
> nfgaloisconj(L)
We can also get a single generator for a number field with two generators. In this example we get the min poly of a generator for Q(sqrt(2), sqrt(3)):
> K=nfinit(y^2-2)
> L=rnfequation(K,x^2-3)