File: simplifications.texi

package info (click to toggle)
maxima 5.21.1-2squeeze
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 94,928 kB
  • ctags: 43,849
  • sloc: lisp: 298,974; fortran: 14,666; perl: 14,325; tcl: 10,494; sh: 4,052; makefile: 2,975; ansic: 471; awk: 24; sed: 7
file content (817 lines) | stat: -rw-r--r-- 27,770 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
@menu
* Introduction to simplification::
* Package absimp::
* Package facexp::
* Package functs::
* Package ineq::
* Package rducon::
* Package scifac::
* Package sqdnst::
@end menu

@node Introduction to simplification, Package absimp, simplification, simplification
@section Introduction to simplification

The directory @code{maxima/share/simplification} contains several scripts
which implement simplification rules and functions,
and also some functions not related to simplification.

@c Adapted from absimp.usg ----------------------

@node Package absimp, Package facexp, Introduction to simplification, simplification
@section Package absimp

The @code{absimp} package contains pattern-matching rules that
extend the built-in simplification rules for the @code{abs} and @code{signum}
functions.
@code{absimp} respects relations
established with the built-in @code{assume} function and by declarations such
as  @code{modedeclare (m, even, n, odd)}  for even or odd integers.

@code{absimp} defines @code{unitramp} and @code{unitstep} functions
in terms of @code{abs} and @code{signum}.

@code{load (absimp)} loads this package.
@code{demo (absimp)} shows a demonstration of this package.

Examples:

@c ===beg===
@c load (absimp)$
@c (abs (x))^2;
@c diff (abs (x), x);
@c cosh (abs (x));
@c ===end===
@example
(%i1) load (absimp)$
(%i2) (abs (x))^2;
                                       2
(%o2)                                 x
(%i3) diff (abs (x), x);
                                      x
(%o3)                               ------
                                    abs(x)
(%i4) cosh (abs (x));
(%o4)                               cosh(x)
@end example

@c disol.usg: "disolate" already in doc/info/Expressions.texi

@c elim.usg: "eliminate" already in doc/info/Polynomials.texi

@opencatbox
@category{Simplification functions} @category{Rules and patterns} @category{Share packages} @category{Package absimp}
@closecatbox


@c Adapted from facexp.usg ----------------------
@c ALL OF THE TEXT IN FACEXP.USG IS VERY VAGUE.
@c I HAVE NO IDEA WHAT THESE FUNCTIONS DO.
@c ALL OF THESE ITEMS NEED TO BE HEAVILY REVISED
@c (ASSUMING THIS PACKAGE IS SOMETHING WE WANT TO INVEST TIME IN)
@node Package facexp, Package functs, Package absimp, simplification
@section Package facexp

@c THIS IS VERY VAGUE. JUST WHAT DOES THIS DO?
The @code{facexp} package contains several related  functions that
provide the user with the ability to structure expressions by controlled
expansion.   This capability  is especially  useful when  the expression
contains variables that have physical meaning, because it is  often true
that the most economical form  of such an expression can be  obtained by
fully expanding the expression with respect to those variables, and then
factoring their coefficients.  While it is  true that this  procedure is
not difficult to carry out using standard Maxima  functions, additional
fine-tuning may also  be desirable, and  these finishing touches  can be
more  difficult to  apply.

The  function @code{facsum}  and its  related forms
provide a convenient means for controlling the structure  of expressions
in this way.  Another function, @code{collectterms}, can be used to add  two or
more expressions that have already been simplified to this form, without
resimplifying the whole expression again.  This function may be
useful when the expressions are very large.

@c CAN'T FIND ANY SUCH FILE "DIAGEVAL".
@c THERE ARE COMMENTED-OUT DEFNS OF FACTENEXPAND, FACEXPTEN, AND FACTORFACEXPTEN
@c IN FACEXP (AND NOWHERE ELSE).
@c COMMENTING OUT THIS TEXT FOR NOW.
@c Note:  @code{factenexpand}, @code{facexpten}, and @code{factorfacexpten}  are available  only
@c after loading @code{diageval}. They are special functions used for  tensor
@c manipulation.

