# Revision history [back]

### Units in number fields.

I want to get the expression of a unit in a number field in terms of the base by means of U.log(). Here is my code: K.<z> = CyclotomicField(21) U = UnitGroup(K) U.fundamental_units() a=(z^3+z^6+z^12)/2+1 [ a is (3 + i sqrt[7])/4 so it is a unit in K ] U.log(a)

I get the error
ValueError: 1/2z^11 - 1/2z^9 + 1/2z^8 + 1/2z^4 + 1/2*z + 1/2 is not a unit

But it is a unit. It is true that a = 1/2z^11 - 1/2z^9 + 1/2z^8 + 1/2z^4 + 1/2*z + 1/2.

What I'm doing wrong

 2 No.2 Revision tmonteil 22963 ●25 ●162 ●420 http://wiki.sagemath.o...

### Units in number fields.

I want to get the expression of a unit in a number field in terms of the base by means of U.log(). U.log(). Here is my code: code:

K.<z> = CyclotomicField(21)
U = UnitGroup(K)
U.fundamental_units()
a=(z^3+z^6+z^12)/2+1      [ # a is  (3 + i sqrt[7])/4   so it is a unit in K ]
U.log(a)K
U.log(a)


I get the error

ValueError: 1/2z^11 1/2*z^11 - 1/2z^9 1/2*z^9 + 1/2z^8 1/2*z^8 + 1/2z^4 1/2*z^4 + 1/2*z + 1/2 is not a unitunit


But it is a unit. It is true that a = 1/2z^11 1/2*z^11 - 1/2z^9 1/2*z^9 + 1/2z^8 1/2*z^8 + 1/2z^4 1/2*z^4 + 1/2*z + 1/2.1/2.

What I'm doing wrongwrong ?