function zero_rc_test ( )

%*****************************************************************************80
%
%% zero_rc_test() tests zero_rc().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    29 May 2021
%
%  Author:
%
%    John Burkardt
%
  addpath ( '../zero_rc' );

  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'zero_rc_test():\n' );
  fprintf ( 1, '  MATLAB/Octave version %s.\n', version ( ) );
  fprintf ( 1, '  zero_rc() seeks a root of a function F(X)\n' );
  fprintf ( 1, '  in an interval [A,B] using reverse communication.\n' );

  a = 1.0;
  b = 2.0;
  example_test ( a, b, @f_01, 'f_01(x) = sin ( x ) - x / 2' );

  a = 0.0;
  b = 1.0;
  example_test ( a, b,  @f_02, 'f_02(x) = 2 * x - exp ( - x )' );

  a = -1.0;
  b =  0.5;
  example_test ( a, b, @f_03, 'f_03(x) = x * exp ( - x )' );

  a =  0.0001;
  b =  20.0;
  example_test ( a, b, @f_04, 'f_04(x) = exp ( x ) - 1 / ( 100 * x * x )' );

  a = -5.0;
  b =  2.0;
  example_test ( a, b, @f_05, 'f_05(x) = (x+3) * (x-1) * (x-1)' );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'zero_rc_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  fprintf ( 1, '\n' );
  timestamp ( );

  rmpath ( '../zero_rc' );

  return
end
function timestamp ( )

%*****************************************************************************80
%
%% timestamp() prints the current YMDHMS date as a timestamp.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    14 February 2003
%
%  Author:
%
%    John Burkardt
%
  t = now;
  c = datevec ( t );
  s = datestr ( c, 0 );
  fprintf ( 1, '%s\n', s );

  return
end

