function newton_rc_test01 ( )

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

  n = 1;
  ido = 0;
  x = zeros ( n, 1 );
  fx = f1 ( 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 = f1 ( x );
    else
      fprintf ( 1, '\n' );
      fprintf ( 1, '  Convergence failure:\n' );
      break
    end

  end

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

  return
end

