(1) -> p ==> 3
K ==> PrimeField p
P ==> UnivariatePolynomial('x, K)
x: P := monomial(1,1)$P
f: P := (x+2)*(2*x^5 + x^3 + 2)
g: P := 2*x^3 + x^2 -x +1
f/g
factor f
factor g
k: K := 2
f/k
In order to work with a finite field of order p^n where p is a prime, define the second argument of UnivariatePolynomial as FiniteField?(p, n).
F ==> FiniteField(p,2)
b: Vector F := basis()$F
t: F := b.2
1+t+t^2+t^3
PF ==> UnivariatePolynomial('y, F)
y: PF := monomial(1,1)$PF
pf: PF := (y+2)*(2*y^5 + y^3 + 2)
pg: PF := (2*t+1)*y^3 + (1+t)*y^2 -t*y +1
pf/pg
factor pf
factor pg
In case the field property is not needed, IntegerMod? would be the way to go. But note that in general there are zero divisors, so division will not work (even not in the case where the argument of IntegerMod? is a prime). The reason is IntegerMod? doesn't check whether it's argument is prime and so does not know that it might be an integral domain.
R ==> IntegerMod(p)
PR ==> UnivariatePolynomial('z, R)
z: PR := monomial(1,1)$PR
rf: PR := (z+2)*(2*z^5 + z^3 + 2)
rg: PR := 2*z^3 + z^2 -z +1
rf/rg
There are 11 exposed and 15 unexposed library operations named / having 2 argument(s) but none was determined to be applicable. Use HyperDoc Browse,or issue )display op / to learn more about the available operations. Perhaps package-calling the operation or using coercions on the arguments will allow you to apply the operation.
Cannot find a definition or applicable library operation named / with argument type(s) UnivariatePolynomial(z,IntegerMod(3)) UnivariatePolynomial(z, IntegerMod(3))
Perhaps you should use "@" to indicate the required return type,or "$" to specify which version of the function you need.
Also note that factorization of rf fails. The reason most probably is that the used algorithm needs to divide by some coefficient and it fails to recognize that this is in fact possible (at least for primes p). In IntegerMod?, there simply is no division.
r1: R := 2
r2: R := 1
r1/r2
There are 11 exposed and 15 unexposed library operations named / having 2 argument(s) but none was determined to be applicable. Use HyperDoc Browse,or issue )display op / to learn more about the available operations. Perhaps package-calling the operation or using coercions on the arguments will allow you to apply the operation.
Cannot find a definition or applicable library operation named / with argument type(s) IntegerMod(3) IntegerMod(3)
Perhaps you should use "@" to indicate the required return type,or "$" to specify which version of the function you need.