function broyden_test04 ( )

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

  n = 8;
  x = zeros ( n, 1 );
  fx = f4 ( x );
  fprintf ( 1, '  Initial residual norm: %f\n', norm ( fx ) );
 
  atol = 0.000001;
  rtol = 0.000001;

  maxit = 10;
  maxdim = 4;

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

  fx = f4 ( x );

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

  return
end
