File: scifac.dmo

package info (click to toggle)
maxima 5.6-17
  • links: PTS
  • area: main
  • in suites: woody
  • size: 30,572 kB
  • ctags: 47,715
  • sloc: ansic: 154,079; lisp: 147,553; asm: 45,843; tcl: 16,744; sh: 11,057; makefile: 7,198; perl: 1,842; sed: 334; fortran: 24; awk: 5
file content (64 lines) | stat: -rw-r--r-- 2,472 bytes parent folder | download | duplicates (14)
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
/*-*-MACSYMA-*-*/
if properties(gcfac) = [] then load(scifac)$
/* Since GCFAC has some capability in common with FACTOR and FACTORSUM, we
   begin by illustrating some of this capability with EXP1 :              */
exp1:a*u+a*t*r+a*v*s*x;
gcfac(exp1);
factor(exp1);
factorsum(exp1);
/* Another case where there is some overlap can be seen in EXP2, an
   expression with complex exponents.                               */
exp2:y+a^(r*t*sin(th)/y+u*v+5)+a^(r*t*sin(th)/y+u*v);
gcfac(exp2);
factor(exp2);
factorsum(exp2);
/* GCFAC will sometimes produce results identical with HORNER. */
declare(a,mainvar)$
exp3:a+a^2*u+a^3*b*t+a^4*h^2+a^5+a^6*y+t*z;
horner(exp3);
gcfac(exp3);
remove(a,mainvar)$
/* If there is no knowledge of a MAINVAR, GCFAC can produce results
   superior to HORNER.
   FACTORSUM yields no improvement in this case. */
exp3:ev(exp3);
horner(exp3);
gcfac(exp3);
factorsum(exp3);
/* Next, we embed a subexpression which will factor in an expression which
   will not at top level.  This is illustrated in exp4 :                   */
exp4:a+s*w*x+b*v*z+w*y*r;
gcfac(exp4);
factorsum(exp4);
/* GCFAC can uncover factoring which is not immediately obvious from
   the toplevel expression.  Notice the innermost level of factoring
   in the following example.                                          */
exp5:h*w+p*q*s*t+b*g*q+g*h*p+a*f*g*h;
gcfac(exp5);
factorsum(exp5);
/* A similar effect is illustrated in the following case: */
exp6:h*u^5+r*u^6+s*r*u^8+r*z;
gcfac(exp6);
factorsum(exp6);
/* Repeated pair-factoring on an expression is illustrated in the 
   following two examples.                                        */
exp7:m+n*q+p*u+p*r*q*w+p*r*t*u+p*r*t*v;
gcfac(exp7);
factorsum(exp7);
exp8:-v*w+h*w+r*s*h-r*s*l+r*t*u+r*t*v;
gcfac(exp8);
factorsum(exp8);
/* Unfortunately, if the best ordering for factoring the pairs of terms
   in a sum is not the one generated by the simplifier, GCFAC cannot
   currently deal with it.  The following example demonstrates this
   shortcoming.                                                        */
exp9:b*v+a*u+c*t+a;
gcfac(exp9);
/* While GCFAC can deal with expressions which have not been rationally
   simplified, it is probably best to put expressions in rational form
   before calling GCFAC.  Two forms of EXP10 are used to point out the
   tradeoffs.                                                           */
exp10:r*s/g+t*u/g^2+v*w/g^3-b*g^2;
gcfac(exp10);
exp11:ratsimp(exp10);
gcfac(exp11);