Iteration is a method of re-inputting an output into a function to get closer and closer to the root. To find the root of f(x), you let f(x)=0 and rearrange into the format x=g(x), then iterate as follows, xn=g(xn−1). The result will either converge closer to a root or diverge further from the root.
Iterative function
To make an iterative function, the formula must be in the format x=g(x). To begin, let f(x)=0 and rearrange.
Example 1
Find three iterative functions for f(x)=x2−2x−1.
First, let f(x)=0
f(x)0=x2−2x−1=x2−2x−1
Then rearrange as you wish to. There are two functions you can make by moving x2.
x2=2x+1
x=2x+1
x=2+x1
Another can be made by moving −2x.
2xx=x2−1=2x2−1
Iteration: xn=g(xn−1)
With an iterative function in the form x=g(x), you will find subsequent x values with the aim of getting closer to the root. You use an x0 value to find x1, use x1 to find x2 and so on.
The previous example showed a diverging iteration: xn grew increasingly larger and diverged from the root. The opposite of this is a converging iteration, where xn gets closer to the root.
Example 3
Use x=2+x1 and x0=2 to find a root rounded to 3d.p.