%% t = 0.4

[a, b, c] = euler_explicit(@(t, y) exp(2*t) + 0.5*t, @(t, y) 0.5 - t + 2*y, 1, 0, 10, 0.4);
% [a, b, c] = euler_explicit(@(x, y) -0.5*x^4 + 4*x^3 - 10*x^2 + 8.5*x + 1, @(x, y) -2*x^3 + 12*x^2 - 20*x + 8.5, 1, 0, 4, 0.005);

disp(['The Explicit Euler estimation at ', num2str(10)]);
disp(['is: ', num2str(a)]);
disp(['The actual value is ', num2str(b)]);
disp(['The relative percent of error is ', num2str(c)]);

%% t = 0.2

[a, b, c] = euler_explicit(@(t, y) exp(2*t) + 0.5*t, @(t, y) 0.5 - t + 2*y, 1, 0, 10, 0.2);
% [a, b, c] = euler_explicit(@(x, y) -0.5*x^4 + 4*x^3 - 10*x^2 + 8.5*x + 1, @(x, y) -2*x^3 + 12*x^2 - 20*x + 8.5, 1, 0, 4, 0.005);

disp(['The Explicit Euler estimation at ', num2str(10)]);
disp(['is: ', num2str(a)]);
disp(['The actual value is ', num2str(b)]);
disp(['The relative percent of error is ', num2str(c)]);

%% t = 0.01

[a, b, c] = euler_explicit(@(t, y) exp(2*t) + 0.5*t, @(t, y) 0.5 - t + 2*y, 1, 0, 10, 0.01);
% [a, b, c] = euler_explicit(@(x, y) -0.5*x^4 + 4*x^3 - 10*x^2 + 8.5*x + 1, @(x, y) -2*x^3 + 12*x^2 - 20*x + 8.5, 1, 0, 4, 0.005);

disp(['The Explicit Euler estimation at ', num2str(10)]);
disp(['is: ', num2str(a)]);
disp(['The actual value is ', num2str(b)]);
disp(['The relative percent of error is ', num2str(c)]);

%% t = 0.05

[a, b, c] = euler_explicit(@(t, y) exp(2*t) + 0.5*t, @(t, y) 0.5 - t + 2*y, 1, 0, 10, 0.05);
% [a, b, c] = euler_explicit(@(x, y) -0.5*x^4 + 4*x^3 - 10*x^2 + 8.5*x + 1, @(x, y) -2*x^3 + 12*x^2 - 20*x + 8.5, 1, 0, 4, 0.005);

disp(['The Explicit Euler estimation at ', num2str(10)]);
disp(['is: ', num2str(a)]);
disp(['The actual value is ', num2str(b)]);
disp(['The relative percent of error is ', num2str(c)]);