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.
Do have an example where this is not the case? In
GF(5)
for instance, I get:Yep, for polynomials with coefficients in
GF(q)
The sage naturally decides to print the lower number, i.e.-2
instead of3
in case ofGF(5)
.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 polynomialp
,p.coefficients()
gives you the coefficients as positive integers. You can use this to construct your own string representation of the polynomial.