function x = levy_cdf_inv ( cdf, a, b )

%*****************************************************************************80
%
%% levy_cdf_inv() inverts the Levy CDF.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    24 April 2007
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real CDF, the value of the CDF.
%    0.0 <= CDF <= 1.0.
%
%    real A, B, the parameters of the PDF.
%    0 < B.
%
%  Output:
%
%    real X, the corresponding argument.
%
  if ( cdf < 0.0 | 1.0 < cdf )
    fprintf ( 1, '\n' );
    fprintf ( 1, 'LEVY_CDF_INV - Fatal error!\n' );
    fprintf ( 1, '  CDF < 0 or 1 < CDF.\n' );
    error ( 'LEVY_CDF_INV - Fatal error!' );
  end

  if ( b <= 0.0 )
    fprintf ( 1, '\n' );
    fprintf ( 1, 'LEVY_CDF_INV - Fatal error!\n' );
    fprintf ( 1, '  Input parameter B <= 0.0\n' );
    error ( 'LEVY_CDF_INV - Fatal error!' );
  end

  cdf1 = 1.0 - 0.5 * cdf;
  x1 = normal_01_cdf_inv ( cdf1 );
  x = a + b / ( x1 * x1 );

  return
end
