function mean = normal_truncated_ab_mean ( mu, s, a, b )

%*****************************************************************************80
%
%% normal_truncated_ab_mean() returns the mean of the truncated Normal PDF.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    14 August 2013
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real MU, S, the mean and standard deviation of the
%    parent Normal distribution.
%
%    real A, B, the lower and upper truncation limits.
%
%  Output:
%
%    real MEAN, the mean of the PDF.
%
  alpha = ( a - mu ) / s;
  beta = ( b - mu ) / s;

  alpha_cdf = normal_01_cdf ( alpha );
  beta_cdf = normal_01_cdf ( beta );

  alpha_pdf = normal_01_pdf ( alpha );
  beta_pdf = normal_01_pdf ( beta );

  mean = mu + s * ( alpha_pdf - beta_pdf ) / ( beta_cdf - alpha_cdf );

  return
end
