function log_normal_truncated_ab_cdf_test ( )

%*****************************************************************************80
%
%% log_normal_truncated_ab_cdf_test() tests log_normal_truncated_ab_cdf().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    21 March 2016
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'log_normal_truncated_ab_cdf_test():\n' );
  fprintf ( 1, '  log_normal_truncated_ab_cdf() evaluates the Log Normal Truncated AB CDF;\n' );
  fprintf ( 1, '  log_normal_truncated_ab_cdf_inv() inverts the Log Normal Truncated AB CDF.\n' );
  fprintf ( 1, '  log_normal_truncated_ab_pdf() evaluates the Log Normal Truncated AB PDF;\n' );

  mu = 0.5;
  sigma = 3.0;
  a = exp ( mu );
  b = exp ( mu + 2.0 * sigma );

  check = log_normal_truncated_ab_check ( mu, sigma, a, b );

  if ( ~ check )
    fprintf ( 1, '\n' );
    fprintf ( 1, 'log_normal_truncated_ab_cdf_test(): Fatal error!\n' );
    fprintf ( 1, '  The parameters are not legal.\n' );
    return
  end

  fprintf ( 1, '\n' );
  fprintf ( 1, '  PDF parameter MU =            %14g\n', mu );
  fprintf ( 1, '  PDF parameter SIGMA =         %14g\n', sigma );
  fprintf ( 1, '  PDF parameter A =             %14g\n', a );
  fprintf ( 1, '  PDF parameter B =             %14g\n', b );

  fprintf ( 1, '\n' );
  fprintf ( 1, '              X             PDF             CDF         CDF_INV\n' );
  fprintf ( 1, '\n' );

  for i = 1 : 10

    x = log_normal_truncated_ab_sample ( mu, sigma, a, b );

    pdf = log_normal_truncated_ab_pdf ( x, mu, sigma, a, b );

    cdf = log_normal_truncated_ab_cdf ( x, mu, sigma, a, b );

    x2 = log_normal_truncated_ab_cdf_inv ( cdf, mu, sigma, a, b );

    fprintf ( 1, ' %14.6g  %14g  %14g  %14g\n', x, pdf, cdf, x2 );

  end

  return
end
