function res = iteration(func,startingValue,iter)
% iterative call, e.g iteration(@cos,0.1,10)
  res = zeros(1,iter);      % reserve enough space for the result
  res(1) =  startingValue;  % set the starting value
  for k = 2:iter
    res(k) = func(res(k-1)); % evaluate the function
  end
end
