aboutsummaryrefslogtreecommitdiff
path: root/src/input/rules.input.pamphlet
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2007-08-14 05:14:52 +0000
committerdos-reis <gdr@axiomatics.org>2007-08-14 05:14:52 +0000
commitab8cc85adde879fb963c94d15675783f2cf4b183 (patch)
treec202482327f474583b750b2c45dedfc4e4312b1d /src/input/rules.input.pamphlet
downloadopen-axiom-ab8cc85adde879fb963c94d15675783f2cf4b183.tar.gz
Initial population.
Diffstat (limited to 'src/input/rules.input.pamphlet')
-rw-r--r--src/input/rules.input.pamphlet66
1 files changed, 66 insertions, 0 deletions
diff --git a/src/input/rules.input.pamphlet b/src/input/rules.input.pamphlet
new file mode 100644
index 00000000..ab7e6981
--- /dev/null
+++ b/src/input/rules.input.pamphlet
@@ -0,0 +1,66 @@
+\documentclass{article}
+\usepackage{axiom}
+\begin{document}
+\title{\$SPAD/src/input rules.input}
+\author{The Axiom Team}
+\maketitle
+\begin{abstract}
+\end{abstract}
+\eject
+\tableofcontents
+\eject
+\section{License}
+<<license>>=
+--Copyright The Numerical Algorithms Group Limited 1991.
+@
+<<*>>=
+<<license>>
+
+)clear all
+-- first a single rule
+logrule := rule log(x) + log(y) == log(x * y)
+f := log sin x + log x
+logrule f
+
+-- now a pile of several rules
+logrules := rule
+ log(x) + log(y) == log(x * y)
+ y * log x == log(x ** y)
+f := a * log(sin x) - 2 * log x
+logrules f
+
+-- example of a predicate attached to a pattern variable
+logrules2 := rule
+ log(x) + log(y) == log(x * y)
+ (y | integer? y) * log x == log(x ** y)
+logrules2 f
+
+-- rules for linearizing sines and cosines
+trigLinearize := 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 > 1) == (1-cos(2*x))/2 * sin(x)**(n-2)
+ cos(x) ** (n | integer? n and n > 1) == (1+cos(2*x))/2 * cos(x)**(n-2)
+g := sin(a)*cos(b) + sin(a)*cos(a) + cos(2*a)*cos(3*a)
+trigLinearize g
+
+-- here we show the use of ? to indicate an 'optional' pattern variables
+eirule := rule integral((?y + exp x)/x,x) == integral(y/x,x) + Ei x
+eirule integral(exp u/u, u)
+eirule integral(sin u + exp u/u, u)
+
+-- here we show the use of : to indicate a 'multiple' pattern variables
+u := operator u
+v := operator v
+myrule := rule u(x + y) == u x + v y
+h := u(a + b + c + d)
+myrule h
+myrule2 := rule u(:x + y) == u x + v y
+myrule2 h
+@
+\eject
+\begin{thebibliography}{99}
+\bibitem{1} nothing
+\end{thebibliography}
+\end{document}