function fx = p18_fun ( n, x )

%*****************************************************************************80
%
%% p18_fun() evaluates the integrand for problem 18.
%
%  Integral:
%
%    Integral ( 0 <= x < +oo ) x^2 * exp ( - x / 2^beta ) dx
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    28 December 2011
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Robert Piessens, Elise de Doncker-Kapenga,
%    Christian Ueberhuber, David Kahaner,
%    QUADPACK: A Subroutine Package for Automatic Integration,
%    Springer, 1983, page 84.
%
%  Input:
%
%    integer N, the number of points.
%
%    real X(N), the point at which the integrand
%    is to be evaluated.
%
%  Output:
%
%    real FX(N), the value of the integrand at X.
%
  beta = 1.0;

  fx(1:n) = x(1:n).^2 .* exp ( - x(1:n) / 2^beta );

  return
end
