Fix #4352: elliptic_e(1,1.23) signals lisp error on complex number
[maxima.git] / archive / share / unknown / trgsum.usg
blob3ae07baac4f06468a01e5ffecfe2bc5328a301ec
1 Date: 16 DEC 1980 2010-EST
2 From: LSH at MIT-MC (Lars S. Hornfeldt)
3 Subject: Human-like new TRIG-SIMPLIFIER and SUMSUBSTITUTOR
4 To: INFO-MACSYM at MIT-MC, INFO-TENSOR at MIT-MC, HEP at MIT-MC
7 TRIGSUM(exp);  is a new function (autoloading) that exploits the
8 TRIG-onometric SUM-relation:     2         2
9                               sin (x) + cos (x) - 1  ==> 0
11 in an optimal fashion; ie it uses DIFFERENT formulations:
12    2      2                   2        2             2        2
13 sin  + cos  ==> 1,     1 - sin  ==> cos ,     1 - cos  ==> sin
15 selectively only where they are BENEFICIAL, and the program returns
16 THAT mixture of sin and cos that constitutes the least number of terms.
17 For instance, TRIGSUM on the 6-term-expression:
19   (ONE - C     )*SIN(X)^2 \  Returns 3 terms: /    (      S)*SIN(X)^2
20 + (ONE      - S)*COS(X)^2  >      ===>       <   + (    C  )*COS(X)^2
21 + (    + C  + S)          /                   \  + (ONE    )
23 This works equally well and fast if multiplied with any sin-cos power.
25 TRIGSUM uses the sum-substitutor (=1yr work) in STENSR. For references
26 and pointers see SHARE;STENSR USAGE.  Any arb.-length-sum of arb.-length-
27 products of tensors can be substituted, and in PRINCIPLE also of scalars.
28 Send bugs, and such sum-relations that you want to exploit, to me.
30 Being a complicated program, it's not small, but you can ALWAYS type
31 TRIGSUM(..);  since it tests space to fit the program before it autoloads.
32 Also the workspace consumption =0, in contrast to explicit subst. sin=>cos.
34 Do   :PRINT LSH;TRGSUM DEMOUT    to see a demo writefile, or run the demo
35 itself by  DEMO(TRGSUM,DEMO,DSK,LSH)$   which takes 5 cpu-min to end
36 [but (a curiosum): substituting sin=>cos would give results requiring
37 an Earthsized machine to store, and would take 10^7 Universe-lifetimes].
39 -lsh
40 \x1f