Polynomials can be factored with factor. Factorization works in polynomial rings over prime finite fields, ZZ, or QQ.
i1 : R = ZZ/10007[a,b]; |
i2 : f = (2*a+3)^4 + 5 |
i3 : g = (2*a+b+1)^3 |
i4 : S = factor f |
i5 : T = factor g |
The results have been packaged for easy viewing. The number of factors is obtained using
i6 : #T |
Each factor is represented as a power (exponents equal to 1 don't appear in the display.) The parts can be extracted with #.
i7 : T#0 |
i8 : T#0#0 |
i9 : T#0#1 |