# Force positive representation in GF

I work with arbitrary finite field GF(q), for q power of prime. I've been looking around for some function, which would force, that any element is printed as a positive natural number. i.e. in GF(5), -2 is printed as 3 etc. Is that possible in an easy way? I need to achieve that for arbitraty q. I've been thinking about writing some own function, but it seems intractable for me at the moment.

edit retag close merge delete

Do have an example where this is not the case? In GF(5) for instance, I get:

sage : [e for e in GF(5)]
[0, 1, 2, 3, 4]

( 2016-05-06 09:32:13 -0500 )edit

Yep, for polynomials with coefficients in GF(q) The sage naturally decides to print the lower number, i.e. -2 instead of 3 in case of GF(5).

( 2016-05-06 11:17:14 -0500 )edit

Oh, I think I was able to reproduce the behavior: Are you working with multivariate polynomials over GF(5)? This due to the fact that Sage uses Singular's string representation for those polynomials, which itself uses negative integers to represent finite fields elements. As far as I know, there is no way to make Sage represent these polynomials using only positive integers. Note though that if you have a polynomial p, p.coefficients() gives you the coefficients as positive integers. You can use this to construct your own string representation of the polynomial.

( 2016-05-06 15:58:41 -0500 )edit