On Mar 21, 10:03 am, Martin Albrecht <[email protected]>
wrote:
> In all cases it should return a Sage Integer not a
> Python int.
All of the functions intr, intr1, and int4 return a Sage integer, not
a Python int.
Also, for small fields, log_to_int operates the same way,
sage: F.<X>=GF(2^6)
sage: r=F.random_element(); r
X^5 + X^2 + X + 1
sage: int4(r)
39
sage: r.log_to_int()
39
However, for large fields, say GF(7^100), log_to_int is not
implemented. Perhaps, either that name can be used instead of
integer_representation, or something similar, say poly_to_int.
Also, if there is a conversion from polynomials to integers, it would
have sense to have a backward conversion from integers to polynomials.
It can be done similarly as
def poly_repr(n,f):
C=reversed(n.digits(f.characteristic()))
return reduce(lambda x,y:f.gen()*x+y,C)
For example,
sage: poly_repr(int4(r),F)
X^5 + X^2 + X + 1
sage: _==r
True
The name for it can be chosen correspondingly to the name of the first
conversion, say int_to_poly.
The corresponding functions in the Maple's implementation of GF are
called input and output. They work in Maple as
F:=GF(7,100):
F:-input(101);
2
3 + 2 T
F:-output(%);
101
Alec Mihailovs
--
To post to this group, send an email to [email protected]
To unsubscribe from this group, send an email to
[email protected]
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
To unsubscribe from this group, send email to
sage-devel+unsubscribegooglegroups.com or reply to this email with the words
"REMOVE ME" as the subject.