Polynomial over prime field

20 views
Skip to first unread message

chandra chowdhury

unread,
Jun 17, 2019, 8:02:07 AM6/17/19
to sage-s...@googlegroups.com
Hi,
  I have multi variable polynomial over integers say f(x,y,z).
I want to define it over GF(5) efficiently. 

For that I am doing this:


R=PolynomialRing(GF(5), 3, 'X')
Z = list(R.gens())

But g=R(f(Z)) is not working.

John Cremona

unread,
Jun 17, 2019, 8:21:31 AM6/17/19
to SAGE support
If you also define, say, 

sage: RZ = PolynomialRing(ZZ,3,'Y')
 
as a parent for polynomials over the integers then Sage can coerce elements of RZ into R directly.  For example (first assigning to the identifiers Y0, Y1, Y2 their natural values in RZ):

sage: Y0, Y1, Y2 = Z.gens()
sage: f = RZ.random_element()
sage: f
7*Y0*Y1 + 5*Y2^2 - Y2
sage: R(f)
2*X0*X1 - X2
sage: f = RZ.random_element()
sage: f
-Y0^2 + Y0*Y2 + Y1*Y2 + 4*Y2
sage: R(f)
-X0^2 + X0*X2 + X1*X2 - X2

--
You received this message because you are subscribed to the Google Groups "sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com.
To post to this group, send email to sage-s...@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/CAC3pSB%2B6cxwuOtKJ1EMVBZUnyrFW%3Dj2%3Dv58ZNQu9fjxfsMAEqA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages