function fx = p10_fx ( n, x )

%*****************************************************************************80
%
%% p10_fx() evaluates the function for problem 10.
%
%  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 );

  h = 1.0 / ( n + 1 );

  for k = 1 : n

    tk = k / ( n + 1 );

    sum1 = 0.0;
    for j = 1 : k
      tj = j * h;
      sum1 = sum1 + tj * ( x(j) + tj + 1.0 )^3;
    end

    sum2 = 0.0;
    for j = k + 1 : n
      tj = j * h;
      sum2 = sum2 + ( 1.0 - tj ) * ( x(j) + tj + 1.0 )^3;
    end

    fx(k) = x(k) + h * ( ( 1.0 - tk ) * sum1 + tk * sum2 ) / 2.0;

  end

  return
end

