function y = prob3fixed(guess)

% Problem 3 in fixed-point iteration
%
% x = exp(-x)
%
% Returns an array containing all of the successive approximations.
%
%  Requires: prob3eq.m in path that takes one argument.

% This tolerance seems to take about 39 iterations
tolerance = 1e-10;

ret = [guess];   % Starting value
x0 = guess;
x1 = guess;
continue = 1;

% Now iterate
while (continue)
	x0 = x1;
	x1 = prob3eq(x0);
	ret = [ret x1];
	if (abs(x1-x0) < tolerance)
		continue = 0;
	end
end

y = ret;	
