function f = p18_f ( m, n, x )

%*****************************************************************************80
%
%% p18_f() evaluates the M nonlinear functions for problem 18.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    03 March 2026
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Jorge More, Burton Garbow, and Kenneth Hillstrom,
%    Testing unconstrained optimization software,
%    ACM Transactions on Mathematical Software,
%    Volume 7, pages 17-41, 1981.
%
%  Input:
%
%    integer M, the number of functions.
%
%    integer N, the number of unknowns.
%
%    real X(N), the evaluation point.
%
%  Output:
%
%    real F(M), the value of the functions evaluated at X.
%
  f = zeros ( m, 1 );

  y = [ ...
    1.366; 1.191; 1.112; 1.013; 0.991; ...
    0.885; 0.831; 0.847; 0.786; 0.725; ...
    0.746; 0.679; 0.608; 0.655; 0.616; ...
    0.606; 0.602; 0.626; 0.651; 0.724; ...
    0.649; 0.649; 0.694; 0.644; 0.624; ...
    0.661; 0.612; 0.558; 0.533; 0.495; ...
    0.500; 0.423; 0.395; 0.375; 0.372; ...
    0.391; 0.396; 0.405; 0.428; 0.429; ...
    0.523; 0.562; 0.607; 0.653; 0.672; ...
    0.708; 0.633; 0.668; 0.645; 0.632; ...
    0.591; 0.559; 0.597; 0.625; 0.739; ...
    0.710; 0.729; 0.720; 0.636; 0.581; ...
    0.428; 0.292; 0.162; 0.098; 0.054 ];

  for i = 1 : 65

    temp = ( i - 1 ) / 10.0;

    f(i) = y(i) - ( ...
        x(1) * exp ( - x(5) *   temp             ) ...
      + x(2) * exp ( - x(6) * ( temp - x(9)  )^2 ) ...
      + x(3) * exp ( - x(7) * ( temp - x(10) )^2 ) ...
      + x(4) * exp ( - x(8) * ( temp - x(11) )^2 ) );

  end

  return
end
