Stopping an iteration when values get close together?
I'm doing a little numerical work, and I can create an iteration and run it, either in the spreadsheet view or else with IterationList. However, I'd like to run it until consecutive values reach a certain closeness (or after a fixed number of iterations, whichever comes first).
Thus a command something like
IterationsUntil(f, x0, n, eps)
will run an iteration x <- f(x) until either n steps, or until two consecutive values differ in absolute value by eps. It could be used as