function pdf = poisson_pdf ( x, a )

%*****************************************************************************80
%
%% poisson_pdf() evaluates the Poisson PDF.
%
%  Formula:
%
%    PDF(X)(A) = EXP ( - A ) * A^X / X!
%
%  Discussion:
%
%    PDF(X)(A) is the probability that the number of events observed
%    in a unit time period will be X, given the expected number
%    of events in a unit time.
%
%    The parameter A is the expected number of events per unit time.
%
%    The Poisson PDF is a discrete version of the Exponential PDF.
%
%    The time interval between two Poisson events is a random
%    variable with the Exponential PDF.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    11 January 2021
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer X, the argument of the PDF.
%    0 <= X
%
%    real A, the parameter of the PDF.
%    0.0 < A.
%
%  Output:
%
%    real PDF, the value of the PDF.
%
  if ( x < 0 )
    pdf = 0.0;
  else
    pdf = exp ( - a ) * a ^ x / factorial ( x );
  end

  return
end
