function p00_brent_test ( )

%*****************************************************************************80
%
%% p00_brent_test() carries out a version of Brent's derivative-free minimizer.
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    17 March 2026
%
%  Author:
%
%    John Burkardt
%
  tol = 0.00000001;

  fprintf ( 1, '\n' );
  fprintf ( 1, 'p00_brent_test():\n' );
  fprintf ( 1, '  p00_brent() use Brent''s method to seek a minimizer.\n' );
%
%  Get the number of tests.
%
  test_num = p00_test_num ( );

  for test = 1 : test_num

    title = p00_title ( test );

    fprintf ( 1, '\n' );
    fprintf ( 1, '  test %d\n', test );
    fprintf ( 1, '  "%s"\n', title );

    [ a, b ] = p00_interval ( test );

    fa = p00_f ( test, a );
    fb = p00_f ( test, b );

    fprintf ( 1, '  Initial interval [A,B]:\n' );
    fprintf ( 1, '   A,       B:  %24.16e            %24.16e\n', a, b );
    fprintf ( 1, '  FA,      FB:  %24.16e            %24.16e\n', fa, fb );

    [ x, a, b, it, nf ] = p00_brent ( a, b, test, tol );

    fa = p00_f ( test, a );
    fb = p00_f ( test, b );
    fx = p00_f ( test, x );

    fprintf ( 1, '  Number of iterations: %d\n', it );
    fprintf ( 1, '  Function evaluations: %d\n', nf );
    fprintf ( 1, '  Final interval [A,X*,B]:\n' )
    fprintf ( 1, '   A,  X*,  B:  %24.16e  %24.16e  %24.16e\n', a, x, b );
    fprintf ( 1, '  FA, FX*, FB:  %24.16e  %24.16e  %24.16e\n', fa, fx, fb );

  end

  return
end
