# Number Fields and the Norm

Hello,

I am currently very confused about how to use [Number Fields in Sage].(http://www.sagemath.org/doc/reference/sage/rings/number_field/number_field.html). Things are not working.

Specifically I would like the norm of $\mathbb{Z}[\zeta_5]$ which should be a homogeneous polynomial of degree 4.

I tried:

K.<g> = NumberField(1+x+x^2+x^3+x^4)

a,b,c,d=var('a b c d')

(a+b*g+c*g^2+d*g^3).norm()

However that did not work.

I also tried:

K.<g>=CyclotomicField(5); K

a,b,c,d=var('a b c d')

(a+b*g+c*g^2+d*g^3).norm()

Instead of returning the norm in the Cyclotomic ring, this simply gave me the norm over the complex numbers, that is multiplication by the complex conjugate. These two things are very different, and the norm of the complex number is not at all correct. (It should be degree 4 not degree 2)

Any help is greatly appreciated, thank you

edit retag close merge delete

Sort by » oldest newest most voted

I think this works better -- use polynomials, not symbolic expressions. I have written the following in a way which would work for any field in place of K:

sage: K.<g> = CyclotomicField(5)
sage: R = PolynomialRing(K,K.degree(),'x')
sage: sum([R.gen(i)*(g^i).matrix() for i in range(K.degree())]).det()
x0^4 - x0^3*x1 + x0^2*x1^2 - x0*x1^3 + x1^4 - x0^3*x2 + 2*x0^2*x1*x2 - 3*x0*x1^2*x2 - x1^3*x2 + x0^2*x2^2 + 2*x0*x1*x2^2 + x1^2*x2^2 - x0*x2^3 - x1*x2^3 + x2^4 - x0^3*x3 + 2*x0^2*x1*x3 + 2*x0*x1^2*x3 - x1^3*x3 - 3*x0^2*x2*x3 - x0*x1*x2*x3 + 2*x1^2*x2*x3 + 2*x0*x2^2*x3 - 3*x1*x2^2*x3 - x2^3*x3 + x0^2*x3^2 - 3*x0*x1*x3^2 + x1^2*x3^2 + 2*x0*x2*x3^2 + 2*x1*x2*x3^2 + x2^2*x3^2 - x0*x3^3 - x1*x3^3 - x2*x3^3 + x3^4


As already mentioned, one can just as easily get the trace or even the characteristic polynomial of a general element:

sage: M = sum([R.gen(i)*(g^i).matrix() for i in range(K.degree())])
sage: M.trace()
4*x0 - x1 - x2 - x3
sage: M.charpoly('t')
t^4 + (-4*x0 + x1 + x2 + x3)*t^3 + (6*x0^2 - 3*x0*x1 + x1^2 - 3*x0*x2 + 2*x1*x2 + x2^2 - 3*x0*x3 + 2*x1*x3 - 3*x2*x3 + x3^2)*t^2 + (-4*x0^3 + 3*x0^2*x1 - 2*x0*x1^2 + x1^3 + 3*x0^2*x2 - 4*x0*x1*x2 + 3*x1^2*x2 - 2*x0*x2^2 - 2*x1*x2^2 + x2^3 + 3*x0^2*x3 - 4*x0*x1*x3 - 2*x1^2*x3 + 6*x0*x2*x3 + x1*x2*x3 - 2*x2^2*x3 - 2*x0*x3^2 + 3*x1*x3^2 - 2*x2*x3^2 + x3^3)*t + x0^4 - x0^3*x1 + x0^2*x1^2 - x0*x1^3 + x1^4 - x0^3*x2 + 2*x0^2*x1*x2 - 3*x0*x1^2*x2 - x1^3*x2 + x0^2*x2^2 + 2*x0*x1*x2^2 + x1^2*x2^2 - x0*x2^3 - x1*x2^3 + x2^4 - x0^3*x3 + 2*x0^2*x1*x3 + 2*x0*x1^2*x3 - x1^3*x3 - 3*x0^2*x2*x3 - x0*x1*x2*x3 + 2*x1^2*x2*x3 + 2*x0*x2^2*x3 - 3*x1*x2^2*x3 - x2^3*x3 + x0^2*x3^2 - 3*x0*x1*x3^2 + x1^2*x3^2 + 2*x0*x2*x3^2 + 2*x1*x2*x3^2 + x2^2*x3^2 - x0*x3^3 - x1*x3^3 - x2*x3^3 + x3^4

more

I think this is a solution - please tell me if the result is indeed what you wanted to calculate:

sage: K.<g> = NumberField(1+x+x^2+x^3+x^4)
sage: var(','.join(['x%d'%i for i in range(K.degree())]))
(x0, x1, x2, x3)
sage: sum([eval('x%d'%i)*(g^i).matrix() for i in range(K.degree())])
[      x0       x1       x2       x3]
[     -x3  x0 - x3  x1 - x3  x2 - x3]
[-x2 + x3      -x2  x0 - x2  x1 - x2]
[-x1 + x2 -x1 + x3      -x1  x0 - x1]
sage: _.determinant()
x0^4 - x0^3*x1 - x0^3*x2 - x0^3*x3 + x0^2*x1^2 + 2*x0^2*x1*x2 + 2*x0^2*x1*x3 + x0^2*x2^2 - 3*x0^2*x2*x3 + x0^2*x3^2 - x0*x1^3 - 3*x0*x1^2*x2 + 2*x0*x1^2*x3 + 2*x0*x1*x2^2 - x0*x1*x2*x3 - 3*x0*x1*x3^2 - x0*x2^3 + 2*x0*x2^2*x3 + 2*x0*x2*x3^2 - x0*x3^3 + x1^4 - x1^3*x2 - x1^3*x3 + x1^2*x2^2 + 2*x1^2*x2*x3 + x1^2*x3^2 - x1*x2^3 - 3*x1*x2^2*x3 + 2*x1*x2*x3^2 - x1*x3^3 + x2^4 - x2^3*x3 + x2^2*x3^2 - x2*x3^3 + x3^4


In any case, it would be nice to be able to have a variable taking values in K. All these fail, for example:

sage: a=var('a') ; a*g
TypeError: unsupported operand parent(s) for '*': 'Symbolic Ring' and 'Number Field in g with defining polynomial x^4 + x^3 + x^2 + x + 1'
sage: a=var('a',domain=QQ) ; a*g
TypeError: unsupported operand parent(s) for '*': 'Symbolic Ring' and 'Number Field in g with defining polynomial x^4 + x^3 + x^2 + x + 1'
sage: a=var('a',domain=K) ; a*g
TypeError: unsupported operand parent(s) for '*': 'Symbolic Ring' and 'Number Field in g with defining polynomial x^4 + x^3 + x^2 + x + 1'


Does anyone have a suggestion?

more