Hello,

I would like to take a create a function that takes a polynomial over
the integers and returns its roots in ZZ mod p for p a prime. I want
to assume the polynomial is globally defined but the prime is the
argument.

Here is what I have in mind but can't quite get the types right.

x = var('x') #necessary?

poly=x^2+x+1

def myroots(p):
    R=IntegerModRing(p)
    RR.<t>=R[]
    f=poly.substitute(x=t) #coercion here
    return f.roots(R)

How do I convert or coerce poly to be in R?

Thanks in advance!

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

Reply via email to