function f = p11_f ( m, n, x )

%*****************************************************************************80
%
%% p11_f() evaluates the M nonlinear functions for problem 11.
%
%  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 );

  for i = 1 : 29

    div = i / 29.0;
    s1 = 0.0;
    dx = 1.0;
    for j = 2 : n
      s1 = s1 + ( j - 1 ) * dx * x(j);
      dx = div * dx;
    end

    s2 = 0.0;
    dx = 1.0;
    for j = 1 : n
      s2 = s2 + dx * x(j);
      dx = div * dx;
    end
    f(i) = s1 - s2^2 - 1.0;
  end

  f(30) = x(1);
  f(31) = x(2) - x(1)^2 - 1.0;

  return
end
