function [ answer, error ] = jared_explicit( x0, xf, step, dfunc, initial, func )
%Uses the euler method for approximating values of the function given the
%derivative
%assigns initial x
x = x0;
%assigns initial y
y = initial;
%assigns step size
dx = step;
%calculates number of iterations
n = (xf-x0)/dx;
%displays initial x and y
disp(x);
disp(y);

%loop to run eulers method
for i = 1: n
    %euelers method
    y = y + dfunc(x,y)*dx;
    %displays value of x and y at each time step
%     disp(['Value of x at time step ' num2str(i) ' is : ' num2str(x)]);
%     disp(' ');
%     disp(['Value of y at time step ' num2str(i) ' is : ' num2str(y)]);
%     disp(' ');
    %calculates and displays error
     error = abs(((func(x) - y)/func(x))*100);
%     disp(['Value of error at time step ' num2str(i) ' is : ' num2str(error)]);
%     disp(' ');
    %increments time step
    x = x + dx;
end
%returns error
answer = y;
end

