function newton_rc_test02 ( )

%*****************************************************************************80
%
%% newton_rc_test02() tests newton_rc() on 2 nonlinear functions.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    18 April 2021
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'newton_rc_test02():\n' );
  fprintf ( 1, '  newton_rc() solves 2 nonlinear equation.\n' );

  n = 2;
  ido = 0;
  x = [ 3.0; 0.0 ];
  fx = f2 ( x );
  r8vec2_print ( x, fx, '  Initial X and F(X)' );

  while ( true )

    [ ido, x ] = newton_rc ( ido, x, fx );

    if ( ido == 0 )
      fprintf ( 1, '\n' );
      fprintf ( 1, '  Convergence:\n' );
      break
    elseif ( ido == 1 || ido == 2 )
      fx = f2 ( x );
    else
      fprintf ( 1, '\n' );
      fprintf ( 1, '  Convergence failure:\n' );
      break
    end

  end

  r8vec2_print ( x, fx, '  Final X and F(X)' );

  return
end