@code{load (facexp)} loads this package.
@code{demo (facexp)} shows a demonstration of this package.

@opencatbox
@category{Expressions} @category{Share packages} @category{Package facexp}
@closecatbox


@c THIS IS VERY VAGUE. JUST WHAT DOES THIS DO?
@c SOME EXAMPLES WOULD HELP HERE
@deffn {Function} facsum (@var{expr}, @var{arg_1}, ..., @var{arg_n})
Returns  a form  of @var{expr}  which depends  on the
arguments @var{arg_1}, ..., @var{arg_n}.
The arguments can be any form suitable for @code{ratvars}, or they can be
lists  of such  forms.  If  the arguments  are not  lists, then  the form
returned is  fully expanded with respect  to the arguments,  and the
coefficients of the arguments are factored.  These  coefficients are
free of the arguments, except perhaps in a non-rational sense.

If any of the arguments are  lists, then all such lists are combined
into  a  single  list,   and  instead  of  calling  @code{factor}   on  the
coefficients  of  the  arguments,  @code{facsum}  calls  itself   on  these
coefficients, using  this newly constructed  single list as  the new
argument list  for this  recursive  call.  This  process can  be  repeated to
arbitrary depth by nesting the desired elements in lists.

It is possible that one may wish to @code{facsum} with respect  to more
complicated subexpressions,  such as  @code{log (x + y)}.  Such  arguments are
also  permissible.   

@c CUTTING THIS OUT, BECAUSE IT IS OBVIOUSLY NOT CORRECT
@c SEE EXAMPLE IN BUG REPORT ID: 2834336 - ratsimp vs facsum
@c With no variable specification, for example @code{facsum (@var{expr})}, the 
@c result returned is the same as that returned by @code{ratsimp (@var{expr})}.

