function opt_quadratic_test ( )

%*****************************************************************************80
%
%% opt_quadratic_test() tests opt_quadratic().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    02 August 2019
%
%  Author:
%
%    John Burkardt
%
  addpath ( '../opt_quadratic' );

  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'opt_quadratic_test():\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  opt_quadratic() seeks a critical point\n' );
  fprintf ( 1, '  of a function f(x), given three starting points,\n' );
  fprintf ( 1, '  an iteration limit, and x and y tolerances.\n' );
%
%  Use M file.
%
  f_string = 'humps_fun(x)';
  x1 = 0.3;
  x2 = 0.4;
  x3 = 0.5;
  n = 25;
  x_tol = 0.000001;
  y_tol = 0.000001;

  fprintf ( 1, '\n' );
  fprintf ( 1, '  f = "%s"\n', f_string );
  fprintf ( 1, '  f(%g) = %g\n', x1, humps_fun ( x1 ) );
  fprintf ( 1, '  f(%g) = %g\n', x2, humps_fun ( x2 ) );
  fprintf ( 1, '  f(%g) = %g\n', x3, humps_fun ( x3 ) );
  fprintf ( 1, '  iteration limit n = %d\n', n );
  fprintf ( 1, '  x_tol = %g\n', x_tol );
  fprintf ( 1, '  y_tol = %g\n', y_tol );
  [ x, it ] = opt_quadratic ( f_string, x1, x2, x3, n, x_tol, y_tol );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  %d iterations were taken\n', it );
  fprintf ( 1, '  f(%g) = %g\n', x, humps_fun ( x ) );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'opt_quadratic_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  timestamp ( );

  rmpath ( '../opt_quadratic' );

  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

