function arenstorf_euler ( )

%*****************************************************************************80
%
%% arenstorf_euler() solves arenstorf_ode() using euler().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    19 February 2023
%
%  Author:
%
%    John Burkardt
%
  [ mu1, mu2, t0, xy0, tstop ] = arenstorf_parameters ( );

  tspan = [ t0, tstop ];
  n = 101;

  [ t, xy ] = euler ( @arenstorf_deriv, tspan, xy0, n );

  figure ( );
  hold ( 'on' )
  plot ( xy(:,1), xy(:,2), 'linewidth', 2 );
  plot ( xy(1,1), xy(1,2), 'g.', 'markersize', 25 );
  plot ( xy(end,1), xy(end,2), 'r.', 'markersize', 25 );
  hold ( 'off' )
  grid ( 'on' );
  xlabel ( '<---  q1  --->' );
  ylabel ( '<---  q2  --->' );
  title ( 'arenstorf\_ode(): euler() phase plot' )
  filename = 'arenstorf_euler_phase.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );

  h = arenstorf_conserved ( xy' );

  figure ( );
  clf ( );
  hold ( 'on' );
    plot ( t, h, 'r-', 'linewidth', 3 );
    plot ( tspan, [h(1), h(1) ], 'k:', 'linewidth', 3 );
    plot ( tspan, [0.0, 0.0 ], 'k--', 'linewidth', 3 );
  hold ( 'off' );
  grid ( 'on' );
  xlabel ( '<-- T -->', 'Fontsize', 16 );
  ylabel ( '<-- H(T) -->', 'Fontsize', 16 );
  legend ( 'Computed Energy', 'Initial Energy', 'Zero Energy' );
  title ( 'arenstorf\_ode(): euler conservation', 'fontsize', 24 );
  filename = 'arenstorf_euler_conservation.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );

  return
end

