function value = func04 ( x, ider )

%*****************************************************************************80
%
%% func04() computes the function value for the vandev()/vandev2() comparison.
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    12 June 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.
%
  m = 9;

  if ( ider == 0 )
    value = exp ( x ) * ( x^2 - 1 )^m;
  elseif ( ider == 1 )
    value = exp ( x ) *     ( x^2 - 1 )^m ...
          + exp ( x ) * m * ( x^2 - 1 )^(m-1) * 2.0 * x;
  else
    fprintf ( 1, '\n' );
    fprintf ( 1, 'func04(): Fatal error!\n' );
    fprintf ( 1, '  Derivative of order IDER = %d requested.\n', ider );
    error ( 'func04(): Fatal error!\n' );
  end

  return
end
