Previous: , Up: Algebra   [Contents][Index]


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.

e0 : factor(120);

     3
e0: 2  3 5

e1 : factor(-120);

        3
e1: -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.

e2 : factor((14*x^4-10/68*x^-5)/(5*x^2+1));

                 9
       -5 + 476 x
e2: ------------------
                 2   5
    2 17 (1 + 5 x ) x

e3 : (14*x^4-10/68*x^-5)/(5*x^2+1);

               9
     -5 + 476 x
e3: --------------
        5        7
    34 x  + 170 x

e4 : (476*x^9-5)/(34*(5*x^2+1)*x^5);

               9
     -5 + 476 x
e4: --------------
        5        7
    34 x  + 170 x
e5 : factor(x*y);

e5: y x

e6 : factor((x+a)*(y^4-z));

                   4
e6: -1 (a + x) (- y  + z)

e7 : factor((x+u*a^3)*(y^4-z));

         3            4
e7: -1 (a  u + x) (- y  + z)

e8 : factor((x+u*a^3)^2*(y^4-z)/((x+1)*(u^2-v^2)));

         4        3       2
     (- y  + z) (a  u + x)
e8: -------------------------
    (1 + x) (- u + v) (u + v)

e9 : factor(200*(-1*x+1+y)*(u-r^6)*(21*x+2-t^4));

     3  2     6                        4
e9: 2  5  (- r  + u) (1 - x + y) (2 - t  + 21 x)

e10 : factor(2*(a+u)*(-v+b)*(a*x+y)^2);

                                     2
e10: -1 2 (a + u) (- b + v) (a x + y)

e11 : 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)
e11: ------------------------------
      11 (5 + x) (- u + v) (u + v)

e12 : factor(2*(a+u)*(-v+b)*(a*x+y)^2/((u^2-v^2)*x^4*(11*x+55)));

                                  2
     2 (a + u) (- b + v) (a x + y)
e12: -------------------------------
                                   4
     11 (5 + x) (- u + v) (u + v) x

e13 : factor((c^3*u+b*a)*(b*b*a+v*p^2*q^2*c));

             3        2      2  2
e13: (a b + c  u) (a b  + c p  q  v)

e14 : factor((2*z+y-x)*(y^3-a*x^2)*(b*z^2+y));

                             2        2    3
e14: (- x + y + 2 z) (y + b z ) (- a x  + y )

e15 : factor((a*a*b*z+d)*(2*a*b*b*z+c));

           2                2
e15: (d + a  b z) (c + 2 a b  z)

e16 : factor((a*a*b*z+d)*(2*a*b*b*z+c)*((u+a)*x+1));

                           2                2
e16: (1 + (a + u) x) (d + a  b z) (c + 2 a b  z)

e17 : factor((c*z+a)*(a*z+b)*(b*z+c));

e17: (b + a z) (c + b z) (a + c z)

e18 : factor((a*a*b*(x+w)*z+d)*(2*a*b*b*z+c));

            2        2                   2
e18: (d + (a  b w + a  b x) z) (c + 2 a b  z)

e19 : factor(((x+w)^2*z-u*d)*(-2*a*b*z+c));

                                   2            2
e19: -1 (- c + 2 a b z) (- d u + (w  + 2 w x + x ) z)

e20 : factor((-200*%i*x-c)*(x-d-z^5)/(a*(b^3-(a+u)*z)));

                                 5
     -1 (c + 200 %i x) (d - x + z )
e20: ------------------------------
                3
          a (- b  + (a + u) z)

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.

e0 : ffsff(x^5+x^3+1, 53);

    [                2    3   ]
    [16 - 22 x + 26 x  + x   1]
e0: [                         ]
    [       -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.

e2 : berl(x^5+x^3+2, 53);

                        2               2
e2: [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.


Previous: , Up: Algebra   [Contents][Index]