![]() | 1 | initial version |
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
![]() | 2 | No.2 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)
The above will output:
3*x^4 + 3*x^3 + x^2 + 4*x + 4
![]() | 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