aboutsummaryrefslogtreecommitdiff
path: root/src/input/newton.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/newton.input.pamphlet
downloadopen-axiom-ab8cc85adde879fb963c94d15675783f2cf4b183.tar.gz
Initial population.
Diffstat (limited to 'src/input/newton.input.pamphlet')
-rw-r--r--src/input/newton.input.pamphlet57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/input/newton.input.pamphlet b/src/input/newton.input.pamphlet
new file mode 100644
index 00000000..8a3df52c
--- /dev/null
+++ b/src/input/newton.input.pamphlet
@@ -0,0 +1,57 @@
+\documentclass{article}
+\usepackage{axiom}
+\begin{document}
+\title{\$SPAD/src/input newton.input}
+\author{The Axiom Team}
+\maketitle
+\begin{abstract}
+\end{abstract}
+\eject
+\tableofcontents
+\eject
+\section{License}
+<<license>>=
+--Copyright The Numerical Algorithms Group Limited 1994.
+@
+<<*>>=
+<<license>>
+-- Newton's Iteration function
+
+-- newtonStep(f) returns a newton's iteration function for the
+-- expression f.
+
+newtonStep(f) ==
+ fun := complexNumericFunction f
+ deriv := complexDerivativeFunction(f,1)
+ (b:Complex DoubleFloat):Complex DoubleFloat +->
+ b - fun(b)/deriv(b)
+
+-- create complex numeric functions from an expression
+
+complexFunPack := MakeUnaryCompiledFunction(EXPR INT, Complex DoubleFloat, Complex DoubleFloat)
+
+-- create a complex numeric function from an expression
+complexNumericFunction x ==
+ v := theVariable x
+ compiledFunction(x, v)$complexFunPack
+
+-- create a complex numeric derivatiave function from an expression
+complexDerivativeFunction(x,n) ==
+ v := theVariable x
+ df := differentiate(x,v,n)
+ compiledFunction(df, v)$complexFunPack
+
+-- return the unique variable in x, or an error if it is multivariate
+theVariable x ==
+ vl := variables x
+ nv := # vl
+ nv > 1 => error "Expression is not univariate."
+ nv = 0 => 'x
+ first vl
+
+@
+\eject
+\begin{thebibliography}{99}
+\bibitem{1} nothing
+\end{thebibliography}
+\end{document}