% Declare the relevant parameters
h=0.1;
w0=0.0;
tmin=0.0;
tmax=2.0;

nmax=(tmax-tmin)/h;

tlast=tmin;
wlast_euler=w0;
wlast_midpoint=w0;
wlast_rk4=w0;
wlast_rk4f=w0;

t(1) = tmin;
w_euler(1) = w0;
w_midpoint(1) = w0;
w_rk4(1) = w0;
w_rk4f(1) = w0;
w_rk5f(1) = w0;
y(1) = w0;

errortot(1)=0.0;

% Beginning of Loop

for i=2:(nmax+1)

% Runge Kutta 4
    k1 = h*deriv(tlast,wlast_rk4);
    k2 = h*deriv(tlast+h/2,wlast_rk4+k1/2.0);
    k3 = h*deriv(tlast+h/2,wlast_rk4+k2/2.0);
    k4 = h*deriv(tlast+h,wlast_rk4+k3);
    w_rk4(i)=wlast_rk4+(k1 + 2*k2 + 2*k3 + k4)/6.0;

% Runge Kutta 4 half step
% Note: only half the stepsize
% Important: make sure you have the right "wlast" in the call to deriv!!!
    k1_1 =
    k2_1 = 
    k3_1 = 
    k4_1 = 
    temp_rk4 =

%   Now, calculate k1_2, ... from temp_rk4, to get w_rk4_double(i);
%   Need 5 lines 
 
....
    w_rk4_double(i) = ... 
 

% Fehlberg
% calculate all the k's, and the 4th and 5th order approximation
% Need 8 lines
 

% Advance time
% Define all the "wlast"
    t(i) = tlast + h;

% Exact Solution
    y(i) = exact(t(i));
end 
