REDUCE

9.3 Cancellation of Common Factors

Facilities are available in REDUCE for cancelling common factors in the numerators and denominators of expressions, at the option of the user. The system will perform this greatest common divisor computation if the switch GCD is on. (GCD is normally off.)

A check is automatically made, however, for common variable and numerical products in the numerators and denominators of expressions, and the appropriate cancellations made.

When GCD is on, and EXP is off, a check is made for square free factors in an expression. This includes separating out and independently checking the content of a given polynomial where appropriate. (For an explanation of these terms, see Anthony C. Hearn, “Non-Modular Computation of Polynomial GCDs Using Trial Division”, Proc. EUROSAM 79, published as Lecture Notes on Comp. Science, Springer-Verlag, Berlin, No 72 (1979) 227-239.)

Example: With EXP off and GCD on, the polynomial a*c+a*d+b*c+b*d would be returned as (A+B)*(C+D).

Under normal circumstances, GCDs are computed using an algorithm described in the above paper. It is also possible in REDUCE to compute GCDs using an alternative algorithm, called the EZGCD Algorithm, which uses modular arithmetic. The switch EZGCD, if on in addition to GCD, makes this happen.

In non-trivial cases, the EZGCD algorithm is almost always better than the basic algorithm, often by orders of magnitude. We therefore strongly advise users to use the EZGCD switch where they have the resources available for supporting the package.

For a description of the EZGCD algorithm, see J. Moses and D.Y.Y. Yun, “The EZ GCD Algorithm”, Proc. ACM 1973, ACM, New York (1973) 159-166.

NOTE: This package shares code with the factorizer, so a certain amount of trace information can be produced using the factorizer trace switches.

An implementation of the heuristic GCD algorithm, first introduced by B.W. Char, K.O. Geddes and G.H. Gonnet, as described in J.H. Davenport and J. Padget, “HEUGCD: How Elementary Upperbounds Generate Cheaper Data”, Proc. of EUROCAL ’85, Vol 2, 18-28, published as Lecture Notes on Comp. Science, No. 204, Springer-Verlag, Berlin, 1985, is also available on an experimental basis. To use this algorithm, the switch HEUGCD should be on in addition to GCD. Note that if both EZGCD and HEUGCD are on, the former takes precedence.

9.3.1 Determining the GCD of Two Polynomials

This operator, used with the syntax

        GCD(EXPRN1:polynomial,EXPRN2:polynomial):polynomial,

returns the greatest common divisor of the two polynomials EXPRN1 and EXPRN2.

Examples:

        gcd(x^2+2*x+1,x^2+3*x+2) ->  X+1  
        gcd(2*x^2-2*y^2,4*x+4*y) ->  2*X+2*Y  
        gcd(x^2+y^2,x-y)         ->  1.