fprintf ( '\n' );
fprintf ( 'trig_regula_falsi\n' );
fprintf ( '  Use regula_falsi to estimate a root of the trig equation.\n' );

xn = 1.0;
xp = 0.0;
xtol = 0.000001;
ftol = 0.000001;
itmax = 50;

fprintf ( '\n' );
fprintf ( '  F(%g) = %g\n', xn, trig(xn) );
fprintf ( '  F(%g) = %g\n', xp, trig(xp) );

[ xn, xp, it ] = regula_falsi ( @(x)trig(x), xn, xp, xtol, ftol, itmax );

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

