Examples with Various Signatures

In this section we give examples for various $ (r,s)$ pairs. First we consider $ K=\mathbf{Q}(i)$.
sage: K.<a> = QuadraticField(-1)
sage: K.signature()
(0, 1)
...umber Field in a with
defining polynomial x^2 + 1
sage: U.0

The signature method returns the number of real and complex conjugate embeddings of $ K$ into $ \mathbf{C}$. The unit_group method, which we used above, returns the unit group $ U_K$ as an abstract abelian group and a homomorphism $ U_K\to \O_K$.

Next we consider $ K=\mathbf{Q}(\sqrt[3]{2})$.
sage: R.<x> = QQ[]
sage: K.<a> = NumberField(x^3 - 2)
sage: K...
...omial x^3 - 2
sage: U.gens()
[-1, a - 1]
sage: u = U.1; u
a - 1

Below we use the places command, which returns the real embeddings and representatives for the complex conjugate embeddings. We use the places to define the log map $ \varphi $, which plays such a big role in this chapter.
sage: S = K.places(prec=53); S
[Ring morphism:
From: Number ...
[-1.34737734833, 0.673688674165]
sage: phi(K(-1))
[0.0, 0.0]
Note that $ \varphi :U_K \to \mathbf{R}^2$, and the image lands in the 1-dimensional subspace of $ (x_1,x_2)$ such that $ x_1 +2x_2 = 0$. Also, note that $ \varphi(-1)=0$.

Let's try a field such that $ r+s-1=2$. First, one with $ r=0$ and $ s=3$:
sage: K.<a> = NumberField(x^6 + x + 1)
sage: K.signature()
sage: sum(phi(u2))

Notice that the log image of $ u_1$ is clearly not a real multiple of the log image of $ u_2$ (e.g., the scalar would have to be positive because of the first coefficient, but negative because of the second). This illustrates the fact that the log images of $ u_1$ and $ u_2$ span a two-dimensional space.

Next we compute a field with $ r=3$ and $ s=0$. (A field with $ s=0$ is called totally real.)
sage: K.<a> = NumberField(x^3 + x^2 - 5*x - 1)
sage: K.signat...
sage: phi(u2)
[0.996681204093, -1.64022415032, 0.643542946229]

A field with $ r=0$ is called totally complex. For example, the cyclotomic fields $ \mathbf{Q}(\zeta_n)$ are totally complex, where $ \zeta_n$ is a primitive $ n$th root of unity. The degree of $ \mathbf{Q}(\zeta_n)$ over $ \mathbf {Q}$ is $ \varphi (n)$ and $ r=0$, so $ s=\varphi (n)/2$ (assuming $ n>2$).
sage: K.<a> = CyclotomicField(11); K
Cyclotomic Field of orde...
...8533, 0.52028]
[-0.084484, -1.1721, -0.33496, 0.60477, 0.98675]

How far can we go computing unit groups of cyclotomic fields directly with Sage?
sage: time U = CyclotomicField(11).unit_group()
Time: CPU 0.1...
.... I waited a few minutes and gave up....

However, if you are willing to assume some conjectures (something related to the Generalized Riemann Hypothesis), you can go further:
sage: proof.number_field(False)
sage: time U = CyclotomicFiel...
...s: user 21.07 s, sys: 1.06 s, total: 22.13 s
Wall time: 22.14 s
The generators of the units for $ \mathbf{Q}(\zeta_{29})$ are

$\displaystyle u_{0}$ $\displaystyle = -\zeta_{29}^{3}$    
$\displaystyle u_{1}$ $\displaystyle = \zeta_{29}^{26} + \zeta_{29}^{25} + \zeta_{29}^{22} + \zeta_{29...
...ta_{29}^{8} + \zeta_{29}^{7} + \zeta_{29}^{4} + \zeta_{29}^{3} + \zeta_{29} + 1$    
$\displaystyle u_{2}$ $\displaystyle = \zeta_{29}^{14} + \zeta_{29}^{3}$    
$\displaystyle u_{3}$ $\displaystyle = \zeta_{29}^{3} + 1$    
$\displaystyle u_{4}$ $\displaystyle = \zeta_{29}^{26} + \zeta_{29}^{20} + \zeta_{29}^{3}$    
$\displaystyle u_{5}$ $\displaystyle = \zeta_{29}^{22} + \zeta_{29}^{11} + \zeta_{29}^{2}$    
$\displaystyle u_{6}$ $\displaystyle = \zeta_{29}^{10} + \zeta_{29}^{9} + \zeta_{29}^{8}$    
$\displaystyle u_{7}$ $\displaystyle = \zeta_{29}^{23} + \zeta_{29}$    
$\displaystyle u_{8}$ $\displaystyle = \zeta_{29}^{17} + \zeta_{29}^{11}$    
$\displaystyle u_{9}$ $\displaystyle = \zeta_{29}^{22} + \zeta_{29}^{3}$    
$\displaystyle u_{10}$ $\displaystyle = \zeta_{29}^{24} + \zeta_{29}^{19} + \zeta_{29}^{5} + 1$    
$\displaystyle u_{11}$ $\displaystyle = \zeta_{29}^{19} + \zeta_{29}^{6}$    
$\displaystyle u_{12}$ $\displaystyle = \zeta_{29}^{27} + \zeta_{29}^{19} + \zeta_{29}^{11} + \zeta_{29}^{6} + \zeta_{29}^{3}$    
$\displaystyle u_{13}$ $\displaystyle = \zeta_{29}^{26} + \zeta_{29}^{15} + \zeta_{29}^{4}$    

There are better ways to compute units in cyclotomic fields than to just use general purpose software. For example, there are explicit cyclotomic units that can be written down and generate a finite subgroup of $ U_K$. See [Was97, Ch. 8], which would be a great book to read now that you've got this far in the present book. Also, using the theorem explained in that book, it is probably possible to make the unit_group command in Sage for cyclotomic fields extremely fast, which would be an interesting project for a reader who also likes to code.

William Stein 2012-09-24