Hi Shing!

Two possibilities:

  sage: k.<a> = GF(9)
  sage: t=a^2+1

Now, you can learn about all possible methods for elements of k by
doing
  sage: t.<TAB>
(you type t, dot, and hit the tab key).
This will show you a list of possible methods.

One of the methods is called int_repr:
  sage: t.int_repr()
  '5'
So, it gives you a string, that you can easily transform into an
integer: ZZ(t.int_repr()) for a Sage integer, int(t.int_repr()) for a
Python integer.

There is also log_to_int:
  sage: t.log_to_int()
  5
Probably this last method is easier.

The inverse way is
  sage: k.fetch_int(5)
  a + 2
which is indeed the same as t:
  sage: t
  a + 2

Cheers,
Simon
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to