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

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

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

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

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

