function golden_search_test ( )

%*****************************************************************************80
%
%% golden_search_test tests golden_search.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    25 September 2019
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'golden_search_test\n' );
  fprintf ( 1, '  golden_search seeks a point x in the interval [a,b]\n' );
  fprintf ( 1, '  which minimizes a function f(x).\n' );
  fprintf ( 1, '  It is assumed that f(x) is "unimodal" in [a,b]\n' );
  fprintf ( 1, '  That is, the graph of the function is "U"-shaped.\n' );

  a = 0.0;
  b = 10.0;
  tol = 0.0000001;

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Search begins with:\n' );
  fprintf ( 1, '  a: f(%g) = %g\n', a, sag(a) );
  fprintf ( 1, '  b: f(%g) = %g\n', b, sag(b) );

  x = golden_search ( @sag, a, b, tol );

  fprintf ( 1, '\n' ); 
  fprintf ( 1, '  golden_search returns estimated minimizer x:\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  x: f(%g) = %g\n', x, sag(x) );

  return
end

