Iter is a package of simple tools for studying the sequences a, f(a), f(f(a)), f(f(f(a))), ... obtained by repeatedly applying a function f to an initial value a. To iterate something is to do it repeatedly.
Source Code (You can copy this from your browser and paste it into Maple).
double := x -> 2*x;Then
iterprint( double, 4, 1 );applies double a total of four times to compute and print the sequence 1, 2, 4, 8, 16. The command
iterplot( double, 4, 1 );computes the same sequence but displays a plot of it instead of "printing."
Note: If you need to store the sequence for later manipulation, try
results := iter( double, 4, 1 );To display this variable use print(results) or printarray(results).
quad := x -> k*x*(1-x);Try different values of the parameter k and the initial value. Use k in the range 1 to 4 and the initial value in the range 0 to 1.
k := 3.0;
iterplot( quad, 40, 0.1 );
k := 4.0;
iterplot( quad, 40, 0.1 );
iterplot2( quad, quad, 40, 0.1, 0.9 );
k := 2.5; cobweb( quad, 10, 0.1, 0..1 );This example "cobwebs" quad 10 times on the interval 0..1 with an initial value of 0.1.
f := x -> x*x - 2;Newton tells us to iterate the function
g(x) = x - f(x)/f'(x)with a reasonable guess for the starting value. Try the example below, which iterates g 10 times with 1 as initial value.
g := x -> (x*x + 2)/(2.0*x);
iterprint( g, 10, 1 );