function zero_itp_test ( )

%*****************************************************************************80
%
%% zero_itp_test() tests zero_itp().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    02 March 2024
%
%  Author:
%
%    John Burkardt
%
  addpath ( '../zero_itp' )

  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'zero_itp_test():\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  zero_itp() seeks a root of a function f(x)\n' );
  fprintf ( 1, '  in an interval [a,b].\n' );

  f = @f_01;
  a = 1.0;
  b = 2.0;
  epsi = sqrt ( eps );
  k1 = 0.1;
  k2 = 2.0;
  n0 = 1;
  verbose = false;
  title = 'f_01(x) = sin ( x ) - x / 2';
  zero_itp_example ( f, a, b, epsi, k1, k2, n0, verbose, title );

  f = @f_02;
  a = 0.0;
  b = 1.0;
  epsi = sqrt ( eps );
  k1 = 1.0 / ( b - a ) / 5.0;
  k2 = 2.0;
  n0 = 1;
  verbose = false;
  title = 'f_02(x) = 2 * x - exp ( - x )';
  zero_itp_example ( f, a, b, epsi, k1, k2, n0, verbose, title );

  f = @f_03;
  a = -1.0;
  b =  0.5;
  epsi = sqrt ( eps );
  k1 = 1.0 / ( b - a ) / 5.0;
  k2 = 2.0;
  n0 = 1;
  verbose = false;
  title = 'f_03(x) = x * exp ( - x )';
  zero_itp_example ( f, a, b, epsi, k1, k2, n0, verbose, title );

  f = @f_04;
  a =  0.0001;
  b =  20.0;
  epsi = sqrt ( eps );
  k1 = 1.0 / ( b - a ) / 5.0;
  k2 = 2.0;
  n0 = 1;
  verbose = false;
  title = 'f_04(x) = exp ( x ) - 1 / ( 100 * x * x )';
  zero_itp_example ( f, a, b, epsi, k1, k2, n0, verbose, title );

  f = @f_05;
  a = -5.0;
  b =  2.0;
  epsi = sqrt ( eps );
  k1 = 1.0 / ( b - a ) / 5.0;
  k2 = 2.0;
  n0 = 1;
  verbose = false;
  title = 'f_05(x) = (x+3) * (x-1) * (x-1)';
  zero_itp_example ( f, a, b, epsi, k1, k2, n0, verbose, title );
%
%  These parameter values match the Wikipedia example.
%
  f = @f_06;
  a =  1.0;
  b =  2.0;
  epsi = 0.0005;
  k1 = 0.1;
  k2 = 2.0;
  n0 = 1;
  verbose = true;
  title = 'f_06(x) = x^3 - x - 2';
  zero_itp_example ( f, a, b, epsi, k1, k2, n0, verbose, title );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'zero_itp_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  fprintf ( 1, '\n' );
  timestamp ( );

  rmpath ( '../zero_itp' )

  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

