function variance = log_normal_truncated_ab_variance ( mu, sigma, a, b )

%*****************************************************************************80
%
%% log_normal_truncated_ab_variance(): variance of the Log Normal Truncated AB PDF.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    23 March 2016
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real MU, SIGMA, the parameters of the log normal PDF.
%    0.0 < SIGMA.
%
%    real A, B, the lower and upper truncation limits.
%    A < B.
%
%  Output:
%
%    real VARIANCE, the mean of the PDF.
%
  check = log_normal_truncated_ab_check ( mu, sigma, a, b );

  if ( ~ check )
    fprintf ( 1, '\n' );
    fprintf ( 1, 'LOG_NORMAL_TRUNCATED_AB_VARIANCE - Fatal error!\n' );
    fprintf ( 1, '  Illegal parameter values.\n' );
  end

  mean = log_normal_truncated_ab_mean ( mu, sigma, a, b );

  a0 = ( log ( a ) - mu ) / sigma;
  b0 = ( log ( b ) - mu ) / sigma;

  c1 = normal_01_cdf ( 2.0 * sigma - a0 );
  c2 = normal_01_cdf ( 2.0 * sigma - b0 );
  c3 = normal_01_cdf ( + a0 );
  c4 = normal_01_cdf ( + b0 );

  ln_xsquared = exp ( 2.0 * mu + 2.0 * sigma ^ 2 );

  lntab_xsquared = ln_xsquared * ( c1 - c2 ) / ( c4 - c3 );

  variance = lntab_xsquared - mean ^ 2;

  return
end
