diff options
Diffstat (limited to 'src/input/is.input.pamphlet')
-rw-r--r-- | src/input/is.input.pamphlet | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/input/is.input.pamphlet b/src/input/is.input.pamphlet new file mode 100644 index 00000000..4f451c22 --- /dev/null +++ b/src/input/is.input.pamphlet @@ -0,0 +1,51 @@ +\documentclass{article} +\usepackage{axiom} +\begin{document} +\title{\$SPAD/src/input is.input} +\author{The Axiom Team} +\maketitle +\begin{abstract} +\end{abstract} +\eject +\tableofcontents +\eject +\section{License} +<<license>>= +--Copyright The Numerical Algorithms Group Limited 1991. +@ +<<*>>= +<<license>> + +-- This is the 3n + 1 function: f(n) = n/2 if n is even, +-- 3n + 1 otherwise +-- +-- It can obviously be coded as +-- f n == +-- even? n => n quo 2 +-- 3 * n + 1 + +-- but we code using the pattern matching syntax: +-- f n == +-- n is 2*m% => m% +-- 3 * n + 1 + +-- The 'integer' is to return an integer instead of a polynomial +f n == + not empty?(u := Is(n, 2*m%)) => integer eval(m%, u) + 3 * n + 1 + +)set stream showall on + +-- The function g generates the stream of the repeated applications of f +g(n:INT):STREAM(INT) == generate(f, n) + +-- There is a conjecture that g(n) gets into the cycle (1 4 2) +-- for every n +s := g 27 +extend(s, 150) +@ +\eject +\begin{thebibliography}{99} +\bibitem{1} nothing +\end{thebibliography} +\end{document} |