Ask Your Question

Revision history [back]

Ok, I found out that f%5 does not work exactly how I thought it did, it does not apply mod 5 to all coefficients. Instead we should use a ring to do the modular:

R.<x> = PolynomialRing(ZZ) f=-7*x^4 + 3*x^3 - 4*x^2 - x - 5 Rmod.<x> = PolynomialRing(Integers(5)) Rmod(f)

The above will output:

3*x^4 + 3*x^3 + x^2 + 4*x + 4

Ok, I found out that f%5 does not work exactly how I thought it did, it does not apply mod 5 to all coefficients. Instead we should use a ring to do the modular:

R.<x> = PolynomialRing(ZZ) f=-7*x^4 + 3*x^3 - 4*x^2 - x - 5 Rmod.<x> = PolynomialRing(Integers(5)) Rmod(f)

The above will output:

3*x^4 + 3*x^3 + x^2 + 4*x + 4

click to hide/show revision 3
No.3 Revision

Ok, I found out that f%5 does not work exactly how I thought it did, it does not apply mod 5 to all coefficients. Instead we should use a ring to do the modular:

 R.<x> = PolynomialRing(ZZ)     
f=-7*x^4 + 3*x^3 - 4*x^2 - x - 5   
Rmod.<x> = PolynomialRing(Integers(5))   
Rmod(f)   
Rmod(f)

The above will output:

3*x^4 + 3*x^3 + x^2 + 4*x + 4