function norm_rms_test ( )

%*****************************************************************************80
%
%  norm_rms_test() tests norm_rms().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    25 July 2019
%
%  Author:
%
%    John Burkardt
%
  addpath ( '../norm_rms' );

  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'norm_rms_test():\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  norm_rms() estimates the root mean square (RMS)\n' );
  fprintf ( 1, '  norm of a function f(x) over the interval [a,b].\n' );
%
%  Humps function.
%
  f_string = 'humps_fun(x)';
  a = 0.0;
  b = 2.0;
  fprintf ( 1, '\n' );
  fprintf ( 1, '  f(x) = "%s"\n', f_string );
  fprintf ( 1, '  %g <= x <= %g\n', a, b );
  value = norm_rms ( f_string, a, b );
  fprintf ( 1, '  norm_rms = %g\n', value );
%
%  User function.
%
  f_string = 'p3(x)';
  a = -1.0;
  b = +1.0;
  fprintf ( 1, '\n' );
  fprintf ( 1, '  f(x) = "%s"\n', f_string );
  fprintf ( 1, '  %g <= x <= %g\n', a, b );
  value = norm_rms ( f_string, a, b );
  fprintf ( 1, '  norm_rms = %g\n', value );
%
%  sin(x) - Taylor series.
%
  f_string = 'sin(x)';
  a = -1.0;
  b = +1.0;
  fprintf ( 1, '\n' );
  fprintf ( 1, '  f(x) = "%s"\n', f_string );
  fprintf ( 1, '  %g <= x <= %g\n', a, b );
  value = norm_rms ( f_string, a, b );
  fprintf ( 1, '  norm_rms = %g\n', value );

  f_string = 'sin(x)-x+x.^3/6';
  a = -1.0;
  b = +1.0;
  fprintf ( 1, '\n' );
  fprintf ( 1, '  f(x) = "%s"\n', f_string );
  fprintf ( 1, '  %g <= x <= %g\n', a, b );
  value = norm_rms ( f_string, a, b );
  fprintf ( 1, '  norm_rms = %g\n', value );

  f_string = 'sin(x)-x+x.^3/6-x.^5/120';
  a = -1.0;
  b = +1.0;
  fprintf ( 1, '\n' );
  fprintf ( 1, '  f(x) = "%s"\n', f_string );
  fprintf ( 1, '  %g <= x <= %g\n', a, b );
  value = norm_rms ( f_string, a, b );
  fprintf ( 1, '  norm_rms = %g\n', value );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'norm_rms_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  timestamp ( );

  rmpath ( '../norm_rms' );

  return
end
function timestamp ( )

%*****************************************************************************80
%
%% timestamp() prints the current YMDHMS date as a timestamp.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    14 February 2003
%
%  Author:
%
%    John Burkardt
%
  t = now;
  c = datevec ( t );
  s = datestr ( c, 0 );
  fprintf ( 1, '%s\n', s );

  return
end

