Merge branch 'rtoy-wrap-option-args'
[maxima.git] / doc / info / de / simplifications.de.texi
blobb22b750530bdd60758992889cee7506ed14bb4a8
1 @c -----------------------------------------------------------------------------
2 @c File     : simplifications.de.texi
3 @c License  : GNU General Public License (GPL)
4 @c Language : German
5 @c Original : simplifications.texi revision 03.07.2011
6 @c Date     : 08.11.2010
7 @c Revision : 03.07.2011
8 @c 
9 @c This file is part of Maxima -- GPL CAS based on DOE-MACSYMA
10 @c -----------------------------------------------------------------------------
12 @menu
13 * Introduction to simplification::
14 * Package absimp::
15 * Package facexp::
16 * Package functs::
17 * Package ineq::
18 * Package rducon::
19 * Package scifac::
20 * Package sqdnst::
21 @end menu
23 @c -----------------------------------------------------------------------------
24 @node Introduction to simplification, Package absimp, simplification, simplification
25 @section Introduction to simplification
26 @c -----------------------------------------------------------------------------
28 The directory @code{maxima/share/simplification} contains several scripts
29 which implement simplification rules and functions,
30 and also some functions not related to simplification.
32 @c Adapted from absimp.usg ----------------------
34 @c -----------------------------------------------------------------------------
35 @node Package absimp, Package facexp, Introduction to simplification, simplification
36 @section Package absimp
37 @c -----------------------------------------------------------------------------
39 The @code{absimp} package contains pattern-matching rules that
40 extend the built-in simplification rules for the @code{abs} and @code{signum}
41 functions.
42 @code{absimp} respects relations
43 established with the built-in @code{assume} function and by declarations such
44 as @code{modedeclare (m, even, n, odd)} for even or odd integers.
46 @code{absimp} defines @code{unitramp} and @code{unitstep} functions
47 in terms of @code{abs} and @code{signum}.
49 @code{load("absimp")} loads this package.
50 @code{demo(absimp)} shows a demonstration of this package.
52 Examples:
54 @example
55 (%i1) load ("absimp")$
56 (%i2) (abs (x))^2;
57                                        2
58 (%o2)                                 x
59 (%i3) diff (abs (x), x);
60                                       x
61 (%o3)                               ------
62                                     abs(x)
63 (%i4) cosh (abs (x));
64 (%o4)                               cosh(x)
65 @end example
67 @c disol.usg: "disolate" already in doc/info/Expressions.texi
68 @c elim.usg: "eliminate" already in doc/info/Polynomials.texi
70 @c Adapted from facexp.usg ----------------------
71 @c ALL OF THE TEXT IN FACEXP.USG IS VERY VAGUE.
72 @c I HAVE NO IDEA WHAT THESE FUNCTIONS DO.
73 @c ALL OF THESE ITEMS NEED TO BE HEAVILY REVISED
74 @c (ASSUMING THIS PACKAGE IS SOMETHING WE WANT TO INVEST TIME IN)
76 @c -----------------------------------------------------------------------------
77 @node Package facexp, Package functs, Package absimp, simplification
78 @section Package facexp
79 @c -----------------------------------------------------------------------------
81 @c THIS IS VERY VAGUE. JUST WHAT DOES THIS DO?
82 The @code{facexp} package contains several related functions that
83 provide the user with the ability to structure expressions by controlled
84 expansion.  This capability is especially useful when the expression
85 contains variables that have physical meaning, because it is often true
86 that the most economical form of such an expression can be obtained by
87 fully expanding the expression with respect to those variables, and then
88 factoring their coefficients.  While it is true that this procedure is
89 not difficult to carry out using standard Maxima functions, additional
90 fine-tuning may also be desirable, and these finishing touches can be
91 more difficult to apply.
93 The function @code{facsum} and its related forms provide a convenient means
94 for controlling the structure of expressions in this way.  Another function,
95 @code{collectterms}, can be used to add two or more expressions that have
96 already been simplified to this form, without resimplifying the whole expression
97 again.  This function may be useful when the expressions are very large.
99 @c CAN'T FIND ANY SUCH FILE "DIAGEVAL".
100 @c THERE ARE COMMENTED-OUT DEFNS OF FACTENEXPAND, FACEXPTEN, AND FACTORFACEXPTEN
101 @c IN FACEXP (AND NOWHERE ELSE).
102 @c COMMENTING OUT THIS TEXT FOR NOW.
103 @c Note: @code{factenexpand}, @code{facexpten}, and @code{factorfacexpten} 
104 @c are available only
105 @c after loading @code{diageval}. They are special functions used for tensor
106 @c manipulation.
108 @code{load("facexp")} loads this package.
109 @code{demo(facexp)} shows a demonstration of this package.
111 @c THIS IS VERY VAGUE. JUST WHAT DOES THIS DO?
112 @c SOME EXAMPLES WOULD HELP HERE
114 @c -----------------------------------------------------------------------------
115 @anchor{facsum}
116 @deffn {Function} facsum (@var{expr}, @var{arg_1}, @dots{}, @var{arg_n})
118 Returns a form of @var{expr} which depends on the arguments @var{arg_1},
119 @dots{}, @var{arg_n}.  The arguments can be any form suitable for 
120 @code{ratvars}, or they can be lists of such forms.  If the arguments are not
121 lists, then the form returned is fully expanded with respect to the arguments,
122 and the coefficients of the arguments are factored.  These coefficients are
123 free of the arguments, except perhaps in a non-rational sense.
125 If any of the arguments are lists, then all such lists are combined
126 into a single list, and instead of calling @code{factor} on the coefficients of
127 the arguments, @code{facsum} calls itself on these coefficients, using this
128 newly constructed single list as the new argument list for this recursive call.
129 This process can be repeated to arbitrary depth by nesting the desired elements
130 in lists.
132 It is possible that one may wish to @code{facsum} with respect to more
133 complicated subexpressions, such as @code{log(x + y)}.  Such arguments are also
134 permissible.
136 @c CUTTING THIS OUT, BECAUSE IT IS OBVIOUSLY NOT CORRECT
137 @c SEE EXAMPLE IN BUG REPORT ID: 2834336 - ratsimp vs facsum
138 @c With no variable specification, for example @code{facsum (@var{expr})}, the 
139 @c result returned is the same as that returned by @code{ratsimp (@var{expr})}.
141 Occasionally the user may wish to obtain any of the above forms
142 for expressions which are specified only by their leading operators.
143 For example, one may wish to @code{facsum} with respect to all @code{log}'s.
144 In this situation, one may include among the arguments either the specific
145 @code{log}'s which are to be treated in this way, or alternatively, either
146 the expression @code{operator (log)} or @code{'operator (log)}.  If one
147 wished to @code{facsum} the expression @var{expr} with respect to the operators
148 @var{op_1}, @dots{}, @var{op_n}, one would evaluate @code{facsum (@var{expr},
149 operator (@var{op_1}, ..., @var{op_n}))}.  The @code{operator} form may also
150 appear inside list arguments.
152 In addition, the setting of the switches @code{facsum_combine} and
153 @code{nextlayerfactor} may affect the result of @code{facsum}.
154 @end deffn
156 @c -----------------------------------------------------------------------------
157 @anchor{nextlayerfactor}
158 @defvr {Global variable} nextlayerfactor
159 Default value: @code{false}
161 When @code{nextlayerfactor} is @code{true}, recursive calls of @code{facsum}
162 are applied to the factors of the factored form of the
163 coefficients of the arguments.
165 When @code{false}, @code{facsum} is applied to
166 each coefficient as a whole whenever recusive calls to @code{facsum} occur.
168 Inclusion of the atom @code{nextlayerfactor} in the argument list of
169 @code{facsum} has the effect of @code{nextlayerfactor: true}, but for the next
170 level of the expression @i{only}.  Since @code{nextlayerfactor} is always bound
171 to either @code{true} or @code{false}, it must be presented single-quoted
172 whenever it appears in the argument list of @code{facsum}.
173 @end defvr
175 @c -----------------------------------------------------------------------------
176 @anchor{facsum_combine}
177 @defvr {Global variable} facsum_combine
178 Default value: @code{true}
180 @code{facsum_combine} controls the form of the final result returned by
181 @code{facsum} when its argument is a quotient of polynomials.  If
182 @code{facsum_combine} is @code{false} then the form will be returned as a fully
183 expanded sum as described above, but if @code{true}, then the expression
184 returned is a ratio of polynomials, with each polynomial in the form
185 described above.
187 The @code{true} setting of this switch is useful when one
188 wants to @code{facsum} both the numerator and denominator of a rational
189 expression, but does not want the denominator to be multiplied
190 through the terms of the numerator.
191 @end defvr
193 @c -----------------------------------------------------------------------------
194 @anchor{factorfacsum}
195 @deffn {Function} factorfacsum (@var{expr}, @var{arg_1}, @dots{} @var{arg_n})
197 Returns a form of @var{expr} which is obtained by calling @code{facsum} on the
198 factors of @var{expr} with @var{arg_1}, @dots{} @var{arg_n} as arguments.  If
199 any of the factors of @var{expr} is raised to a power, both the factor and the
200 exponent will be processed in this way.
201 @end deffn
203 @c -----------------------------------------------------------------------------
204 @anchor{collectterms}
205 @deffn {Function} collectterms (@var{expr}, @var{arg_1}, @dots{}, @var{arg_n})
207 If several expressions have been simplified with the following functions: 
208 @code{facsum}, @code{factorfacsum}, @code{factenexpand}, @code{facexpten} or
209 @code{factorfacexpten}, and they are to be added together, it may be
210 desirable to combine them using the function @code{collecterms}.
211 @code{collecterms} can take as arguments all of the arguments that can be
212 given to these other associated functions with the exception of
213 @code{nextlayerfactor}, which has no effect on @code{collectterms}.  The 
214 advantage of @code{collectterms} is that it returns a form similar to 
215 @code{facsum}, but since it is adding forms that have already been processed by 
216 @code{facsum}, it does not need to repeat that effort.  This capability is
217 especially useful when the expressions to be summed are very large.
218 @end deffn
220 @c Adapted from functs.usg ----------------------
222 @c -----------------------------------------------------------------------------
223 @node Package functs, Package ineq, Package facexp, simplification
224 @section Package functs
225 @c -----------------------------------------------------------------------------
227 @c -----------------------------------------------------------------------------
228 @anchor{rempart}
229 @deffn {Function} rempart (@var{expr}, @var{n})
231 Removes part @var{n} from the expression @var{expr}.
233 If @var{n} is a list of the form @code{[@var{l}, @var{m}]}
234 then parts @var{l} thru @var{m} are removed.
236 To use this function write first @code{load("functs")}.
237 @end deffn
239 @c -----------------------------------------------------------------------------
240 @anchor{wronskian}
241 @deffn {Function} wronskian ([@var{f_1}, @dots{}, @var{f_n}], @var{x})
243 Returns the Wronskian matrix of the list of expressions [@var{f_1}, @dots{}, 
244 @var{f_n}] in the variable @var{x}.  The determinant of the Wronskian matrix is
245 the Wronskian determinant of the list of expressions.
247 To use @code{wronskian}, first @code{load("functs")}.  Example:
249 @c ===beg===
250 @c load ("functs")$
251 @c wronskian([f(x), g(x)],x);
252 @c ===end===
253 @example
254 (%i1) load("functs")$
255 (%i2) wronskian([f(x), g(x)],x);
256 (%o2) matrix([f(x),g(x)],['diff(f(x),x,1),'diff(g(x),x,1)])
257 @end example
258 @end deffn
260 @c adjoint already described in doc/info/Matrices.texi
262 @c -----------------------------------------------------------------------------
263 @anchor{tracematrix}
264 @deffn {Function} tracematrix (@var{M})
266 Returns the trace (sum of the diagonal elements) of matrix @var{M}.
268 To use this function write first @code{load("functs")}.
269 @end deffn
271 @c -----------------------------------------------------------------------------
272 @anchor{function_rational}
273 @deffn {Function} rational (@code{z})
275 Multiplies numerator and denominator of @var{z} by the complex conjugate of
276 denominator, thus rationalizing the denominator.  Returns canonical rational
277 expression (CRE) form if given one, else returns general form.
279 To use this function write first @code{load("functs")}.
280 @end deffn
282 @c -----------------------------------------------------------------------------
283 @anchor{nonzeroandfreeof}
284 @deffn {Function} nonzeroandfreeof (@var{x}, @var{expr})
286 Returns @code{true} if @var{expr} is nonzero and @code{freeof (@var{x}, 
287 @var{expr})} returns @code{true}.  Returns @code{false} otherwise.
289 To use this function write first @code{load("functs")}.
290 @end deffn
292 @c -----------------------------------------------------------------------------
293 @anchor{function_linear}
294 @deffn {Function} linear (@var{expr}, @var{x})
296 When @var{expr} is an expression linear in variable @var{x}, @code{linear}
297 returns @code{@var{a}*@var{x} + @var{b}} where @var{a} is nonzero,
298 and @var{a} and @var{b} are free of @var{x}.
299 Otherwise, @code{linear} returns @var{expr}.
301 To use this function write first @code{load("functs")}.
302 @end deffn
304 @c -----------------------------------------------------------------------------
305 @anchor{gcdivide}
306 @deffn {Function} gcdivide (@var{p}, @var{q})
308 When the option variable @code{takegcd} is @code{true} which is the default,
309 @code{gcdivide} divides the polynomials @var{p} and @var{q} by their greatest
310 common divisor and returns the ratio of the results.  @code{gcdivde} calls the
311 function @mref{ezgcd} to divide the polynomials by the greatest common divisor.
313 When @code{takegcd} is @code{false}, @code{gcdivide} returns the ratio
314 @code{@var{p}/@var{q}}.
316 To use this function write first @code{load("functs")}.
318 See also @mrefcomma{ezgcd} @mrefcomma{gcd} @mrefcomma{gcdex} and
319 @mrefdot{poly_gcd}
321 Example:
323 @example
324 (%i1) load("functs")$
326 (%i2) p1:6*x^3+19*x^2+19*x+6; 
327                         3       2
328 (%o2)                6 x  + 19 x  + 19 x + 6
329 (%i3) p2:6*x^5+13*x^4+12*x^3+13*x^2+6*x;
330                   5       4       3       2
331 (%o3)          6 x  + 13 x  + 12 x  + 13 x  + 6 x
332 (%i4) gcdivide(p1, p2);
333                              x + 1
334 (%o4)                        ------
335                               3
336                              x  + x
337 (%i5) takegcd:false;
338 (%o5)                         false
339 (%i6) gcdivide(p1, p2);
340                        3       2
341                     6 x  + 19 x  + 19 x + 6
342 (%o6)          ----------------------------------
343                   5       4       3       2
344                6 x  + 13 x  + 12 x  + 13 x  + 6 x
345 (%i7) ratsimp(%);
346                              x + 1
347 (%o7)                        ------
348                               3
349                              x  + x
350 @end example
351 @end deffn
353 @c -----------------------------------------------------------------------------
354 @anchor{arithmetic}
355 @deffn {Function} arithmetic (@var{a}, @var{d}, @var{n})
357 Returns the @var{n}-th term of the arithmetic series @code{@var{a}, @var{a} +
358 @var{d}, @var{a} + 2*@var{d}, ..., @var{a} + (@var{n} - 1)*@var{d}}.
360 To use this function write first @code{load("functs")}.
361 @end deffn
363 @c -----------------------------------------------------------------------------
364 @anchor{geometric}
365 @deffn {Function} geometric (@var{a}, @var{r}, @var{n})
367 Returns the @var{n}-th term of the geometric series
368 @code{@var{a}, @var{a}*@var{r}, @var{a}*@var{r}^2, ...,
369 @var{a}*@var{r}^(@var{n} - 1)}.
371 To use this function write first @code{load("functs")}.
372 @end deffn
374 @c -----------------------------------------------------------------------------
375 @anchor{harmonic}
376 @deffn {Function} harmonic (@var{a}, @var{b}, @var{c}, @var{n})
378 Returns the @var{n}-th term of the harmonic series
379 @code{@var{a}/@var{b}, @var{a}/(@var{b} + @var{c}), @var{a}/(@var{b} +
380 2*@var{c}), ..., @var{a}/(@var{b} + (@var{n} - 1)*@var{c})}.
382 To use this function write first @code{load("functs")}.
383 @end deffn
385 @c -----------------------------------------------------------------------------
386 @anchor{arithsum}
387 @deffn {Function} arithsum (@var{a}, @var{d}, @var{n})
389 Returns the sum of the arithmetic series from 1 to @var{n}.
391 To use this function write first @code{load("functs")}.
392 @end deffn
394 @c -----------------------------------------------------------------------------
395 @anchor{geosum}
396 @deffn {Function} geosum (@var{a}, @var{r}, @var{n})
398 Returns the sum of the geometric series from 1 to @var{n}.  If @var{n} is
399 infinity (@code{inf}) then a sum is finite only if the absolute value
400 of @var{r} is less than 1.
402 To use this function write first @code{load("functs")}.
403 @end deffn
405 @c -----------------------------------------------------------------------------
406 @anchor{gaussprob}
407 @deffn {Function} gaussprob (@var{x})
409 Returns the Gaussian probability function
410 @code{%e^(-@var{x}^2/2) / sqrt(2*%pi)}.
412 To use this function write first @code{load("functs")}.
413 @end deffn
415 @c -----------------------------------------------------------------------------
416 @anchor{gd}
417 @deffn {Function} gd (@var{x})
419 Returns the Gudermannian function @code{2*atan(%e^x)-%pi/2}.
421 To use this function write first @code{load("functs")}.
422 @end deffn
424 @c -----------------------------------------------------------------------------
425 @anchor{agd}
426 @deffn {Function} agd (@var{x})
428 Returns the inverse Gudermannian function @code{log (tan (%pi/4 + x/2)))}.
430 To use this function write first @code{load("functs")}.
431 @end deffn
433 @c -----------------------------------------------------------------------------
434 @anchor{vers}
435 @deffn {Function} vers (@var{x})
437 Returns the versed sine @code{1 - cos (x)}.
439 To use this function write first @code{load("functs")}.
440 @end deffn
442 @c -----------------------------------------------------------------------------
443 @anchor{covers}
444 @deffn {Function} covers (@var{x})
446 Returns the coversed sine @code{1 - sin (@var{x})}.
448 To use this function write first @code{load("functs")}.
449 @end deffn
451 @c -----------------------------------------------------------------------------
452 @anchor{exsec}
453 @deffn {Function} exsec (@var{x})
455 Returns the exsecant @code{sec (@var{x}) - 1}.
457 To use this function write first @code{load("functs")}.
458 @end deffn
460 @c -----------------------------------------------------------------------------
461 @anchor{hav}
462 @deffn {Function} hav (@var{x})
464 Returns the haversine @code{(1 - cos(x))/2}.
466 To use this function write first @code{load("functs")}.
467 @end deffn
469 @c REDUNDANT WITH BINOMIAL COEFFICIENT; CUT IT ??
471 @c -----------------------------------------------------------------------------
472 @anchor{combination}
473 @deffn {Function} combination (@var{n}, @var{r})
475 Returns the number of combinations of @var{n} objects taken @var{r} at a time.
477 To use this function write first @code{load("functs")}.
478 @end deffn
480 @c REDUNDANT WITH PERMUTATIONS FUNCTION IN NSET; CUT IT ??
482 @c -----------------------------------------------------------------------------
483 @anchor{permutation}
484 @deffn {Function} permutation (@var{n}, @var{r})
486 Returns the number of permutations of @var{r} objects selected from a set of
487 @var{n} objects.
489 To use this function write first @code{load("functs")}.
490 @end deffn
492 @c Adapted from ineq.usg ----------------------
493 @c THIS PACKAGE IS INTERESTING BUT THIS TEXT NEEDS WORK AND EXAMPLES
495 @c -----------------------------------------------------------------------------
496 @node Package ineq, Package rducon, Package functs, simplification
497 @section Package ineq
498 @c -----------------------------------------------------------------------------
500 The @code{ineq} package contains simplification rules for inequalities.
502 Example session:
504 @c ===beg===
505 @c load("ineq")$
506 @c a>=4;  /* a sample inequality */
507 @c (b>c)+%; /* add a second, strict inequality */
508 @c 7*(x<y); /* multiply by a positive number */
509 @c -2*(x>=3*z); /* multiply by a negative number */
510 @c (1+a^2)*(1/(1+a^2)<=1); /* Maxima knows that 1+a^2 > 0 */
511 @c assume(x>0)$ x*(2<3); /* assuming x>0 */
512 @c a>=b; /* another inequality */
513 @c 3+%; /* add something */
514 @c %-3; /* subtract it out */
515 @c a>=c-b; /* yet another inequality */
516 @c b+%; /* add b to both sides */
517 @c %-c; /* subtract c from both sides */
518 @c -%;  /* multiply by -1 */
519 @c (z-1)^2>-2*z; /* determining truth of assertion */
520 @c expand(%)+2*z; /* expand this and add 2*z to both sides */
521 @c %,pred;
522 @c ===end===
523 @example
524 (%i1) load("ineq")$
525 Warning: Putting rules on '+' or '*' is inefficient, and may not work.
526 Warning: Putting rules on '+' or '*' is inefficient, and may not work.
527 Warning: Putting rules on '+' or '*' is inefficient, and may not work.
528 Warning: Putting rules on '+' or '*' is inefficient, and may not work.
529 Warning: Putting rules on '+' or '*' is inefficient, and may not work.
530 Warning: Putting rules on '+' or '*' is inefficient, and may not work.
531 Warning: Putting rules on '+' or '*' is inefficient, and may not work.
532 Warning: Putting rules on '+' or '*' is inefficient, and may not work.
533 (%i2) a>=4;  /* a sample inequality */
534 (%o2)                               a >= 4
535 (%i3) (b>c)+%; /* add a second, strict inequality */
536 (%o3)                            b + a > c + 4
537 (%i4) 7*(x<y); /* multiply by a positive number */
538 (%o4)                              7 x < 7 y
539 (%i5) -2*(x>=3*z); /* multiply by a negative number */
540 (%o5)                           - 2 x <= - 6 z
541 (%i6) (1+a^2)*(1/(1+a^2)<=1); /* Maxima knows that 1+a^2 > 0 */
542                                         2
543 (%o6)                             1 <= a  + 1
544 (%i7) assume(x>0)$ x*(2<3); /* assuming x>0 */
545 (%o7)                              2 x < 3 x
546 (%i8) a>=b; /* another inequality */
547 (%o8)                               a >= b
548 (%i9) 3+%; /* add something */
549 (%o9)                           a + 3 >= b + 3
550 (%i10) %-3; /* subtract it out */
551 (%o10)                              a >= b
552 (%i11) a>=c-b; /* yet another inequality */
553 (%o11)                            a >= c - b
554 (%i12) b+%; /* add b to both sides */
555 (%o12)                            b + a >= c
556 (%i13) %-c; /* subtract c from both sides */
557 (%o13)                         - c + b + a >= 0
558 (%i14) -%;  /* multiply by -1 */
559 (%o14)                          c - b - a <= 0
560 (%i15) (z-1)^2>-2*z; /* determining truth of assertion */
561                                       2
562 (%o15)                         (z - 1)  > - 2 z
563 (%i16) expand(%)+2*z; /* expand this and add 2*z to both sides */
564                                    2
565 (%o16)                            z  + 1 > 0
566 (%i17) %,pred;
567 (%o17)                               true
568 @end example
570 Be careful about using parentheses
571 around the inequalities: when the user types in @code{(A > B) + (C = 5)} the
572 result is @code{A + C > B + 5}, but @code{A > B + C = 5} is a syntax error,
573 and @code{(A > B + C) = 5} is something else entirely.
575 Do @code{disprule (all)} to see a complete listing
576 of the rule definitions.
578 The user will be queried if Maxima is
579 unable to decide the sign of a quantity multiplying an inequality.
581 The most common mis-feature is illustrated by:
583 @c ===beg===
584 @c eq: a > b;
585 @c 2*eq;
586 @c % - eq;
587 @c ===end===
588 @example
589 (%i1) eq: a > b;
590 (%o1)                              a > b
591 (%i2) 2*eq;
592 (%o2)                            2 (a > b)
593 (%i3) % - eq;
594 (%o3)                              a > b
595 @end example
597 Another problem is 0 times an inequality; the default to have this
598 turn into 0 has been left alone. However, if you type 
599 @code{X*@var{some_inequality}} and Maxima asks about the sign of @code{X} and
600 you respond @code{zero} (or @code{z}), the program returns
601 @code{X*@var{some_inequality}} and not use the information that @code{X} is 0.
602 You should do @code{ev (%, x: 0)} in such a case, as the database will only be
603 used for comparison purposes in decisions, and not for the purpose of evaluating
604 @code{X}.
606 The user may note a slower response when this package is loaded, as
607 the simplifier is forced to examine more rules than without the
608 package, so you might wish to remove the rules after making use of
609 them.  Do @code{kill (rules)} to eliminate all of the rules (including any
610 that you might have defined); or you may be more selective by
611 killing only some of them; or use @code{remrule} on a specific rule.
613 Note that if you load this package after defining your own rules you will
614 clobber your rules that have the same name.  The rules in this package are:
615 @code{*rule1}, @dots{}, @code{*rule8}, @code{+rule1}, @dots{}, @code{+rule18},
616 and you must enclose the rulename in quotes to refer to it, as in
617 @code{remrule ("+", "+rule1")} to specifically remove the first rule on
618 @code{"+"} or @code{disprule ("*rule2")} to display the definition of the
619 second multiplicative rule.
621 @c lrats.usg:"lratsubst" and "fullratsubst" already in doc/info/Polynomials.texi
623 @c Adapted from rducon.usg ----------------------
624 @c THIS IS AN INTERESTING FUNCTION BUT THIS TEXT NEEDS WORK AND EXAMPLES
626 @c -----------------------------------------------------------------------------
627 @node Package rducon, Package scifac, Package ineq, simplification
628 @section Package rducon
629 @c -----------------------------------------------------------------------------
631 @c -----------------------------------------------------------------------------
632 @anchor{reduce_consts}
633 @deffn {Function} reduce_consts (@var{expr})
635 Replaces constant subexpressions of @var{expr} with
636 constructed constant atoms, saving the definition of all these
637 constructed constants in the list of equations @code{const_eqns}, and
638 returning the modified @var{expr}.  Those parts of @var{expr} are constant which
639 return @code{true} when operated on by the function @code{constantp}.  Hence,
640 before invoking @code{reduce_consts}, one should do
642 @example
643 declare ([@var{objects to be given the constant property}], constant)$
644 @end example
646 to set up a database of the constant quantities occurring in your
647 expressions.
649 If you are planning to generate Fortran output after these symbolic
650 calculations, one of the first code sections should be the calculation
651 of all constants.  To generate this code segment, do
653 @example
654 map ('fortran, const_eqns)$
655 @end example
657 Variables besides @code{const_eqns} which affect @code{reduce_consts} are:
659 @code{const_prefix} (default value: @code{xx}) is the string of characters used to prefix all
660 symbols generated by @code{reduce_consts} to represent constant subexpressions.
662 @code{const_counter} (default value: 1) is the integer index used to generate unique
663 symbols to represent each constant subexpression found by @code{reduce_consts}.
665 @code{load("rducon")} loads this function.
666 @code{demo(rducon)} shows a demonstration of this function.
667 @end deffn
669 @c rncomb.usg: "rncombine" already in doc/info/Miscellaneous.texi
671 @c Adapted from scifac.usg ----------------------
673 @c -----------------------------------------------------------------------------
674 @node Package scifac, Package sqdnst, Package rducon, simplification
675 @section Package scifac
676 @c -----------------------------------------------------------------------------
678 @c -----------------------------------------------------------------------------
679 @anchor{gcfac}
680 @deffn {Function} gcfac (@var{expr})
682 @code{gcfac} is a factoring function that attempts to apply the same heuristics
683 which scientists apply in trying to make expressions simpler.  @code{gcfac} is
684 limited to monomial-type factoring.  For a sum, @code{gcfac} does the following:
686 @enumerate
687 @item
688 Factors over the integers.
689 @item
690 Factors out the largest powers of terms occurring as
691 coefficients, regardless of the complexity of the terms.
692 @item
693 Uses (1) and (2) in factoring adjacent pairs of terms.
694 @item
695 Repeatedly and recursively applies these techniques until
696 the expression no longer changes.
697 @end enumerate
699 Item (3) does not necessarily do an optimal job of pairwise
700 factoring because of the combinatorially-difficult nature of finding
701 which of all possible rearrangements of the pairs yields the most
702 compact pair-factored result.
704 @code{load("scifac")} loads this function.
705 @code{demo(scifac)} shows a demonstration of this function.
706 @end deffn
708 @c Adapted from sqdnst.usg ----------------------
709 @c THIS FUNCTION IS INTERESTING BUT THIS TEXT NEEDS WORK. HOW DEEPLY CAN SQRT
710 @c BE NESTED ??
712 @c -----------------------------------------------------------------------------
713 @node Package sqdnst,  , Package scifac, simplification
714 @section Package sqdnst
715 @c -----------------------------------------------------------------------------
717 @c -----------------------------------------------------------------------------
718 @anchor{sqrtdenest}
719 @deffn {Function} sqrtdenest (@var{expr})
721 Denests @code{sqrt} of simple, numerical, binomial surds, where possible.  E.g.
723 @c ===beg===
724 @c load ("sqdnst")$
725 @c sqrt(sqrt(3)/2+1)/sqrt(11*sqrt(2)-12);
726 @c sqrtdenest(%);
727 @c ===end===
728 @example
729 (%i1) load ("sqdnst")$
730 (%i2) sqrt(sqrt(3)/2+1)/sqrt(11*sqrt(2)-12);
731                                     sqrt(3)
732                                sqrt(------- + 1)
733                                        2
734 (%o2)                        ---------------------
735                              sqrt(11 sqrt(2) - 12)
736 (%i3) sqrtdenest(%);
737                                   sqrt(3)   1
738                                   ------- + -
739                                      2      2
740 (%o3)                            -------------
741                                     1/4    3/4
742                                  3 2    - 2
743 @end example
745 Sometimes it helps to apply @code{sqrtdenest} more than once, on such as
746 @code{(19601-13860 sqrt(2))^(7/4)}.
748 @code{load("sqdnst")} loads this function.
749 @end deffn
751 @c stopex.usg: "expandwrt", "expandwrt_denom", and "expandwrt_factored" already
752 @c in doc/info/Simplification.texi
754 @c --- End of file simplifications.de.texi -------------------------------------