Euler's Method 
for Systems of Equations

Here we shall try Euler's method to solve differential equations numerically to the system of equations:

    ((Subscript[du, 1])/dt)  =   (Subscript[u, 2])
    ((Subscript[du, 2])/dt)  =  -(Subscript[u, 1])
    (Subscript[u, 1])(0) = 0
    (Subscript[u, 2])(0) = 1.
 
We will consider the range  0 ≤ t ≤ 20.

Clear[u1,u2,f1,f2,α1,α2,a,b]
f1[t_,u1_,u2_]=u2;
f2[t_,u1_,u2_]=-u1;
α1=0;
α2=1;
a=0;
b=20;

Let us first solve it analytically.  Actually, one could even guess that the solution is

  (Subscript[u, 1]) = sin t
  (Subscript[u, 2]) = cos t.

solveit=DSolve[{
			u1'[t]==f1[t,u1[t],u2[t]],
			u2'[t]==f2[t,u1[t],u2[t]],
			u1[a]==α1,
			u2[a]==α2},
		{u1[t],u2[t]},t];
u1[t_]=ComplexExpand[u1[t]/.solveit[[1]]]
u2[t_]=ComplexExpand[u2[t]/.solveit[[1]]]

Now let us apply Euler's method, and compare the graphs.

h=0.05;
t[i_]=a+i h;
n=Ceiling[((b-a)/h)];

w1[0]=α1;
w2[0]=α2;
Do[
	w1[i+1]=w1[i]+h f1[t[i],w1[i],w2[i]];
	w2[i+1]=w2[i]+h f2[t[i],w1[i],w2[i]],
	{i,0,n-1}]

list1=Table[{t[i],w1[i]},{i,0,n}];
list2=Table[{t[i],w2[i]},{i,0,n}];

plotw1[t_]=Interpolation[list1][t];
plotw2[t_]=Interpolation[list2][t];
Plot[{u1[t],plotw1[t]},{t,a,b},PlotStyle->{Red,Blue}]
Plot[{u2[t],plotw2[t]},{t,a,b},PlotStyle->{Red,Blue}]