function value = steinerberger_function ( n, x )

%*****************************************************************************80
%
%% steinerberger_function() evaluates the Steinerberger function.
%
%  Discussion:
%
%    f(n,x) = sum ( 1 <= k <= n ) abs ( sin ( pi * k * x ) ) / k
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    13 June 2023
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    John D Cook,
%    Pushing numerical integration software to its limits,
%    https://www.johndcook.com/blog/2023/06/12/stressing-numerical-integration/
%    Posted 12 June 2023.
%
%    John D Cook,
%    Plotting a function with lots of local minima,
%    https://www.johndcook.com/blog/2023/06/12/lots-of-local-minima/
%    Posted 12 June 2023.
%
%    Stefan Steinerberger,
%    A amusing sequence of functions,
%    Mathematics Magazine,
%    Volume 91, Number 4, October 2018, pages 262-266.
%
%  Input:
%
%    integer N: the index of the function.
%
%    real X: the evaluation point.
%
%  Output:
%
%    real VALUE: the function value.
%
  value = 0.0 * x;
  for k = 1 : n
    value = value + abs ( sin ( k * pi * x ) ) / k;
  end

  return
end

