function value = func01 ( x, ider )

%*****************************************************************************80
%
%% func01() computes the function value for the first test.
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    15 May 2024
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real X, the point at which the evaluation is to take place.
%
%    integer IDER, specifies what is to be evaluated:
%    0, evaluate the function.
%    1, evaluate the first derivative.
%    2, evaluate the second derivative.
%    3, evaluate the third derivative.
%
%  Output:
%
%    real value: the value of the function or derivative.
%
  if ( ider == 0 )
    value = ( x + 3.0 ) * ( x + 3.0 ) * ( x - 2.0 );
  elseif ( ider == 1 )
    value = ( x + 3.0 ) * ( 3.0 * x - 1.0 );
  elseif ( ider == 2 )
    value = 6.0 * x + 8.0;
  elseif ( ider == 3 )
    value = 6.0;
  else
    fprintf ( 1, '\n' );
    fprintf ( 1, 'func01(): Fatal error\n' );
    fprintf ( 1, '  Requested derivative of order IDER = %d\n', ider );
    error ( 'func01(): Fatal error!' );
  end

  return
end

