function circle_distance_pdf ( )

%*****************************************************************************80
%
%% CIRCLE_DISTANCE_PDF plots the PDF for the circle distance problem.
%
%  Discussion:
%
%    The reference gives the formula as:
%
%      pdf = ( 1.0 / pi ) * 1.0 ./ sqrt ( 1.0 - 0.5 * d.^2 / r.^2 ) 
%
%    but the correct formula is:
%
%      pdf = ( 1.0 / pi ) * 1.0 ./ sqrt ( 1.0 - 0.25 * d.^2 / r.^2 ) 
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    27 September 2018
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Panagiotis Siridopoulos,
%    The N-Sphere Chord Length Distribution,
%    ARXIV,
%    https://arxiv.org/pdf/1411.5639.pdf
%
  r = 1.0;
  d = linspace ( 0.0, 2.0, 101 );
%
%  PDF goes to infinity at d = 2*r.
%
  d = d(1:100);

  pdf = ( 1.0 / pi ) * 1.0 ./ sqrt ( 1.0 - 0.25 * d.^2 / r.^2 );

  plot ( d, pdf, 'r-', 'linewidth', 2 );
  grid ( 'on' );
  xlabel ( '<-- Distance -->' );
  ylabel ( '<-- Probability -->' );
  title ( 'PDF for distance between pairs of random points on circle' );

  return
end

