fprintf ( '\n' );
fprintf ( 'wiggle_secant2\n' );
fprintf ( '  Use the secant method to search for a root of the wiggle function.\n' );

a = 0.70;
b = 1.20;
xtol = 0.000001;
ftol = 0.000001;
itmax = 50;

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

[ a, b, it ] = secant2 ( @(x)wiggle(x), a, b, xtol, ftol, itmax );

fprintf ( '\n' )
fprintf ( '  After %d iterations:\n', it );
fprintf ( '  F(%g) = %g\n', b, wiggle(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 (wiggle(b)) <= ftol ) );

