The fact that i is not in CC doesn't bother me too much, since i is a
"formal square root of -1":

  sage: i in CC
  False

I can force it to be in CC by doing this:

  sage: CC(i)
  1.00000000000000*I

But then I think I should be able to do this:

  sage: GF(5)(i)

Someone who knows more number theory than I do can come up with a
better solution, but coercion code like this ought to work: replace
the end ("raise TypeError...") of the _coerc_impl() method for
Finite_Field_prime_modn (in sage.rings.finite_field_prime_modn.py)
with this:

        from sage.functions.constants import I
        from sage.rings.arith import primitive_root
        p = self.__char
        if x == i and p % 4 == 1:
            return self(primitive_root(p))**((p-1)/4)
        raise TypeError, "no canonical coercion of x"

But this isn't the right place to patch.  When I do this,
GF(5)._coerce_(i) works, but GF(5)(i) doesn't.

Perhaps IntegerMod in the file integer_mod.pyx should be patched, but
I don't want to mess around with Cython.  Perhaps some other file
should be patched.  Can anyone help?
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to