function final ( )

%*****************************************************************************80
%
%% FINAL considers ( A^2/3 + B^2/3 <? 1 ) for random A and B.
%
%  Discussion:
%
%    For A and B uniform random in [-1,+1], what is the probability that
%      A^2/3 + B^2/3 < 1?
%
%  Modified:
%
%    31 January 2018
%
%  Author:
%
%    Paul Nahin
%
%  Reference:
%
%    Paul Nahin,
%    Will You Be Alive 10 Years From Now?,
%    Princeton, 2014,
%    ISBN: 978-0691156804,
%    LC: QA273.25.N344
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'FINAL:\n' );
  fprintf ( 1, '  For uniform random A and B, what is the probability that\n' );
  fprintf ( 1, '    A^2/3 + B^2/3 < 1?\n' );

  s = 0;
  
  for loop = 1 : 1000000

    A = ( - 1 + 2.0 * rand ( ) );
    B = ( - 1 + 2.0 * rand ( ) );
    A = ( A^2 ) ^ ( 1/3 );
    B = ( B^2 ) ^ ( 1/3 );
 
    if ( A + B  < 1 )
      s = s + 1;
    end

  end

  s = s / 1000000;

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Estimated probability = %g\n', s );
  fprintf ( 1, '  Exact probability     = %g\n', 3 * pi / 32 );

  return
end
