factor x -- factors x.
The result is a Product each of whose factors is a Power whose base is one of the factors found and whose exponent is an integer.
i1 : y = (2^15-4)/(2^15-5) |
i2 : x = factor y |
i3 : value x |
We may peek inside x to a high depth to see its true structure as Expression.
i4 : peek2(x,100) |
For small integers factorization is done by trial division. Eventually we will have code for large integers. For multivariate polynomials the factorization is done with code of Michael Messollen (see Singular-Libfac). For univariate polynomials the factorization is in turn done with code of Gert-Martin Greuel and Ruediger Stobbe (see Factory library).
i5 : R = ZZ/101[u] |
i6 : factor (u^3-1) |
The constant term is provided as the last factor, if it's not equal to 1.
i7 : F = frac(ZZ/101[t]) |
i8 : factor ((t^3-1)/(t^3+1)) |
The code for factoring in a fraction field is easy to read:
i9 : code(factor,F) |
Ways to use factor :
Optional arguments :