function sir_euler ( )

%*****************************************************************************80
%
%% sir_euler solves the SIR ODE using euler().
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    27 October 2020
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'sir_euler:\n' );
  fprintf ( 1, '  Solve the SIR ODE using euler().\n' );
%
%  Compute the approximate solution.
%
  f = @ sir_deriv;
  t0 = 0.0;
  tstop = 7500;
  tspan = [ t0, tstop ];
  y0 = [ 99; 1; 0 ];
  n = 50;

  [ t, y ] = euler ( f, tspan, y0, n );
%
%  Get parameters for plot titles.
%
  [ alpha, beta, gamma ] = sir_parameters ( );
%
%  Plot S(t), I(t), R(t).
%
  figure ( 1 );
  clf ( );
  plot ( t, y, 'Linewidth', 3 );
  grid ( 'on' );
  xlabel ( '<-- Time -->' );
  ylabel ( '<-- Cases -->' );
  legend ( 'Susceptible', 'Infected', 'Recovered' );
  s = sprintf ( 'SIR Euler: \\alpha = %g, \\beta = %g, \\gamma = %g\n', ...
    alpha, beta, gamma );
  title ( s, 'Fontsize', 12 );
  filename = 'sir_euler.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
%
%  Plot P(t) = S(t) + I(t) + R(t).
%
  P = sir_conserved ( y );

  figure ( 2 );
  clf ( );
  hold ( 'on' );
  plot ( t, P, 'c-', 'LineWidth', 3 );
  plot ( [ t0, tstop ], [ 0.0, 0.0 ], 'k-', 'LineWidth', 3 );
  hold ( 'off' );
  grid ( 'on' );
  xlabel ( '<-- Time -->' );
  ylabel ( '<-- P(t) -->' );
  s = sprintf ( 'SIR Euler: P(t) \\alpha = %g, \\beta = %g, \\gamma = %g\n', ...
    alpha, beta, gamma );
  title ( s, 'Fontsize', 12 );
  filename = 'sir_euler_conservation.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );

  return
end

