A large number of algorithms in my field involve finding the fixed point of an operator. Are there any good libraries out there that do this (i.e. properly generic, testing out corner cases, etc.) Of course, a simple version of this can be written within the algorithm itself, but I would rather train students to think things through mathematically, and having a library means fancier methods could be used in the future for the fixed point iteration. (Mathematica’s version is http://reference.wolfram.com/language/ref/FixedPoint.html but I don’t think it gives enough control on the norm, in my opinion).
Is there anything? An example of a mediocre example of what I am interested in is below
function fixedpoint(f, x0; residualnorm = (x -> norm(x,Inf)), tol = 1E-10, maxiter=100)
residual = Inf
iter = 1
xold = x0
while residual > tol && iter < maxiter
xnew = f(xold)
residual = residualnorm(xold - xnew);
xold = xnew
iter += 1
end
return xold
end
#Calling it
f(x) = 0.5 * x + 1.0
fixedpoint(f, 1.0)
In terms of other stuff I might expect in the library: Anderson acceleration and Newton’s method of fixed point iteration would be great (where the latter might use AD).