Number fields in PARI-GP

To define a number field in gp

F=nfinit(y^2-2)

This will give a quadratic number field \(\mathbb{Q}[\sqrt{2}]\). Remember, nfinit must get an irreducible polynomial as input otherwise gp will change the polynomial.

You can use polredbest to find better defining polynomials. See ?polredbest for more info.

To define the 5th cyclotomic number field, you could try

T=polcyclo(5, 'x)
K=nfinit(T)

To add or multiply elements of the number field, there are the function nfeltadd and nfeltmul. See the documentation.


This page was updated on January 7, 2025.
Main Page