function pendulum_nonlinear_ode_test ( )

%*****************************************************************************80
%
%% pendulum_nonlinear_ode_test() solves pendulum_nonlinear_ode().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    04 May 2021
%
%  Author:
%
%    John Burkardt
%
  addpath ( '../pendulum_nonlinear_ode' );

  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'pendulum_nonlinear_ode_test():\n' );
  fprintf ( 1, '  MATLAB/Octave version %s\n', version ( ) );
  fprintf ( 1, '  Solve pendulum_nonlinear_ode().\n' );

  [ g, l, m, t0, y0, tstop ] = pendulum_nonlinear_parameters ( );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  parameters:\n' );
  fprintf ( 1, '    g     = %g\n', g );
  fprintf ( 1, '    l     = %g\n', l );
  fprintf ( 1, '    m     = %g\n', m );
  fprintf ( 1, '    t0    = %g\n', t0 );
  fprintf ( 1, '    y0    = (%g,%g)\n', y0 );
  fprintf ( 1, '    tstop = %g\n', tstop );
  fprintf ( 1, '\n' );

  e0 = pendulum_nonlinear_conserved ( y0 );
  ep = 2.0 * m * g / l;

  fprintf ( 1, '  Initial energy             = %g\n', e0 );
  fprintf ( 1, '  Energy needed to flip      = %g\n', ep );
%
%  Look at ODE solvers.
%
  pendulum_nonlinear_ode23 ( );

  n = 1000;
  pendulum_nonlinear_midpoint ( n );
%
%  Check the period calculation.
%  Careful, this resets the initial condition.
%
  pendulum_nonlinear_period_test ( )
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'pendulum_nonlinear_ode_test():\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  fprintf ( 1, '\n' );
  timestamp ( );

  rmpath ( '../pendulum_nonlinear_ode' );

  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

