2.6 Factoring

Command: factor int

The Jacal command factor takes as input an integer and returns a list of the prime numbers that divide it, each occurring with the appropriate multiplicity in the list. If the number is negative, the list will begin with -1.

The results of the factor command are shown in a special factored format, which appears as the product of the factors.

(%0038) factor(120);
        3
%0038: 2  3 5
(%0039) factor(-120);
           3
%0039: -1 2  3 5
Command: factor polyratio

Given a univariate ratio of polynomials polyratio, returns a matrix of factors and exponents.

As above, the results are shown in factored form.

(%0040) factor((14*x^4-10/68*x^-5)/(5*x^2+1));
                    9
          -5 + 476 x
%0040: ------------------
                    2   5
       2 17 (1 + 5 x ) x
(%0043) factor(x*y);
%0043: x y
(%0044) factor((x+a)*(y^4-z));
                      4
%0044: -1 (a + x) (- y  + z)
(%0045) factor((x+u*a^3)*(y^4-z));
            3            4
%0045: -1 (a  u + x) (- y  + z)
(%0046) factor((x+u*a^3)^2*(y^4-z)/((x+1)*(u^2-v^2)));
            4        3       2
        (- y  + z) (a  u + x)
%0046: -------------------------
       (- u + v) (u + v) (1 + x)
(%0047) factor(200*(-1*x+1+y)*(u-r^6)*(21*x+2-t^4));
           6            4                      2  3
%0047: (- r  + u) (2 - t  + 21 x) (1 - x + y) 5  2
(%0048) factor(2*(a+u)*(-v+b)*(a*x+y)^2);
                                       2
%0048: -1 2 (a + u) (- b + v) (a x + y)
(%0049) factor(2*(a+u)*(-v+b)*(a*x+y)^2/((u^2-v^2)*(11*x+55)));
                                    2
       2 (a + u) (- b + v) (a x + y)
%0049: ------------------------------
        11 (- u + v) (u + v) (5 + x)
(%0050) factor((c^3*u+b*a)*(b*b*a+v*p^2*q^2*c));
               3        2      2  2
%0050: (a b + c  u) (a b  + c p  q  v)
(%0051) factor((2*z+y-x)*(y^3-a*x^2)*(b*z^2+y));
             2    3                          2
%0051: (- a x  + y ) (- x + y + 2 z) (y + b z )
(%0052) factor((a*a*b*z+d)*(2*a*b*b*z+c));
             2                2
%0052: (d + a  b z) (c + 2 a b  z)
(%0053) factor((a*a*b*z+d)*(2*a*b*b*z+c)*((u+a)*x+1));
                             2                2
%0053: (1 + (a + u) x) (d + a  b z) (c + 2 a b  z)
(%0054) factor(a*(z+1)/4);
       a (1 + z)
%0054: ---------
           2
          2

The rest of this section documents commands from the factoring package. To use this package, execute the following command from the JACAL prompt:

require("ff");

Several of these commands return a matrix. The first column contains the factors and the second column contains the corresponding exponent.

Command: sff poly

Given a primitive univariate polynomial poly, calculate the square free factorisation of poly. A primitive polynomial is one with no factors (other than units) common to all its coefficients.

Command: ffsff poly p
Command: ffsff poly p m

Given a monic polynomial poly, a prime p, and a positive integer m, calculate the square free factorisation of poly in GF(p^m)[x]. If m is not supplied, 1 is assumed.

(%0059) ffsff(x^5+x^3+1, 53);
       [                 2    3    ]
       [ 16 - 22 x + 26 x  + x   1 ]
%0059: [                           ]
       [        -13 + x          2 ]
Command: berl poly n

Given a square-free univariate polynomial poly and an integer power of a prime, q, returns (as a bunch) the irreducible factors of poly.

(%0060) berl(x^5+x^3+2, 53);
                           2               2
%0060: [1 + x, 5 - 26 x + x , 11 + 25 x + x ]
Command: parfrac polyratio

Returns the partial fraction expansion of a rational univariate polynomial polyratio. The denominator of polyratio must be square free. This code is still being developed.