function [ t, y ] = quadratic_euler ( n, a, b, y0 )

%*****************************************************************************80
%
%% quadratic_euler uses Euler's method to solve an ODE y' = 2*t-2;
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    29 October 2019
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer N: the number of steps.
%
%    real A, B: the initial and final times.
%
%    real Y0: the initial value of the solution.
%
%  Output:
%
%    real T(N+1): the times.
%
%    real Y(N+1): the computed solution values.
%
  t = linspace ( a, b, n + 1 );
  t = t';
  dt = ( b - a ) / n;

  y = zeros ( n + 1, 1 );
  y(1) = y0;

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

  return
end
function value = quadratic_prime ( t, y )
  value = 2.0 * t - 2.0;
  return
end

