function newton_test ( )

%*****************************************************************************80
%
%% newton_test() tests newton().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    10 January 2022
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'newton_test():\n' );
  fprintf ( 1, '  newton() estimates the probability that\n' );
  fprintf ( 1, '    A: a fair die rolled  6 times will show 6 at least 1 time;\n' );
  fprintf ( 1, '    B: a fair die rolled 12 times will show 6 at least 2 times;\n' );
  fprintf ( 1, '    C: a fair die rolled 18 times will show 6 at least 3 times.\n' );
  fprintf ( 1, '  Samuel Pepys believed C was more likely than A or B.\n' );
  fprintf ( 1, '  Newton showed that A was more likely.\n' );

  [ a, b, c ] = newton ( );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Case  Estimate  Exact\n' );
  fprintf ( 1, '     A: %6.4g  %6.4g\n', a, 0.6651 );
  fprintf ( 1, '     B: %6.4g  %6.4g\n', b, 0.6187 );
  fprintf ( 1, '     C: %6.4g  %6.4g\n', c, 0.5973 );

  return
end

