/usr/lib/open-axiom/input/newton.input is in open-axiom-test 1.4.1+svn~2626-2ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | --Copyright The Numerical Algorithms Group Limited 1994.
-- 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
|