Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Generating random polynomials in R/I

I'm trying to generate random polynomials in ring R/I. Here's an example:

P.<x> = PolynomialRing(ZZ)
R = P.quotient(x**256 + 1)
I = R.ideal(g) # for some appropriate polynomial g
S = QuotientRing(R, I)
S.random_element()

Instead of this last command outputting a polynomial, it outputs a small integer. Looking through the sage code, the QuotientRing_nc class doesn't appear to be overloading random_element, so I guess the default random_element method from the Ring class is being called, which just outputs random integers.

Is there any way to generate random polynomials in S, or is that functionality not implemented currently?

Thanks.

click to hide/show revision 2
retagged

Generating random polynomials in R/I

I'm trying to generate random polynomials in ring R/I. Here's an example:

P.<x> = PolynomialRing(ZZ)
R = P.quotient(x**256 + 1)
I = R.ideal(g) # for some appropriate polynomial g
S = QuotientRing(R, I)
S.random_element()

Instead of this last command outputting a polynomial, it outputs a small integer. Looking through the sage code, the QuotientRing_nc class doesn't appear to be overloading random_element, so I guess the default random_element method from the Ring class is being called, which just outputs random integers.

Is there any way to generate random polynomials in S, or is that functionality not implemented currently?

Thanks.