fricas p ==> 3 Type: Voidfricas K ==> PrimeField p Type: Voidfricas P ==> UnivariatePolynomial('x, Type: Voidfricas x: P := monomial(1,
fricas f: P := (x+2)*(2*x^5 + x^3 + 2)
fricas g: P := 2*x^3 + x^2 -x +1
fricas f/g
fricas factor f
fricas factor g
fricas k: K := 2
Type: PrimeField?(3)fricas f/k
In order to work with a finite field of order where is a prime, define the second argument of UnivariatePolynomial as FiniteField?(p, n). fricas F ==> FiniteField(p, Type: Voidfricas b: Vector F := basis()$F
fricas t: F := b.2
fricas 1+t+t^2+t^3
fricas PF ==> UnivariatePolynomial('y, Type: Voidfricas y: PF := monomial(1,
fricas pf: PF := (y+2)*(2*y^5 + y^3 + 2)
fricas pg: PF := (2*t+1)*y^3 + (1+t)*y^2 -t*y +1
fricas pf/pg
fricas factor pf
fricas 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. fricas R ==> IntegerMod(p) Type: Voidfricas PR ==> UnivariatePolynomial('z, Type: Voidfricas z: PR := monomial(1,
fricas rf: PR := (z+2)*(2*z^5 + z^3 + 2)
fricas rg: PR := 2*z^3 + z^2 -z +1
fricas rf/rg
Type: Booleanfricas factor rf
fricas factor rg
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. fricas r1: R := 2
Type: IntegerMod?(3)fricas r2: R := 1
Type: IntegerMod?(3)fricas r1/r2 |