function predator_rk12 ( )

%*****************************************************************************80
%
%% predator_rk12() calls rk12() with specific values of n, a, b, and y0.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    22 March 2020
%
%  Author:
%
%    John Burkardt
%
  f = @ predator_deriv;
  tspan = [ 0.0, 5.0 ];
  y0 = [ 5000, 100 ];
  n = 1000;

  [ t, y, e ] = rk12 ( f, tspan, y0, n );

  min ( t )
  max ( t )
  min ( y(:,1) )
  max ( y(:,1) )
  min ( e(:,1) )
  max ( e(:,1) )

  dt = ( tspan(2) - tspan(1) ) / n;

  figure ( 1 )
  clf ( );
  hold ( 'on' );
    plot ( t, e(:,1), 'g', 'linewidth', 3 );
    plot ( t, e(:,2), 'r', 'linewidth', 3 );
  hold ( 'off' );
  grid ( 'on' );
  xlabel ( '<-- T -->' );
  ylabel ( '<-- Error(T) -->' );
  label = sprintf ( 'Error with dt = %g\n', dt );
  title ( label );
  legend ( 'Prey error', 'Predator error' );
  filename = 'error_rk12_time.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );

  figure ( 2 )
  clf ( );
  plot ( e(:,1), e(:,2), 'linewidth', 3 );
  grid ( 'on' );
  xlabel ( '<-- Prey Error(T) -->' );
  ylabel ( '<-- Predator Error(T) -->' );
  label = sprintf ( 'Predator/prey error with dt = %g\n', dt );
  title ( label );
  filename = 'error_rk12_phase.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );

  return
end

