blob: ab7e6981f6d2fdf1af51ac7e769890962c642553 (
plain)
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
|
\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}
|