Does anyone know how to find explicit generators for the unit group of a number field on magma?

For example, in sage one could do

K. = NumberField(x^3+x^2-2*x-1)


and it gives you [-1, w^2 - 1, w + 1] which generate the unit group, but I can't figure out how to get this same data in magma.

Alternatively if anyone knows how to tell if something is totally positive in sage, that would work too.

  • $\begingroup$ You can find information on how to compute groups of units of number fields in Magma in Section Unit Groups of Magma's handbook. $\endgroup$ – Stefan Kohl Apr 20 '16 at 19:30
  • 2
    $\begingroup$ In gp you could do K=bnfinit(x^3+x^2-2*x-1); U=K.fu; S=bnfsignunit(K) to get a vector U of fundamental units and a matrix S of their real embeddings' signs. Then it just takes a bit of linear algebra mod 2 (possibly using matsolvemod) to construct a basis of totally positive units. $\endgroup$ – Noam D. Elkies Apr 20 '16 at 20:01
  • 1
    $\begingroup$ (and anything that's in gp is automatically accessible by Sage even if there's no native Sage way to do it) $\endgroup$ – Noam D. Elkies Apr 20 '16 at 21:26

In Magma, the unit group is returned as an abstract group together with a map from that group into the field. So you would do something like the following:

> Zx<x> := PolynomialRing(Integers());
> K<w> := NumberField(x^3 + x^2 - 2*x - 1);
> G,phi := UnitGroup(K);
> G;
Abelian Group isomorphic to Z/2 + Z + Z
Defined on 3 generators
    2*G.1 = 0
> [ K!phi(G.i) : i in [1..Ngens(G)] ];
  w + 1

Note a couple of important points here. Firstly, for some reason calling Generators(G) would return a set rather than the more helpful sequence, hence the use of G.i and the loop over Ngens. Secondly, the concept of units is only useful with respect to an order, not the field, so the map phi is actually from G to the maximal order of K. That is why I have inserted the coercion into K, since that seems closer to what you want.

| cite | improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.