function value = p05_fun ( x )

%*****************************************************************************80
%
%% P05_FUN evaluates the function for problem 5.
%
%  Discussion:
%
%    This example is difficult to interpolate because it has a piecewise
%    definition, and the character of the function changes dramatically
%    from piece to piece.
%
%  Dimension:
%
%    N = 1
%
%  Interval:
%
%    0 <= X <= 10
%
%  Function:
%
%    F(X) = max ( sin(x) + sin(x^2), 1 - abs(x-5)/5 )
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    14 February 2012
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Input, real X, the point at which the function
%    is to be evaluated.
%
%    Output, real VALUE, the value of the function at X.
%
  value = max ( sin ( x ) + sin ( x .* x ), 1.0 - abs ( x - 5.0 ) / 5.0 );

  return
end
