function glomin_test ( )

%*****************************************************************************80
%
%% glomin_test() tests glomin().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    13 June 2021
%
%  Author:
%
%    John Burkardt
%
  addpath ( '../glomin' )

  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'glomin_test():\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  glomin() seeks a global minimizer of a\n' );
  fprintf ( 1, '  function F(X) in an interval [A,B],\n' );
  fprintf ( 1, '  given some upper bound M for F".\n' );

  e = sqrt ( eps );
  t = sqrt ( eps );

  fprintf ( 1, '\n' )
  fprintf ( 1, '  Tolerances:\n' );
  fprintf ( 1, '  e = %g\n', e );
  fprintf ( 1, '  t = %g\n', t );

  a = 7.0;
  b = 9.0;
  c = ( a + b ) / 2.0;
  m = 0.0;

  glomin_example ( a, b, c, m, e, t, @h_01, ...
    'h_01(x) = 2 - x' );

  a = 7.0;
  b = 9.0;
  c = ( a + b ) / 2.0;
  m = 100.0;

  glomin_example ( a, b, c, m, e, t, @h_01, ...
    'h_01(x) = 2 - x' );

  a = -1.0;
  b = +2.0;
  c = ( a + b ) / 2.0;
  m = 2.0;

  glomin_example ( a, b, c, m, e, t, @h_02, ...
    'h_02(x) = x * x' );

  a = -1.0;
  b = +2.0;
  c = ( a + b ) / 2.0;
  m = 2.1;

  glomin_example ( a, b, c, m, e, t, @h_02, ...
    'h_02(x) = x * x' );

  a = -0.5;
  b =  +2.0;
  c = ( a + b ) / 2.0;
  m = 14.0;

  glomin_example ( a, b, c, m, e, t, @h_03, ...
    'h_03(x) = x^3 + x^2' );

  a = -0.5;
  b =  +2.0;
  c = ( a + b ) / 2.0;
  m = 28.0;

  glomin_example ( a, b, c, m, e, t, @h_03, ...
    'h_03(x) = x^3 + x^2' );

  a = -10.0;
  b = +10.0;
  c = ( a + b ) / 2.0;
  m = 72.0;

  glomin_example ( a, b, c, m, e, t, @h_04, ...
    'h_04(x) = ( x + sin(x) ) * exp(-x*x)' );

  a = -10.0;
  b = +10.0;
  c = ( a + b ) / 2.0;
  m = 72.0;

  glomin_example ( a, b, c, m, e, t, @h_05, ...
    'h_05(x) = ( x - sin(x) ) * exp(-x*x)' );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'glomin_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  fprintf ( 1, '\n' );
  timestamp ( );

  rmpath ( '../glomin' )

  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

