% hw0035.m
% John Burkardt
% Evaluate a normal probability function.
%
mu = input ( '  Enter mu: ' );
sigma = input ( '  Enter sigma:  ' );
x = input ( '  Enter x:  ' );

p1 = exp ( - ( ( x - mu ) / ( sigma * sqrt ( 2.0 ) ) ) ^2 ) ...
  / sigma / sqrt ( 2.0 * pi );

fprintf ( '  N(%g,%g,%g) = %g\n', mu, sigma, x, p1 );

frac = 1.0 / sigma / sqrt ( 2.0 * pi );
top = ( x - mu );
bot = sigma * sqrt ( 2.0 );
power = ( top / bot ) ^ 2;
p2 = frac * exp ( - power );

fprintf ( '  N(%g,%g,%g) = %g\n', mu, sigma, x, p2 );
