(* Modificiran metod na Oiler *)

a=1.;b=2;n=10;
f[x_,y_]:=(y/x)+1
x0=a;y0=0;
yt[x_]:=x Log[x]

h=((b-a)/n);


For[i=0;x=x0;y=y0,i≤ n,i++,

Print[" i= ",i," x= ",x," yi= ",y," fi= ",f[x,y],
" yi* = ",yt[x]," ei = ",Abs[y-yt[x]]];
x12=x+(h/2);
y12=y+(h/2) f[x,y];
y=y+h f[x12,y12];
x=x+h 
]
Print["Lokalnata greshka na izchisleniqta e = ",(h^3)]
Print["Globalnata greshka na izchisleniqta e = ",(h^2)]

(* dopalvame zadachata *)
a=1.;b=2;n=10;
f[x_,y_]:=(y/x)+1
x0=a;y0=0;
yt[x_]:=x Log[x]
grt=Plot[yt[x],{x,a,b}];
h=((b-a)/n);
xi=Table[a+i h,{i,0,n}]
points={{x0,y0}};
For[i=0;x=x0;y=y0,i≤ n,i++,

x12=x+(h/2);
y12=y+(h/2) f[x,y];
y=y+h f[x12,y12];
x=x+h ;
AppendTo[points,{x,y}]
]
grpoints=ListPlot[points,PlotStyle->{PointSize[0.03],Red}];
Show[grt,grpoints]
Print["Lokalnata greshka na izchisleniqta e = ",(h^3)]
Print["Globalnata greshka na izchisleniqta e = ",(h^2)]

(* dopalvame s novite x y f *)
a=1.;b=2;n=10;
f[x_,y_]:=(y/x)+1
x0=a;y0=0;
yt[x_]:=x Log[x]
grt=Plot[yt[x],{x,a,b}];
h=((b-a)/n);
xi=Table[a+i h,{i,0,n}]
points={{x0,y0}};
For[i=0;x=x0;y=y0,i≤ n,i++,
x12=x+(h/2);
y12=y+(h/2) f[x,y];
Print["  i= ",i,"  x= ",x,"  yi= ",y,"  fi= ",f[x,y],
"  (Subscript[x, i + (1/2)]) = ",x12,"  (Subscript[y, i + (1/2)]) = ",y12,"  (Subscript[f, i + (1/2)]) = ",f[x12,y12],
"  yi* = ",yt[x],"  ei = ",Abs[y-yt[x]]];

y=y+h f[x12,y12];
x=x+h ;
AppendTo[points,{x,y}]
]
grpoints=ListPlot[points,PlotStyle->{PointSize[0.03],Red}];
Show[grt,grpoints]
Print["Lokalnata greshka na izchisleniqta e = ",(h^3)]
Print["Globalnata greshka na izchisleniqta e = ",(h^2)]