function fx = p00_fx ( problem, n, x )

%*****************************************************************************80
%
%% P00_FX evaluates the function for any problem.
%
%  Discussion:
%
%    Most of the problems were originally part of ACM algorithm 566,
%    and were used to test the MINPACK package.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    10 October 2020
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    John Dennis, David Gay, Phuong Vu,
%    A new nonlinear equations test problem,
%    Technical Report 83-16,
%    Mathematical Sciences Department,
%    Rice University, 1983.
%
%    John Dennis, Robert Schnabel,
%    Numerical Methods for Unconstrained Optimization
%    and Nonlinear Equations,
%    SIAM, 1996,
%    ISBN13: 978-0-898713-64-0,
%    LC: QA402.5.D44.
%
%    Noel deVilliers, David Glasser,
%    A continuation method for nonlinear regression,
%    SIAM Journal on Numerical Analysis,
%    Volume 18, Number 6, December 1981, pages 1139-1154.
%
%    Chris Fraley,
%    Solution of nonlinear least-squares problems,
%    Technical Report STAN-CS-1165,
%    Computer Science Department,
%    Stanford University, 1987.
%
%    Chris Fraley,
%    Software performance on nonlinear least-squares problems,
%    Technical Report SOL 88-17,
%    Systems Optimization Laboratory,
%    Department of Operations Research,
%    Stanford University, 1988.
%
%    JJ McKeown,
%    Specialized versus general-purpose algorithms for functions
%    that are sums of squared terms,
%    Mathematical Programming,
%    Volume 9, 1975, pages 57-68.
%
%    JJ McKeown,
%    On algorithms for sums of squares problems,
%    in Towards Global Optimisation,
%    edited by Laurence Dixon, Gabor Szego,
%    North-Holland, 1975, pages 229-257,
%    ISBN: 0444109552,
%    LC: QA402.5.T7.
%
%    Jorge More, Burton Garbow, Kenneth Hillstrom,
%    Algorithm 566:
%    Testing unconstrained optimization software,
%    ACM Transactions on Mathematical Software,
%    Volume 7, Number 1, March 1981, pages 17-41.
%
%    Douglas Salane,
%    A continuation approach for solving large residual nonlinear
%    least squares problems,
%    SIAM Journal of Scientific and Statistical Computing,
%    Volume 8, Number 4, July 1987, pages 655-671.
%
%  Input:
%
%    integer PROBLEM, the number of the problem.
%
%    integer N, the number of variables and equations.
%
%    real X(N), the evaluation point.
%
%  Output:
%
%    real FX(N), the function value.
%
  if ( problem == 1 )
    fx = p01_fx ( n, x );
  elseif ( problem == 2 )
    fx = p02_fx ( n, x );
  elseif ( problem  ==  3 )
    fx = p03_fx ( n, x );
  elseif ( problem == 4 )
    fx = p04_fx ( n, x );
  elseif ( problem == 5 )
    fx = p05_fx ( n, x );
  elseif ( problem == 6 )
    fx = p06_fx ( n, x );
  elseif ( problem == 7 )
    fx = p07_fx ( n, x );
  elseif ( problem == 8 )
    fx = p08_fx ( n, x );
  elseif ( problem == 9 )
    fx = p09_fx ( n, x );
  elseif ( problem == 10 )
    fx = p10_fx ( n, x );
  elseif ( problem == 11 )
    fx = p11_fx ( n, x );
  elseif ( problem == 12 )
    fx = p12_fx ( n, x );
  elseif ( problem == 13 )
    fx = p13_fx ( n, x );
  elseif ( problem == 14 )
    fx = p14_fx ( n, x );
  elseif ( problem == 15 )
    fx = p15_fx ( n, x );
  elseif ( problem == 16 )
    fx = p16_fx ( n, x );
  elseif ( problem == 17 )
    fx = p17_fx ( n, x );
  elseif ( problem == 18 )
    fx = p18_fx ( n, x );
  elseif ( problem == 19 )
    fx = p19_fx ( n, x );
  elseif ( problem == 20 )
    fx = p20_fx ( n, x );
  elseif ( problem == 21 )
    fx = p21_fx ( n, x );
  elseif ( problem == 22 )
    fx = p22_fx ( n, x );
  elseif ( problem == 23 )
    fx = p23_fx ( n, x );
  else
    fprintf ( 1, '\n' );
    fprintf ( 1, 'P00_FX - Fatal error!\n' );
    fprintf ( 1, '  Illegal problem number = %d\n', problem );
    error ( 'P00_FX - Fatal error!' );
  end

  return
end
