diff options
author | dos-reis <gdr@axiomatics.org> | 2007-08-14 05:14:52 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2007-08-14 05:14:52 +0000 |
commit | ab8cc85adde879fb963c94d15675783f2cf4b183 (patch) | |
tree | c202482327f474583b750b2c45dedfc4e4312b1d /src/input/eval.input.pamphlet | |
download | open-axiom-ab8cc85adde879fb963c94d15675783f2cf4b183.tar.gz |
Initial population.
Diffstat (limited to 'src/input/eval.input.pamphlet')
-rw-r--r-- | src/input/eval.input.pamphlet | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/src/input/eval.input.pamphlet b/src/input/eval.input.pamphlet new file mode 100644 index 00000000..4cb9d679 --- /dev/null +++ b/src/input/eval.input.pamphlet @@ -0,0 +1,77 @@ +\documentclass{article} +\usepackage{axiom} +\begin{document} +\title{\$SPAD/src/input eval.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 file demonstrate the various eval's available on EXPR, and the +-- handling of formal derivatives. +-- Lines starting with --** are comments indicating that the final syntax +-- will be different. + +)cl all +--** This line will be optional interactively, since the a := f(x**2) +--** will prompt you if you don't declare f this way. +f := operator 'f +a := f(x**2) +b := differentiate(a,x,2) + f 5 +-- This is the 'variable' evaluation, similar to what's available on +-- polynomials: +eval(b, x = x + y) +-- This is the 'kernel' evaluation, allowing you to specify special +-- values. Only the specified value f 5 is affected, not the others: +eval(b, f 5 = 1) +-- This is the 'operator' evaluation, allowing you to specify an actual +-- function for a formal one. ALL the values of f are affected. +--** will eventually use the +-> notation in the eval statement +foo(u:EXPR INT):EXPR INT == exp u +-- So what is b if f were the exponential function? +-- Notice that the formal derivatives will be computed properly now: +c := eval(b, 'f, foo) +-- We can also use that evaluation on 'system' operators, which allows +-- us to replace an actual function by a formal one: +oof(u:EXPR INT):EXPR INT == f u +eval(c, 'exp, oof) +-- It is also possible to give f a derivative without replacing it by +-- a 'concrete' function: +f'(u:EXPR INT):EXPR INT == f u +-- this will make f differentiate like an exponential: +derivative(f,f') +b +--** The coercion is needed to avoid an interpreter bug. +--** This will just be eval(b) eventually: +eval(b, x = x::(EXPR INT)) +differentiate(%, x) +-- This is the 'operator/power' evaluation: suppose that we know that +-- f squared is the exponential, but we do not want to replace f(u) by +-- sqrt(exp u). It is still possible to eliminate higher powers of f +-- in the following way: +a3 := a * a * a +foo +eval(a3,'f,2,foo) +-- Several 'operator' evaluations can be carried out simultaneously: +g := operator 'g +bar(u:EXPR INT):EXPR INT == sin(u) + cos(2*u) +a + g a +eval(%,['f,'g],[foo,bar]) +a3 + g a +-- The grand finale: by now the effect of the following should be clear: +eval(%,['f,'g],[2,1],[foo,bar]) +@ +\eject +\begin{thebibliography}{99} +\bibitem{1} nothing +\end{thebibliography} +\end{document} |