function hockeystick_backward_euler ( n )

%*****************************************************************************80
%
%% hockeystick_backward_euler applies the backward euler method to the hockeystick equation.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    18 October 2020
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer N: the number of steps to take.
%
  if ( nargin < 1 )
    n = 25;
  end

  dydt = @ hockeystick_deriv;
  t0 = 1.0;
  tstop = 4.0;
  tspan = [ t0, tstop ];
  y0 = 1.0;

  [ t1, y1 ] = backward_euler ( dydt, tspan, y0, n );

  plot ( t1, y1, 'r-', 'linewidth', 3 );
  grid ( 'on' );
  xlabel ( '<-- t -->' );
  ylabel ( '<-- y(t) -->' );
  s = sprintf ( 'hockeystick ODE, backward euler method, n = %d', n );
  title ( s );
  filename = sprintf ( 'hockeystick_backward_euler_%d.png', n );
  print ( '-dpng', filename );

  return
end
