Force positive representation in GF

asked 2016-05-06 15:50:31 +0200

AJey gravatar image

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 flag offensive close merge delete

Comments

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]
B r u n o gravatar imageB r u n o ( 2016-05-06 16:32:13 +0200 )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).

AJey gravatar imageAJey ( 2016-05-06 18:17:14 +0200 )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.

B r u n o gravatar imageB r u n o ( 2016-05-06 22:58:41 +0200 )edit