Occasionally the user may wish to obtain any of the  above forms
for expressions which are specified only by their leading operators.
For example, one may wish  to @code{facsum} with respect to all  @code{log}'s.  In
this situation, one may  include among the arguments either  the specific
@code{log}'s which are to be treated in this way, or  alternatively, either
the expression  @code{operator (log)} or @code{'operator (log)}.   If one  wished to
@code{facsum} the expression @var{expr} with respect to the operators @var{op_1}, ..., @var{op_n},
one   would  evaluate  @code{facsum (@var{expr}, operator (@var{op_1}, ..., @var{op_n}))}.
The @code{operator} form may also appear inside list arguments.

In  addition,  the  setting  of  the  switches   @code{facsum_combine}  and
@code{nextlayerfactor} may affect the result of @code{facsum}.

@opencatbox
@category{Package facexp} @category{Expressions}
@closecatbox

@end deffn

@defvr {Global variable} nextlayerfactor
Default value: @code{false}

When @code{nextlayerfactor} is @code{true}, recursive calls  of @code{facsum}
are applied  to  the  factors  of  the  factored  form   of  the
coefficients of the arguments.

When  @code{false}, @code{facsum} is applied to
each coefficient as a whole whenever recusive calls to  @code{facsum} occur.

Inclusion   of   the  atom
@code{nextlayerfactor} in  the argument  list of @code{facsum}  has the  effect of
@code{nextlayerfactor: true}, but for the next level of the expression @i{only}.
Since @code{nextlayerfactor} is  always bound to  either @code{true} or  @code{false}, it
must be presented single-quoted whenever it appears in the argument list of @code{facsum}.

@opencatbox
@category{Package facexp} @category{Expressions}
@closecatbox

@end defvr

@defvr {Global variable} facsum_combine
Default value: @code{true}

@code{facsum_combine} controls the form  of the final result  returned by
@code{facsum}  when  its  argument  is  a  quotient  of   polynomials.   If
@code{facsum_combine} is @code{false}  then the form will  be returned as  a fully
expanded  sum  as described  above,  but if  @code{true},  then  the expression
returned is a ratio of polynomials, with each polynomial in the form
described above.

The @code{true} setting of this switch is useful when one
wants to  @code{facsum} both  the numerator and  denominator of  a rational
expression,  but  does not  want  the denominator  to  be multiplied
through the terms of the numerator.

@opencatbox
@category{Package facexp} @category{Expressions}
@closecatbox

@end defvr

@deffn {Function} factorfacsum (@var{expr}, @var{arg_1}, ... @var{arg_n})
Returns a  form of @var{expr}  which is
obtained by calling  @code{facsum} on the factors  of @var{expr} with @var{arg_1}, ... @var{arg_n} as
arguments.  If any of the factors of @var{expr} is raised to a  power, both
the factor and the exponent will be processed in this way.

@opencatbox
@category{Package facexp} @category{Expressions}
@closecatbox

@end deffn

@deffn {Function} collectterms (@var{expr}, @var{arg_1}, ..., @var{arg_n})
If several  expressions  have been
simplified  with  @code{facsum}, @code{factorfacsum},  @code{factenexpand},  @code{facexpten} or
@code{factorfacexpten},  and  they are  to  be added  together,  it  may be
desirable   to  combine   them  using   the   function  @code{collecterms}.
@code{collecterms} can take as arguments  all of the arguments that  can be
given  to these  other associated  functions with  the  exception of
@code{nextlayerfactor}, which has no effect on @code{collectterms}.  The advantage
of @code{collectterms}  is that it  returns a form  similar to  @code{facsum}, but
since it is adding forms that have already been processed by @code{facsum},
it  does  not  need  to  repeat  that  effort.   This  capability is
especially useful when the expressions to be summed are very large.

@opencatbox
@category{Package facexp} @category{Expressions}
@closecatbox

@end deffn

@c Adapted from functs.usg ----------------------

@c conjugate already described in doc/info/Matrices.texi
@node Package functs, Package ineq, Package facexp, simplification
@section Package functs

@opencatbox
@category{Share packages} @category{Package functs}
@closecatbox

@deffn {Function} rempart (@var{expr}, @var{n})
Removes part @var{n} from the expression @var{expr}.

If @var{n} is a list of the form @code{[@var{l}, @var{m}]}
then parts @var{l} thru @var{m} are removed.

To use this function write first @code{load(functs)}.

@opencatbox
@category{Package functs} @category{Expressions}
@closecatbox

@end deffn

@deffn {Function} wronskian ([@var{f_1}, ..., @var{f_n}], @var{x})
Returns the Wronskian matrix of the list of expressions [@var{f_1}, ..., @var{f_n}] in the variable @var{x}.
The determinant of the Wronskian matrix is the Wronskian determinant of the list of expressions.

To use @code{wronskian}, first @code{load(functs)}. Example:

@c ===beg===
@c load (functs)$
@c wronskian([f(x), g(x)],x);
@c ===end===
@example
(%i1) load(functs)$
(%i2) wronskian([f(x), g(x)],x);
(%o2) matrix([f(x),g(x)],['diff(f(x),x,1),'diff(g(x),x,1)])
@end example

@opencatbox
@category{Package functs} @category{Differential calculus}
@closecatbox

@end deffn

@c adjoint already described in doc/info/Matrices.texi

@deffn {Function} tracematrix (@var{M})
Returns the trace (sum of the diagonal elements) of matrix @var{M}.

To use this function write first @code{load(functs)}.

@opencatbox
@category{Package functs} @category{Matrices}
@closecatbox

@end deffn

@deffn {Function} rational (@code{z})
Multiplies numerator and denominator of @var{z} by the complex conjugate of denominator,
thus rationalizing the denominator.
Returns canonical rational expression (CRE) form if given one, else returns general form.

To use this function write first @code{load(functs)}.

@opencatbox
@category{Package functs} @category{Expressions}
@closecatbox

@end deffn

@deffn {Function} logand (@code{x},@code{y})
Returns logical (bit-wise) "and" of arguments x and y.

To use this function write first @code{load(functs)}.

@opencatbox
@category{Package functs} @category{Mathematical functions}
@closecatbox

@end deffn

@deffn {Function} logor (@code{x},@code{y})
Returns logical (bit-wise) "or" of arguments x and y.

To use this function write first @code{load(functs)}.

@opencatbox
@category{Package functs} @category{Mathematical functions}
@closecatbox

@end deffn

@deffn {Function} logxor (@code{x},@code{y})
Returns logical (bit-wise) exclusive-or of arguments x and y.

To use this function write first @code{load(functs)}.

@opencatbox
@category{Package functs} @category{Mathematical functions}
@closecatbox

@end deffn

@c uprobe calls ?uprobe and assumes file is a list => obsolete, not common lisp

@c kronecker superseded by kron_delta in src/nset.lisp

@deffn {Function} nonzeroandfreeof (@var{x}, @var{expr})
Returns @code{true} if @var{expr} is nonzero and @code{freeof (@var{x}, @var{expr})} returns @code{true}.
Returns @code{false} otherwise.

To use this function write first @code{load(functs)}.

@opencatbox
@category{Package functs} @category{Expressions}
@closecatbox

@end deffn

@deffn {Function} linear (@var{expr}, @var{x})
When @var{expr} is an expression linear in variable @var{x},
@code{linear} returns @code{@var{a}*@var{x} + @var{b}} where @var{a} is nonzero,
and @var{a} and @var{b} are free of @var{x}.
Otherwise, @code{linear} returns @var{expr}.

To use this function write first @code{load(functs)}.

@opencatbox
@category{Package functs} @category{Expressions}
@closecatbox

@end deffn

@deffn {Function} gcdivide (@var{p}, @var{q})
When @code{takegcd} is @code{true},
@code{gcdivide} divides the polynomials @var{p} and @var{q} by their greatest common divisor
and returns the ratio of the results.

When @code{takegcd} is @code{false},
@code{gcdivide} returns the ratio @code{@var{p}/@var{q}}.

To use this function write first @code{load(functs)}.

@opencatbox
@category{Package functs} @category{Polynomials}
@closecatbox

@end deffn

@c lcm already described in doc/info/Number.texi

@deffn {Function} arithmetic (@var{a}, @var{d}, @var{n})
Returns the @var{n}-th term of the arithmetic series
@code{@var{a}, @var{a} + @var{d}, @var{a} + 2*@var{d}, ..., @var{a} + (@var{n} - 1)*@var{d}}.

To use this function write first @code{load(functs)}.

@opencatbox
@category{Package functs} @category{Sums and products}
@closecatbox

@end deffn

@deffn {Function} geometric (@var{a}, @var{r}, @var{n})
Returns the @var{n}-th term of the geometric series
@code{@var{a}, @var{a}*@var{r}, @var{a}*@var{r}^2, ..., @var{a}*@var{r}^(@var{n} - 1)}.

To use this function write first @code{load(functs)}.

@opencatbox
@category{Package functs} @category{Sums and products}
@closecatbox

@end deffn

@deffn {Function} harmonic (@var{a}, @var{b}, @var{c}, @var{n})
Returns the @var{n}-th term of the harmonic series
@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})}.

