function rosenbrock_test ( )

%*****************************************************************************80
%
%% rosenbrock_test() works with the Rosenbrock function.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    04 January 2012
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'rosenbrock_test():\n' );
  fprintf ( 1, '  compass_search() applied to the Rosenbrock function.\n' );
  m = 2;
  delta_tol = 0.00001;
  delta = 0.3;
  k_max = 20000;

  x = [ - 1.2, 1.0 ];
  disp ( '  Initial point x0:' );
  disp ( x );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  F(X0) = %g\n', rosenbrock ( m, x ) );

  [ x, fx, k ] = compass_search ( @rosenbrock, m, x, delta_tol, delta, k_max );

  disp ( '  Estimated minimizer x1:' );
  disp ( x );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  F(X1) = %g, number of steps = %d\n', fx, k );
%
%  Demonstrate correct minimizer.
%
  x = [ 1.0, 1.0 ];
  disp ( '  Correct minimizer x*:' );
  disp ( x );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  F(X*) = %g\n', rosenbrock ( m, x ) );

  return
end
