function [ t, y ] = gear_euler ( n )

%*****************************************************************************80
%
%% gear_euler() implements the Euler method for gear_ode().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    04 June 2026
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer N: the number of steps to take.
%
%  Output:
%
%    real T(N+1), Y(N+1): the times and estimated solutions.
%
  t = zeros ( n + 1, 1 );
  y = zeros ( n + 1, 2 );

  [ C, t0, y0, tstop ] = gear_parameters ( );

  dt = ( tstop - t0 ) / n;

  t(1) = t0;
  y(1,:) = y0(:);

  for i = 1 : n
    t(i+1) = t(i) + dt;
    y(i+1,:) = y(i,:) - dt * ( C * y(i,:)' )';
  end

  return
end

