fprintf ( '\n' );
fprintf ( 'kepler_secant\n' );
fprintf ( '  Use the secant method to search for a root of Kepler''s function.\n' );

a = 0.0;
b = 10.0;
xtol = 0.000001;
ftol = 0.000001;
itmax = 50;

fprintf ( '\n' );
fprintf ( '  F(%g) = %g\n', a, kepler(a) );
fprintf ( '  F(%g) = %g\n', b, kepler(b) );

[ a, b, it ] = secant ( @(x)kepler(x), a, b, xtol, ftol, itmax );

fprintf ( '\n' )
fprintf ( '  After %d iterations:\n', it );
fprintf ( '  F(%g) = %g\n', b, kepler(b) );
fprintf ( '\n' );
fprintf ( '  it <= itmax?  %s\n', mat2str ( it <= itmax ) );
fprintf ( '  |a-b| <= xtol?  %s\n', mat2str ( abs ( a - b ) <= xtol ) );
fprintf ( '  |f(b)| <= ftol?  %s\n', mat2str ( abs (kepler(b)) <= ftol ) );

