function value = gaussian_value ( n, mu, sigma, x )

%*****************************************************************************80
%
%% gaussian_value() evaluates a Gaussian function or a derivative.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    10 May 2020
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer N, the derivative order.
%    0 <= N.
%
%    real MU, the mean.
%
%    real SIGMA: the standard deviation.
%
%    real X(M): evaluation points.
%
%  Output:
%
%    real VALUE(M): values of the N-th derivative of the Gaussian function.
%
  x = x(:);

  root2 = sqrt ( 2.0 );

  g = exp ( - ( x - mu ).^2 / 2.0 / sigma^2 );

  hn = hermite_polynomial_value ( n, ( x - mu ) / sqrt ( sigma ) / root2 );

  value = r8_mop ( n ) / ( sigma * root2 )^n * hn .* g;
  
  return
end

