function newton_test ( )

%*****************************************************************************80
%
%% newton_test tests newton.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    22 June 2019
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'newton_test:\n' );
  fprintf ( 1, '  MATLAB version\n' );
  fprintf ( 1, '  Test newton():\n' );
%
%  f(x) = x^6-x-1
%
  x0 = 0.0;
  error_bd = 1.0e-12;
  max_iterate = 50;
  index_f = 1;
  x = newton ( x0, error_bd, max_iterate, index_f );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Estimated root is x = %g\n', x );
  fprintf ( 1, '  f(x) = %g\n', x^6 - x - 1 );
%
%  f(x) = x - exp(-x)
%
  x0 = 0.0;
  error_bd = 1.0e-12;
  max_iterate = 50;
  index_f = 2;
  x = newton ( x0, error_bd, max_iterate, index_f );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Estimated root is x = %g\n', x );
  fprintf ( 1, '  f(x) = %g\n', x - exp(-x) );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'newton_test:\n' );
  fprintf ( 1, '  Normal end of execution.\n' );

  return
end

