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)

UnitGroup(K).gens()

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.

Unit Groupsof Magma's handbook. $\endgroup$ – Stefan Kohl Apr 20 '16 at 19:30gpyou could doK=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 usingmatsolvemod) to construct a basis of totally positive units. $\endgroup$ – Noam D. Elkies Apr 20 '16 at 20:01gpis 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