% Fixed-point iteration for computing the square root
%

function nonl()
a = 2;
exact = sqrt(a);
x = 1;
err = abs(x - exact);
tol = 1.0e-12;
fprintf(1, '%23.16f %23.16f\n', x, err);

while err > tol
	x = heron(x,a);
	err = abs(x - exact);
	fprintf(1, '%23.16f %23.16f\n', x, err);
end

function out=heron(x,a)
out = 0.5*(x + a/x);
