Jump to user comments
programming Repetition of a sequence of instructions. A
characterised by a set of initial conditions, an iterative
step and a termination condition.
A well known example of iteration in mathematics is
Newton-Raphson iteration. Iteration in programs is expressed
new_x = n/2;
do
Iteration can be expressed in functional languages using
recursion:
solve x n = if abs(new_x-x) @# epsilon
then solve new_x n
else new_x
where new_x = 0.5 * (x + n/x)
solve n/2 n
(1998-04-04)