2 * Introduction to simplification::
11 @node Introduction to simplification, Package absimp, simplification-pkg, simplification-pkg
12 @section Introduction to simplification
14 The directory @code{maxima/share/simplification} contains several scripts
15 which implement simplification rules and functions,
16 and also some functions not related to simplification.
18 @c Adapted from absimp.usg ----------------------
20 @node Package absimp, Package facexp, Introduction to simplification, simplification-pkg
21 @section Package absimp
23 The @code{absimp} package contains pattern-matching rules that
24 extend the built-in simplification rules for the @code{abs} and @code{signum}
26 @code{absimp} respects relations
27 established with the built-in @code{assume} function and by declarations such
28 as @code{mode_declare (m, even, n, odd)} for even or odd integers.
30 @code{absimp} defines @code{unitramp} and @code{unitstep} functions
31 in terms of @code{abs} and @code{signum}.
33 @code{load ("absimp")} loads this package.
34 @code{demo ("absimp")} shows a demonstration of this package.
45 (%i1) load ("absimp")$
52 (%i3) diff (abs (x), x);
63 @c disol.usg: "disolate" already in doc/info/Expressions.texi
65 @c elim.usg: "eliminate" already in doc/info/Polynomials.texi
67 @opencatbox{Categories:}
68 @category{Simplification functions}
69 @category{Rules and patterns}
70 @category{Share packages}
71 @category{Package absimp}
75 @c Adapted from facexp.usg ----------------------
76 @c ALL OF THE TEXT IN FACEXP.USG IS VERY VAGUE.
77 @c I HAVE NO IDEA WHAT THESE FUNCTIONS DO.
78 @c ALL OF THESE ITEMS NEED TO BE HEAVILY REVISED
79 @c (ASSUMING THIS PACKAGE IS SOMETHING WE WANT TO INVEST TIME IN)
80 @node Package facexp, Package functs, Package absimp, simplification-pkg
81 @section Package facexp
83 @c THIS IS VERY VAGUE. JUST WHAT DOES THIS DO?
84 The @code{facexp} package contains several related functions that
85 provide the user with the ability to structure expressions by controlled
86 expansion. This capability is especially useful when the expression
87 contains variables that have physical meaning, because it is often true
88 that the most economical form of such an expression can be obtained by
89 fully expanding the expression with respect to those variables, and then
90 factoring their coefficients. While it is true that this procedure is
91 not difficult to carry out using standard Maxima functions, additional
92 fine-tuning may also be desirable, and these finishing touches can be
93 more difficult to apply.
95 The function @code{facsum} and its related forms
96 provide a convenient means for controlling the structure of expressions
97 in this way. Another function, @code{collectterms}, can be used to add two or
98 more expressions that have already been simplified to this form, without
99 resimplifying the whole expression again. This function may be
100 useful when the expressions are very large.
102 @c CAN'T FIND ANY SUCH FILE "DIAGEVAL".
103 @c THERE ARE COMMENTED-OUT DEFNS OF FACTENEXPAND, FACEXPTEN, AND FACTORFACEXPTEN
104 @c IN FACEXP (AND NOWHERE ELSE).
105 @c COMMENTING OUT THIS TEXT FOR NOW.
106 @c Note: @code{factenexpand}, @code{facexpten}, and @code{factorfacexpten} are available only
107 @c after loading @code{diageval}. They are special functions used for tensor
110 @code{load ("facexp")} loads this package.
111 @code{demo ("facexp")} shows a demonstration of this package.
113 @opencatbox{Categories:}
114 @category{Expressions}
115 @category{Share packages}
116 @category{Package facexp}
120 @c THIS IS VERY VAGUE. JUST WHAT DOES THIS DO?
121 @c SOME EXAMPLES WOULD HELP HERE
123 @deffn {Function} facsum (@var{expr}, @var{arg_1}, ..., @var{arg_n})
124 Returns a form of @var{expr} which depends on the
125 arguments @var{arg_1}, ..., @var{arg_n}.
126 The arguments can be any form suitable for @code{ratvars}, or they can be
127 lists of such forms. If the arguments are not lists, then the form
128 returned is fully expanded with respect to the arguments, and the
129 coefficients of the arguments are factored. These coefficients are
130 free of the arguments, except perhaps in a non-rational sense.
132 If any of the arguments are lists, then all such lists are combined
133 into a single list, and instead of calling @code{factor} on the
134 coefficients of the arguments, @code{facsum} calls itself on these
135 coefficients, using this newly constructed single list as the new
136 argument list for this recursive call. This process can be repeated to
137 arbitrary depth by nesting the desired elements in lists.
139 It is possible that one may wish to @code{facsum} with respect to more
140 complicated subexpressions, such as @code{log (x + y)}. Such arguments are
143 @c CUTTING THIS OUT, BECAUSE IT IS OBVIOUSLY NOT CORRECT
144 @c SEE EXAMPLE IN BUG REPORT ID: 2834336 - ratsimp vs facsum
145 @c With no variable specification, for example @code{facsum (@var{expr})}, the
146 @c result returned is the same as that returned by @code{ratsimp (@var{expr})}.
148 Occasionally the user may wish to obtain any of the above forms
149 for expressions which are specified only by their leading operators.
150 For example, one may wish to @code{facsum} with respect to all @code{log}'s. In
151 this situation, one may include among the arguments either the specific
152 @code{log}'s which are to be treated in this way, or alternatively, either
153 the expression @code{operator (log)} or @code{'operator (log)}. If one wished to
154 @code{facsum} the expression @var{expr} with respect to the operators @var{op_1}, ..., @var{op_n},
155 one would evaluate @code{facsum (@var{expr}, operator (@var{op_1}, ..., @var{op_n}))}.
156 The @code{operator} form may also appear inside list arguments.
158 In addition, the setting of the switches @code{facsum_combine} and
159 @code{nextlayerfactor} may affect the result of @code{facsum}.
161 @opencatbox{Categories:}
162 @category{Package facexp}
163 @category{Expressions}
168 @anchor{nextlayerfactor}
169 @defvr {Global variable} nextlayerfactor
170 Default value: @code{false}
172 When @code{nextlayerfactor} is @code{true}, recursive calls of @code{facsum}
173 are applied to the factors of the factored form of the
174 coefficients of the arguments.
176 When @code{false}, @code{facsum} is applied to
177 each coefficient as a whole whenever recursive calls to @code{facsum} occur.
179 Inclusion of the atom
180 @code{nextlayerfactor} in the argument list of @code{facsum} has the effect of
181 @code{nextlayerfactor: true}, but for the next level of the expression @i{only}.
182 Since @code{nextlayerfactor} is always bound to either @code{true} or @code{false}, it
183 must be presented single-quoted whenever it appears in the argument list of @code{facsum}.
185 @opencatbox{Categories:}
186 @category{Package facexp}
187 @category{Expressions}
192 @anchor{facsum_combine}
193 @defvr {Global variable} facsum_combine
194 Default value: @code{true}
196 @code{facsum_combine} controls the form of the final result returned by
197 @code{facsum} when its argument is a quotient of polynomials. If
198 @code{facsum_combine} is @code{false} then the form will be returned as a fully
199 expanded sum as described above, but if @code{true}, then the expression
200 returned is a ratio of polynomials, with each polynomial in the form
203 The @code{true} setting of this switch is useful when one
204 wants to @code{facsum} both the numerator and denominator of a rational
205 expression, but does not want the denominator to be multiplied
206 through the terms of the numerator.
208 @opencatbox{Categories:}
209 @category{Package facexp}
210 @category{Expressions}
215 @anchor{factorfacsum}
216 @deffn {Function} factorfacsum (@var{expr}, @var{arg_1}, ... @var{arg_n})
217 Returns a form of @var{expr} which is
218 obtained by calling @code{facsum} on the factors of @var{expr} with @var{arg_1}, ... @var{arg_n} as
219 arguments. If any of the factors of @var{expr} is raised to a power, both
220 the factor and the exponent will be processed in this way.
222 @opencatbox{Categories:}
223 @category{Package facexp}
224 @category{Expressions}
229 @c -----------------------------------------------------------------------------
230 @anchor{collectterms}
231 @deffn {Function} collectterms (@var{expr}, @var{arg_1}, @dots{}, @var{arg_n})
233 Collects all terms that contain @var{arg_1} ... @var{arg_n}.
234 If several expressions have been simplified with the following functions
235 @code{facsum}, @code{factorfacsum}, @code{factenexpand}, @code{facexpten} or
236 @code{factorfacexpten}, and they are to be added together, it may be desirable
237 to combine them using the function @code{collecterms}. @code{collecterms} can
238 take as arguments all of the arguments that can be given to these other
239 associated functions with the exception of @code{nextlayerfactor}, which has no
240 effect on @code{collectterms}. The advantage of @code{collectterms} is that it
241 returns a form similar to @code{facsum}, but since it is adding forms that have
242 already been processed by @code{facsum}, it does not need to repeat that effort.
243 This capability is especially useful when the expressions to be summed are very
246 See also @mrefdot{factor}
251 @c (exp(x)+2)*x+exp(x);
252 @c collectterms(expand(%),exp(x));
256 (%i1) (exp(x)+2)*x+exp(x);
258 (%o1) x (%e + 2) + %e
261 (%i2) collectterms(expand(%),exp(x));
263 (%o2) (x + 1) %e + 2 x
267 @opencatbox{Categories:}
268 @category{Package facexp}
269 @category{Expressions}
273 @c Adapted from functs.usg ----------------------
275 @c conjugate already described in doc/info/Matrices.texi
276 @node Package functs, Package ineq, Package facexp, simplification-pkg
277 @section Package functs
279 @opencatbox{Categories:}
280 @category{Share packages}
281 @category{Package functs}
285 @deffn {Function} rempart (@var{expr}, @var{n})
286 Removes part @var{n} from the expression @var{expr}.
288 If @var{n} is a list of the form @code{[@var{l}, @var{m}]}
289 then parts @var{l} thru @var{m} are removed.
291 To use this function write first @code{load(functs)}.
293 @opencatbox{Categories:}
294 @category{Package functs}
295 @category{Expressions}
301 @deffn {Function} wronskian ([@var{f_1}, ..., @var{f_n}], @var{x})
302 Returns the Wronskian matrix of the list of expressions [@var{f_1}, ..., @var{f_n}] in the variable @var{x}.
303 The determinant of the Wronskian matrix is the Wronskian determinant of the list of expressions.
305 To use @code{wronskian}, first @code{load(functs)}. Example:
309 @c wronskian([f(x), g(x)],x);
312 (%i1) load ("functs")$
314 (%i2) wronskian([f(x), g(x)],x);
318 [ -- (f(x)) -- (g(x)) ]
323 @opencatbox{Categories:}
324 @category{Package functs}
325 @category{Differential calculus}
330 @c adjoint already described in doc/info/Matrices.texi
333 @deffn {Function} tracematrix (@var{M})
334 Returns the trace (sum of the diagonal elements) of matrix @var{M}.
336 To use this function write first @code{load(functs)}.
338 @opencatbox{Categories:}
339 @category{Package functs}
345 @deffn {Function} rational (@var{z})
346 Multiplies numerator and denominator of @var{z} by the complex conjugate of denominator,
347 thus rationalizing the denominator.
348 Returns canonical rational expression (CRE) form if given one, else returns general form.
350 To use this function write first @code{load(functs)}.
352 @opencatbox{Categories:}
353 @category{Package functs}
354 @category{Expressions}
359 @c uprobe calls ?uprobe and assumes file is a list => obsolete, not common lisp
361 @c kronecker superseded by kron_delta in src/nset.lisp
363 @anchor{nonzeroandfreeof}
364 @deffn {Function} nonzeroandfreeof (@var{x}, @var{expr})
365 Returns @code{true} if @var{expr} is nonzero and @code{freeof (@var{x}, @var{expr})} returns @code{true}.
366 Returns @code{false} otherwise.
368 To use this function write first @code{load(functs)}.
370 @opencatbox{Categories:}
371 @category{Package functs}
372 @category{Expressions}
377 @deffn {Function} linear (@var{expr}, @var{x})
378 When @var{expr} is an expression of the form @code{@var{a}*@var{x} + @var{b}}
379 where @var{a} is nonzero, and @var{a} and @var{b} are free of @var{x},
380 @code{linear} returns a list of three equations, one for each of the three formal
381 variables @var{b}, @var{a}, and @var{x}. Otherwise, @code{linear} returns @code{false}.
383 @code{load(antid)} loads this function.
389 @c linear ((1 - w)*(1 - x)*z, z);
390 @c linear (cos(u - v) + cos(u + v), u);
394 (%i1) load ("antid");
395 (%o1) /maxima/share/integration/antid.mac
398 (%i2) linear ((1 - w)*(1 - x)*z, z);
399 (%o2) [bargumentb = 0, aargumenta = (w - 1) x - w + 1,
403 (%i3) linear (cos(u - v) + cos(u + v), u);
408 @opencatbox{Categories:}
409 @category{Package antid}
410 @category{Expressions}
415 @c -----------------------------------------------------------------------------
417 @deffn {Function} gcdivide (@var{p}, @var{q})
419 When the option variable @code{takegcd} is @code{true} which is the default,
420 @code{gcdivide} divides the polynomials @var{p} and @var{q} by their greatest
421 common divisor and returns the ratio of the results. @code{gcdivde} calls the
422 function @mref{ezgcd} to divide the polynomials by the greatest common divisor.
424 When @code{takegcd} is @code{false}, @code{gcdivide} returns the ratio
425 @code{@var{p}/@var{q}}.
427 To use this function write first @code{load(functs)}.
429 See also @mrefcomma{ezgcd} @mrefcomma{gcd} @mrefcomma{gcdex} and
437 (%i2) p1:6*x^3+19*x^2+19*x+6;
439 (%o2) 6 x + 19 x + 19 x + 6
440 (%i3) p2:6*x^5+13*x^4+12*x^3+13*x^2+6*x;
442 (%o3) 6 x + 13 x + 12 x + 13 x + 6 x
443 (%i4) gcdivide(p1, p2);
450 (%i6) gcdivide(p1, p2);
452 6 x + 19 x + 19 x + 6
453 (%o6) ----------------------------------
455 6 x + 13 x + 12 x + 13 x + 6 x
463 @opencatbox{Categories:}
464 @category{Package functs}
465 @category{Polynomials}
469 @c lcm already described in doc/info/Number.texi
472 @deffn {Function} arithmetic (@var{a}, @var{d}, @var{n})
473 Returns the @var{n}-th term of the arithmetic series
474 @code{@var{a}, @var{a} + @var{d}, @var{a} + 2*@var{d}, ..., @var{a} + (@var{n} - 1)*@var{d}}.
476 To use this function write first @code{load(functs)}.
478 @opencatbox{Categories:}
479 @category{Package functs}
480 @category{Sums and products}
486 @deffn {Function} geometric (@var{a}, @var{r}, @var{n})
487 Returns the @var{n}-th term of the geometric series
488 @code{@var{a}, @var{a}*@var{r}, @var{a}*@var{r}^2, ..., @var{a}*@var{r}^(@var{n} - 1)}.
490 To use this function write first @code{load(functs)}.
492 @opencatbox{Categories:}
493 @category{Package functs}
494 @category{Sums and products}
500 @deffn {Function} harmonic (@var{a}, @var{b}, @var{c}, @var{n})
501 Returns the @var{n}-th term of the harmonic series
502 @code{@var{a}/@var{b}, @var{a}/(@var{b} + @var{c}), @var{a}/(@var{b} + 2*@var{c}), ..., @var{a}/(@var{b} + (@var{n} - 1)*@var{c})}.
504 To use this function write first @code{load(functs)}.
506 @opencatbox{Categories:}
507 @category{Package functs}
508 @category{Sums and products}
514 @deffn {Function} arithsum (@var{a}, @var{d}, @var{n})
515 Returns the sum of the arithmetic series from 1 to @var{n}.
517 To use this function write first @code{load(functs)}.
519 @opencatbox{Categories:}
520 @category{Package functs}
521 @category{Sums and products}
527 @deffn {Function} geosum (@var{a}, @var{r}, @var{n})
528 Returns the sum of the geometric series from 1 to @var{n}. If @var{n} is
529 infinity (@code{inf}) then a sum is finite only if the absolute value
530 of @var{r} is less than 1.
532 To use this function write first @code{load(functs)}.
534 @opencatbox{Categories:}
535 @category{Package functs}
536 @category{Sums and products}
542 @deffn {Function} gaussprob (@var{x})
543 Returns the Gaussian probability function
544 @code{%e^(-@var{x}^2/2) / sqrt(2*%pi)}.
546 To use this function write first @code{load(functs)}.
548 @opencatbox{Categories:}
549 @category{Package functs}
550 @category{Mathematical functions}
556 @deffn {Function} gd (@var{x})
557 Returns the Gudermannian function
558 @code{2*atan(%e^x)-%pi/2}.
560 To use this function write first @code{load(functs)}.
562 @opencatbox{Categories:}
563 @category{Package functs}
564 @category{Mathematical functions}
570 @deffn {Function} agd (@var{x})
571 Returns the inverse Gudermannian function
572 @code{log (tan (%pi/4 + x/2))}.
574 To use this function write first @code{load(functs)}.
576 @opencatbox{Categories:}
577 @category{Package functs}
578 @category{Mathematical functions}
584 @deffn {Function} vers (@var{x})
585 Returns the versed sine @code{1 - cos (x)}.
587 To use this function write first @code{load(functs)}.
589 @opencatbox{Categories:}
590 @category{Package functs}
591 @category{Mathematical functions}
597 @deffn {Function} covers (@var{x})
598 Returns the coversed sine @code{1 - sin (@var{x})}.
600 To use this function write first @code{load(functs)}.
602 @opencatbox{Categories:}
603 @category{Package functs}
604 @category{Mathematical functions}
610 @deffn {Function} exsec (@var{x})
611 Returns the exsecant @code{sec (@var{x}) - 1}.
613 To use this function write first @code{load(functs)}.
615 @opencatbox{Categories:}
616 @category{Package functs}
617 @category{Mathematical functions}
623 @deffn {Function} hav (@var{x})
624 Returns the haversine @code{(1 - cos(x))/2}.
626 To use this function write first @code{load(functs)}.
628 @opencatbox{Categories:}
629 @category{Package functs}
630 @category{Mathematical functions}
635 @c REDUNDANT WITH BINOMIAL COEFFICIENT; CUT IT ??
637 @deffn {Function} combination (@var{n}, @var{r})
638 Returns the number of combinations of @var{n} objects
639 taken @var{r} at a time.
641 To use this function write first @code{load(functs)}.
643 @opencatbox{Categories:}
644 @category{Package functs}
645 @category{Mathematical functions}
650 @c REDUNDANT WITH PERMUTATIONS FUNCTION IN NSET; CUT IT ??
652 @deffn {Function} permutation (@var{n}, @var{r})
653 Returns the number of permutations of @var{r} objects
654 selected from a set of @var{n} objects.
656 To use this function write first @code{load(functs)}.
658 @opencatbox{Categories:}
659 @category{Package functs}
660 @category{Mathematical functions}
665 @c Adapted from ineq.usg ----------------------
666 @c THIS PACKAGE IS INTERESTING BUT THIS TEXT NEEDS WORK AND EXAMPLES
667 @node Package ineq, Package rducon, Package functs, simplification-pkg
668 @section Package ineq
670 The @code{ineq} package contains simplification rules
677 @c a>=4; /* a sample inequality */
678 @c (b>c)+%; /* add a second, strict inequality */
679 @c 7*(x<y); /* multiply by a positive number */
680 @c -2*(x>=3*z); /* multiply by a negative number */
681 @c (1+a^2)*(1/(1+a^2)<=1); /* Maxima knows that 1+a^2 > 0 */
682 @c assume(x>0)$ x*(2<3); /* assuming x>0 */
683 @c a>=b; /* another inequality */
684 @c 3+%; /* add something */
685 @c %-3; /* subtract it out */
686 @c a>=c-b; /* yet another inequality */
687 @c b+%; /* add b to both sides */
688 @c %-c; /* subtract c from both sides */
689 @c -%; /* multiply by -1 */
690 @c (z-1)^2>-2*z; /* determining truth of assertion */
691 @c expand(%)+2*z; /* expand this and add 2*z to both sides */
696 tellsimp: warning: rule will treat '+
697 ' as noncommutative and nonassociative.
698 tellsimp: warning: rule will treat '+
699 ' as noncommutative and nonassociative.
700 tellsimp: warning: rule will treat '+
701 ' as noncommutative and nonassociative.
702 tellsimp: warning: rule will treat '+
703 ' as noncommutative and nonassociative.
704 tellsimp: warning: rule will treat '+
705 ' as noncommutative and nonassociative.
706 tellsimp: warning: rule will treat '+
707 ' as noncommutative and nonassociative.
708 tellsimp: warning: rule will treat '+
709 ' as noncommutative and nonassociative.
710 tellsimp: warning: rule will treat '+
711 ' as noncommutative and nonassociative.
713 (%i2) a>=4; /* a sample inequality */
722 (%o10) a + 3 >= b + 3
726 (%o14) (- c) + b + a >= 0
727 (%o15) c - b - a <= 0
729 (%o16) (z - 1) > - 2 z
734 (%i19) (b>c)+%; /* add a second, strict inequality */
737 Be careful about using parentheses
738 around the inequalities: when the user types in @code{(A > B) + (C = 5)} the
739 result is @code{A + C > B + 5}, but @code{A > B + C = 5} is a syntax error,
740 and @code{(A > B + C) = 5} is something else entirely.
742 Do @code{disprule (all)} to see a complete listing
743 of the rule definitions.
745 The user will be queried if Maxima is
746 unable to decide the sign of a quantity multiplying an inequality.
748 The most common mis-feature is illustrated by:
770 Another problem is 0 times an inequality; the default to have this
771 turn into 0 has been left alone. However, if you type
772 @code{X*@var{some_inequality}} and Maxima asks about the sign of @code{X} and you
773 respond @code{zero} (or @code{z}), the program returns @code{X*@var{some_inequality}}
774 and not use the information that @code{X} is 0. You should do @code{ev (%, x: 0)} in such
775 a case, as the database will only be used for comparison purposes
776 in decisions, and not for the purpose of evaluating @code{X}.
778 The user may note a slower response when this package is loaded, as
779 the simplifier is forced to examine more rules than without the
780 package, so you might wish to remove the rules after making use of
781 them. Do @code{kill (rules)} to eliminate all of the rules (including any
782 that you might have defined); or you may be more selective by
783 killing only some of them; or use @code{remrule} on a specific rule.
785 Note that if you load this package after defining your own
786 rules you will clobber your rules that have the same name. The
787 rules in this package are:
788 @code{*rule1}, ..., @code{*rule8},
789 @code{+rule1}, ..., @code{+rule18},
790 and you must enclose the rulename in quotes to refer to it, as
791 in @code{remrule ("+", "+rule1")} to specifically remove the first rule on @code{"+"}
792 or @code{disprule ("*rule2")} to display the definition of the second multiplicative rule.
794 @opencatbox{Categories:}
795 @category{Simplification functions}
796 @category{Rules and patterns}
797 @category{Share packages}
798 @category{Package ineq}
802 @c lrats.usg: "lratsubst" and "fullratsubst" already in doc/info/Polynomials.texi
804 @c Adapted from rducon.usg ----------------------
805 @c THIS IS AN INTERESTING FUNCTION BUT THIS TEXT NEEDS WORK AND EXAMPLES
806 @node Package rducon, Package scifac, Package ineq, simplification-pkg
807 @section Package rducon
809 @opencatbox{Categories:}
810 @category{Expressions}
811 @category{Share packages}
812 @category{Package rducon}
816 @anchor{reduce_consts}
817 @deffn {Function} reduce_consts (@var{expr})
818 Replaces constant subexpressions of @var{expr} with
819 constructed constant atoms, saving the definition of all these
820 constructed constants in the list of equations @code{const_eqns}, and
821 returning the modified @var{expr}. Those parts of @var{expr} are constant which
822 return @code{true} when operated on by the function @code{constantp}. Hence,
823 before invoking @code{reduce_consts}, one should do
826 declare ([@var{objects to be given the constant property}], constant)$
829 to set up a database of the constant quantities occurring in your
832 If you are planning to generate Fortran output after these symbolic
833 calculations, one of the first code sections should be the calculation
834 of all constants. To generate this code segment, do
837 map ('fortran, const_eqns)$
840 Variables besides @code{const_eqns} which affect @code{reduce_consts} are:
842 @code{const_prefix} (default value: @code{xx}) is the string of characters used to prefix all
843 symbols generated by @code{reduce_consts} to represent constant subexpressions.
845 @code{const_counter} (default value: 1) is the integer index used to generate unique
846 symbols to represent each constant subexpression found by @code{reduce_consts}.
848 @code{load ("rducon")} loads this function.
849 @code{demo ("rducon")} shows a demonstration of this function.
851 @opencatbox{Categories:}
852 @category{Package rducon}
853 @category{Expressions}
858 @c rncomb.usg: "rncombine" already in doc/info/Miscellaneous.texi
860 @c Adapted from scifac.usg ----------------------
861 @node Package scifac, , Package rducon, simplification-pkg
862 @section Package scifac
864 @opencatbox{Categories:}
865 @category{Expressions}
866 @category{Share packages}
867 @category{Package scifac}
872 @deffn {Function} gcfac (@var{expr})
873 @code{gcfac} is a factoring function that attempts to apply the same heuristics which
874 scientists apply in trying to make expressions simpler. @code{gcfac} is limited
875 to monomial-type factoring. For a sum, @code{gcfac} does the following:
879 Factors over the integers.
881 Factors out the largest powers of terms occurring as
882 coefficients, regardless of the complexity of the terms.
884 Uses (1) and (2) in factoring adjacent pairs of terms.
886 Repeatedly and recursively applies these techniques until
887 the expression no longer changes.
890 Item (3) does not necessarily do an optimal job of pairwise
891 factoring because of the combinatorially-difficult nature of finding
892 which of all possible rearrangements of the pairs yields the most
893 compact pair-factored result.
895 @code{load ("scifac")} loads this function.
896 @code{demo ("scifac")} shows a demonstration of this function.
898 @opencatbox{Categories:}
899 @category{Package scifac}
900 @category{Expressions}
905 @c stopex.usg: "expandwrt", "expandwrt_denom", and "expandwrt_factored" already in doc/info/Simplification.texi