function broyden_test05 ( )

%*****************************************************************************80
%
%% broyden_test05() tests broyden() on the Chandrasekhar function.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    18 April 2021
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'broyden_test05():\n' );
  fprintf ( 1, '  broyden() solves a system of nonlinear equations\n' );
  fprintf ( 1, '  using Broyden''s method.\n' );
  fprintf ( 1, '  Test it on the Chandrasekhar function.\n' );

  n = 100;
  x = zeros ( n, 1 );

  atol = 0.000001;
  rtol = 0.000001;

  maxit = 10;
  maxdim = 2;

  [ x, ierr ] = broyden ( x, @f5, atol, rtol, maxit, maxdim );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Error flag IERR = %d\n', ierr );

  fx = f5 ( x );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Residual norm: %f\n', norm ( fx ) );

  return
end
