$SPAD/src/input ruleset.input

Timothy Daly December 3, 2016

Abstract

Contents

2

1 License

— license —

--Copyright The Numerical Algorithms Group Limited 1991.

———-

— * —

)set break resume
)spool ruleset.output
)set message test on
)set message auto off
)clear all

———-

This is the example from ”Programming in Mathematica”, p.139 — * —

--S 1 of 9
TrigLinearRules := rule
   sin(x) * sin(y) == cos(x-y)/2 - cos(x+y)/2
   cos(x) * cos(y) == cos(x+y)/2 + cos(x-y)/2
   sin(x) * cos(y) == sin(x+y)/2 + sin(x-y)/2
   sin(x)**(n | integer? n and n > 0) == (1-cos(2*x))/2 * sin(x)**(n-2)
   cos(x)**(n | integer? n and n > 0) == (1+cos(2*x))/2 * cos(x)**(n-2)
--R
--R
--R   (1)
--R                       - %B cos(y + x) + %B cos(y - x)
--R   {%B sin(x)sin(y) == -------------------------------,
--R                                      2
--R                       %C cos(y + x) + %C cos(y - x)
--R    %C cos(x)cos(y) == -----------------------------,
--R                                     2
--R                       %D sin(y + x) - %D sin(y - x)
--R    %D cos(y)sin(x) == -----------------------------,
--R                                     2
--R                                    n - 2                                n - 2
--R          n    (- cos(2x) + 1)sin(x)             n    (cos(2x) + 1)cos(x)
--R    sin(x)  == --------------------------, cos(x)  == ------------------------}
--R                            2                                     2
--R                           Type: Ruleset(Integer,Integer,Expression(Integer))
--E 1
--S 2 of 9
sin(a)*cos(b) + sin(a)*cos(a) + cos(2*a)*cos(3*a)
--R

--R
--R   (2)  (cos(b) + cos(a))sin(a) + cos(2a)cos(3a)
--R                                                    Type: Expression(Integer)
--E 2
--S 3 of 9
TrigLinearRules %
--R
--R
--R        sin(b + a) - sin(b - a) + sin(2a) + cos(5a) + cos(a)
--R   (3)  ----------------------------------------------------
--R                                  2
--R                                                    Type: Expression(Integer)
--E 3
--S 4 of 9
sin(a) * sin(2*a) * sin(3*a) * sin(4*a)
--R
--R
--R   (4)  sin(a)sin(2a)sin(3a)sin(4a)
--R                                                    Type: Expression(Integer)
--E 4
--S 5 of 9
TrigLinearRules %
--R
--R
--R        cos(10a) - cos(8a) - cos(6a) + 1
--R   (5)  --------------------------------
--R                        8
--R                                                    Type: Expression(Integer)
--E 5

———-

Defining an operator to be linear w.r.t. its 2nd argument — * —

--S 6 of 9
f := operator 'f
--R
--R
--R   (6)  f
--R                                                          Type: BasicOperator
--E 6
--S 7 of 9
FLinearRules := rule
  f(a + b, x) == f(a, x) + f(b, x)
  f(c * a, x | freeOf?(c, x)) == c * f(a, x)

--R
--R
--R   (7)  {f(b + a,x) == 'f(b,x) + 'f(a,x),f(a c,x) == c'f(a,x)}
--R                           Type: Ruleset(Integer,Integer,Expression(Integer))
--E 7
--S 8 of 9
f(2*x + a * log(x) + x * log(x), x)
--R
--R
--R   (8)  f((x + a)log(x) + 2x,x)
--R                                                    Type: Expression(Integer)
--E 8
--S 9 of 9
FLinearRules %
--R
--R
--R   (9)  (f(x,x) + f(a,x))log(x) + 2f(x,x)
--R                                                    Type: Expression(Integer)
--E 9
)spool
)lisp (bye)

———-

References^{[1] nothing}

6