Activate me before using this worksheet.
Activate the following input cell to define the function iterate . (Place the cursor in the input cell and hit the enter key.) This function is used by the Euler's Method program used in this worksheet. After activating the input cell, close you can close this paragraph.
>
# This execution cell defines a useful funtion that enables
# us to iterate a function f a given number of times with a
# given starting value. It generates a list
# [a, f(a), f(f(a)), f(f(f(a))), ...] (with n+1 terms)
iterate:=proc(f,a,n)
local term,result,i;
term:=a;
result:=a;
for i from 1 to n do
term:=f(term);
result:=result,term;
od;
RETURN([result]);
end:
Go back