function fx = p14_fx ( n, x )

%*****************************************************************************80
%
%% P14_FX evaluates the function for problem 14.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    10 October 2020
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer N, the number of variables and equations.
%
%    real X(N), the evaluation point.
%
%  Output:
%
%    real FX(N), the function value.
%
  fx = zeros ( n, 1 );

  ml = 5;
  mu = 1;

  for k = 1 : n

    k1 = max ( 1, k - ml );
    k2 = min ( n, k + mu );

    temp = 0.0;
    for j = k1 : k2
      if ( j ~= k )
        temp = temp + x(j) * ( 1.0 + x(j) );
      end
    end

    fx(k) = x(k) * ( 2.0 + 5.0 * x(k) * x(k) ) + 1.0 - temp;

  end

  return
end