To use this function write first @code{load(functs)}.

@opencatbox
@category{Package functs} @category{Sums and products}
@closecatbox

@end deffn

@deffn {Function} arithsum (@var{a}, @var{d}, @var{n})
Returns the sum of the arithmetic series from 1 to @var{n}.

To use this function write first @code{load(functs)}.

@opencatbox
@category{Package functs} @category{Sums and products}
@closecatbox

@end deffn

@deffn {Function} geosum (@var{a}, @var{r}, @var{n})
Returns the sum of the geometric series from 1 to @var{n}.  If @var{n} is
infinity (@code{inf}) then a sum is finite only if the absolute value
of @var{r} is less than 1.

To use this function write first @code{load(functs)}.

@opencatbox
@category{Package functs} @category{Sums and products}
@closecatbox

@end deffn

@deffn {Function} gaussprob (@var{x})
Returns the Gaussian probability function
@code{%e^(-@var{x}^2/2) / sqrt(2*%pi)}.

To use this function write first @code{load(functs)}.

@opencatbox
@category{Package functs} @category{Mathematical functions}
@closecatbox

@end deffn

@deffn {Function} gd (@var{x})
Returns the Gudermannian function
@code{2*atan(%e^x)-%pi/2}.

To use this function write first @code{load(functs)}.

