2 if properties(gcfac) = [] then load(scifac)$
3 /* Since GCFAC has some capability in common with FACTOR and FACTORSUM, we
4 begin by illustrating some of this capability with EXP1 : */
5 exp1:a*u+a*t*r+a*v*s*x;
9 /* Another case where there is some overlap can be seen in EXP2, an
10 expression with complex exponents. */
11 exp2:y+a^(r*t*sin(th)/y+u*v+5)+a^(r*t*sin(th)/y+u*v);
15 /* GCFAC will sometimes produce results identical with HORNER. */
17 exp3:a+a^2*u+a^3*b*t+a^4*h^2+a^5+a^6*y+t*z;
21 /* If there is no knowledge of a MAINVAR, GCFAC can produce results
23 FACTORSUM yields no improvement in this case. */
28 /* Next, we embed a subexpression which will factor in an expression which
29 will not at top level. This is illustrated in exp4 : */
30 exp4:a+s*w*x+b*v*z+w*y*r;
33 /* GCFAC can uncover factoring which is not immediately obvious from
34 the toplevel expression. Notice the innermost level of factoring
35 in the following example. */
36 exp5:h*w+p*q*s*t+b*g*q+g*h*p+a*f*g*h;
39 /* A similar effect is illustrated in the following case: */
40 exp6:h*u^5+r*u^6+s*r*u^8+r*z;
43 /* Repeated pair-factoring on an expression is illustrated in the
44 following two examples. */
45 exp7:m+n*q+p*u+p*r*q*w+p*r*t*u+p*r*t*v;
48 exp8:-v*w+h*w+r*s*h-r*s*l+r*t*u+r*t*v;
51 /* Unfortunately, if the best ordering for factoring the pairs of terms
52 in a sum is not the one generated by the simplifier, GCFAC cannot
53 currently deal with it. The following example demonstrates this
57 /* While GCFAC can deal with expressions which have not been rationally
58 simplified, it is probably best to put expressions in rational form
59 before calling GCFAC. Two forms of EXP10 are used to point out the
61 exp10:r*s/g+t*u/g^2+v*w/g^3-b*g^2;