@opencatbox
@category{Package functs} @category{Mathematical functions}
@closecatbox

@end deffn

@deffn {Function} agd (@var{x})
Returns the inverse Gudermannian function
@code{log (tan (%pi/4 + x/2)))}.

To use this function write first @code{load(functs)}.

@opencatbox
@category{Package functs} @category{Mathematical functions}
@closecatbox

@end deffn

@deffn {Function} vers (@var{x})
Returns the versed sine @code{1 - cos (x)}.

To use this function write first @code{load(functs)}.

@opencatbox
@category{Package functs} @category{Mathematical functions}
@closecatbox

@end deffn

@deffn {Function} covers (@var{x})
Returns the coversed sine @code{1 - sin (@var{x})}.

To use this function write first @code{load(functs)}.

@opencatbox
@category{Package functs} @category{Mathematical functions}
@closecatbox

@end deffn

@deffn {Function} exsec (@var{x})
Returns the exsecant @code{sec (@var{x}) - 1}.

To use this function write first @code{load(functs)}.

@opencatbox
@category{Package functs} @category{Mathematical functions}
@closecatbox

@end deffn

@deffn {Function} hav (@var{x})
Returns the haversine @code{(1 - cos(x))/2}.

To use this function write first @code{load(functs)}.

@opencatbox
@category{Package functs} @category{Mathematical functions}
@closecatbox

@end deffn

@c REDUNDANT WITH BINOMIAL COEFFICIENT; CUT IT ??
@deffn {Function} combination (@var{n}, @var{r})
Returns the number of combinations of @var{n} objects
taken @var{r} at a time.

To use this function write first @code{load(functs)}.

@opencatbox
@category{Package functs} @category{Mathematical functions}
@closecatbox

@end deffn

@c REDUNDANT WITH PERMUTATIONS FUNCTION IN NSET; CUT IT ??
@deffn {Function} permutation (@var{n}, @var{r})
Returns the number of permutations of @var{r} objects
selected from a set of @var{n} objects.

To use this function write first @code{load(functs)}.

@opencatbox
@category{Package functs} @category{Mathematical functions}
@closecatbox

@end deffn

@c Adapted from ineq.usg ----------------------
@c THIS PACKAGE IS INTERESTING BUT THIS TEXT NEEDS WORK AND EXAMPLES
@node Package ineq, Package rducon, Package functs, simplification
@section Package ineq

The @code{ineq} package contains simplification rules
for inequalities.

Example session:

@c ===beg===
@c load(ineq)$
@c a>=4;  /* a sample inequality */
@c (b>c)+%; /* add a second, strict inequality */
@c 7*(x<y); /* multiply by a positive number */
@c -2*(x>=3*z); /* multiply by a negative number */
@c (1+a^2)*(1/(1+a^2)<=1); /* Maxima knows that 1+a^2 > 0 */
@c assume(x>0)$ x*(2<3); /* assuming x>0 */
@c a>=b; /* another inequality */
@c 3+%; /* add something */
@c %-3; /* subtract it out */
@c a>=c-b; /* yet another inequality */
@c b+%; /* add b to both sides */
@c %-c; /* subtract c from both sides */
@c -%;  /* multiply by -1 */
@c (z-1)^2>-2*z; /* determining truth of assertion */
@c expand(%)+2*z; /* expand this and add 2*z to both sides */
@c %,pred;
@c ===end===
@example
(%i1) load(ineq)$
Warning: Putting rules on '+' or '*' is inefficient, and may not work.
Warning: Putting rules on '+' or '*' is inefficient, and may not work.
Warning: Putting rules on '+' or '*' is inefficient, and may not work.
Warning: Putting rules on '+' or '*' is inefficient, and may not work.
Warning: Putting rules on '+' or '*' is inefficient, and may not work.
Warning: Putting rules on '+' or '*' is inefficient, and may not work.
Warning: Putting rules on '+' or '*' is inefficient, and may not work.
Warning: Putting rules on '+' or '*' is inefficient, and may not work.
(%i2) a>=4;  /* a sample inequality */
(%o2)                               a >= 4
(%i3) (b>c)+%; /* add a second, strict inequality */
(%o3)                            b + a > c + 4
(%i4) 7*(x<y); /* multiply by a positive number */
(%o4)                              7 x < 7 y
(%i5) -2*(x>=3*z); /* multiply by a negative number */
(%o5)                           - 2 x <= - 6 z
(%i6) (1+a^2)*(1/(1+a^2)<=1); /* Maxima knows that 1+a^2 > 0 */
                                        2
(%o6)                             1 <= a  + 1
(%i7) assume(x>0)$ x*(2<3); /* assuming x>0 */
(%o7)                              2 x < 3 x
(%i8) a>=b; /* another inequality */
(%o8)                               a >= b
(%i9) 3+%; /* add something */
(%o9)                           a + 3 >= b + 3
(%i10) %-3; /* subtract it out */
(%o10)                              a >= b
(%i11) a>=c-b; /* yet another inequality */
(%o11)                            a >= c - b
(%i12) b+%; /* add b to both sides */
(%o12)                            b + a >= c
(%i13) %-c; /* subtract c from both sides */
(%o13)                         - c + b + a >= 0
(%i14) -%;  /* multiply by -1 */
(%o14)                          c - b - a <= 0
(%i15) (z-1)^2>-2*z; /* determining truth of assertion */
                                      2
(%o15)                         (z - 1)  > - 2 z
(%i16) expand(%)+2*z; /* expand this and add 2*z to both sides */
                                   2
(%o16)                            z  + 1 > 0
(%i17) %,pred;
(%o17)                               true
@end example

Be careful about using parentheses
around the inequalities: when the user types in @code{(A > B) + (C = 5)} the
result is @code{A + C > B + 5}, but @code{A > B + C = 5} is a syntax error,
and @code{(A > B + C) = 5} is something else entirely.

Do @code{disprule (all)} to see a complete listing
of the rule definitions.

The user will be queried if Maxima is
unable to decide the sign of a quantity multiplying an inequality.

The most common mis-feature is illustrated by:

@c ===beg===
@c eq: a > b;
@c 2*eq;
@c % - eq;
@c ===end===
@example
(%i1) eq: a > b;
(%o1)                              a > b
(%i2) 2*eq;
(%o2)                            2 (a > b)
(%i3) % - eq;
(%o3)                              a > b
@end example

Another problem is 0 times an inequality; the default to have this
turn into 0 has been left alone. However, if you type 
@code{X*@var{some_inequality}} and Maxima asks about the sign of @code{X} and you
respond @code{zero} (or @code{z}), the program returns @code{X*@var{some_inequality}}
and not use the information that @code{X} is 0. You should do @code{ev (%, x: 0)} in such
a case, as the database will only be used for comparison purposes
in decisions, and not for the purpose of evaluating @code{X}.

The user may note a slower response when this package is loaded, as
the simplifier is forced to examine more rules than without the
package, so you might wish to remove the rules after making use of
them. Do @code{kill (rules)} to eliminate all of the rules (including any
that you might have defined); or you may be more selective by
killing only some of them; or use @code{remrule} on a specific rule.

Note that if you load this package after defining your own
rules you will clobber your rules that have the same name. The
rules in this package are:
@code{*rule1}, ..., @code{*rule8},
@code{+rule1}, ..., @code{+rule18},
and you must enclose the rulename in quotes to refer to it, as
in @code{remrule ("+", "+rule1")} to specifically remove the first rule on @code{"+"}
or @code{disprule ("*rule2")} to display the definition of the second multiplicative rule.

@opencatbox
@category{Simplification functions} @category{Rules and patterns} @category{Share packages} @category{Package ineq}
@closecatbox


@c lrats.usg: "lratsubst" and "fullratsubst" already in doc/info/Polynomials.texi

@c Adapted from rducon.usg ----------------------
@c THIS IS AN INTERESTING FUNCTION BUT THIS TEXT NEEDS WORK AND EXAMPLES
@node Package rducon, Package scifac, Package ineq, simplification
@section Package rducon

@opencatbox
@category{Expressions} @category{Share packages} @category{Package rducon}
@closecatbox


@deffn {Function} reduce_consts (@var{expr})
Replaces constant subexpressions of @var{expr} with
constructed constant atoms, saving the definition of all these
constructed constants in the list of equations @code{const_eqns}, and
returning the modified @var{expr}.  Those parts of @var{expr} are constant which
return @code{true} when operated on by the function @code{constantp}.  Hence,
before invoking @code{reduce_consts}, one should do

@example
declare ([@var{objects to be given the constant property}], constant)$
@end example

to set up a database of the constant quantities occurring in your
expressions.

If you are planning to generate Fortran output after these symbolic
calculations, one of the first code sections should be the calculation
of all constants.  To generate this code segment, do

@example
map ('fortran, const_eqns)$
@end example

Variables besides @code{const_eqns} which affect @code{reduce_consts} are:

@code{const_prefix} (default value: @code{xx}) is the string of characters used to prefix all
symbols generated by @code{reduce_consts} to represent constant subexpressions.

@code{const_counter} (default value: 1) is the integer index used to generate unique
symbols to represent each constant subexpression found by @code{reduce_consts}.

@code{load (rducon)} loads this function.
@code{demo (rducon)} shows a demonstration of this function.

@opencatbox
@category{Package rducon} @category{Expressions}
@closecatbox

@end deffn

@c rncomb.usg: "rncombine" already in doc/info/Miscellaneous.texi

@c Adapted from scifac.usg ----------------------
@node Package scifac, Package sqdnst, Package rducon, simplification
@section Package scifac

@opencatbox
@category{Expressions} @category{Share packages} @category{Package scifac}
@closecatbox


@deffn {Function} gcfac (@var{expr})
@code{gcfac} is a factoring function that attempts to apply the same heuristics which
scientists apply in trying to make expressions simpler.  @code{gcfac} is limited
to monomial-type factoring.  For a sum, @code{gcfac} does the following:

@enumerate
@item
Factors over the integers.
@item
Factors out the largest powers of terms occurring as
coefficients, regardless of the complexity of the terms.
@item
Uses (1) and (2) in factoring adjacent pairs of terms.
@item
Repeatedly and recursively applies these techniques until
the expression no longer changes.
@end enumerate

Item (3) does not necessarily do an optimal job of pairwise
factoring because of the combinatorially-difficult nature of finding
which of all possible rearrangements of the pairs yields the most
compact pair-factored result.

@code{load (scifac)} loads this function.
@code{demo (scifac)} shows a demonstration of this function.

@opencatbox
@category{Package scifac} @category{Expressions}
@closecatbox

@end deffn

@c Adapted from sqdnst.usg ----------------------
@c THIS FUNCTION IS INTERESTING BUT THIS TEXT NEEDS WORK. HOW DEEPLY CAN SQRT BE NESTED ??
@node Package sqdnst,  , Package scifac, simplification
@section Package sqdnst

@deffn {Function} sqrtdenest (@var{expr})
Denests @code{sqrt} of simple, numerical, binomial surds, where possible.  E.g.

@c ===beg===
@c load (sqdnst)$
@c sqrt(sqrt(3)/2+1)/sqrt(11*sqrt(2)-12);
@c sqrtdenest(%);
@c ===end===
@example
(%i1) load (sqdnst)$
(%i2) sqrt(sqrt(3)/2+1)/sqrt(11*sqrt(2)-12);
                                    sqrt(3)
                               sqrt(------- + 1)
                                       2
(%o2)                        ---------------------
                             sqrt(11 sqrt(2) - 12)
(%i3) sqrtdenest(%);
                                  sqrt(3)   1
                                  ------- + -
                                     2      2
(%o3)                            -------------
                                    1/4    3/4
                                 3 2    - 2
@end example

Sometimes it helps to apply @code{sqrtdenest} more than once, on such as
@code{(19601-13860 sqrt(2))^(7/4)}.

@code{load (sqdnst)} loads this function.

@opencatbox
@category{Expressions} @category{Share packages} @category{Package sqdnst}
@closecatbox

@end deffn

@c stopex.usg: "expandwrt", "expandwrt_denom", and "expandwrt_factored" already in doc/info/Simplification.texi