f[x_,y_]:=x*y*Log[y]
h=0.01;
x0=0;
y0=3;
koniec=1;

Numries[x_,y_,f_,h_]:=y+h*f[x,y]
Pres[x_]:=(3^(E^((x^2)/2)))

x[0]=x0;
y[0]=y0;
n=koniec/h;

Do[{x[i]=x0+i*h,y[i]=Numries[x[i-1],y[i-1],f,h]},{i,1,n,1}]
data=Table[{x[i],y[i]},{i,0,n}];
data1=Table[Abs[(y[i]-Pres[x[i]])],{i,0,n}];
vysledky=Table[{x[i],y[i],Pres[x[i]],Abs[(y[i]-Pres[x[i]])]},{i,0,n}];
maxerror=Max[data1];

Print["       hodnota x   numericke riesenie presne riesenie odchylka"]
PaddedForm[TableForm[vysledky],{12,4}]

g=Plot[Pres[x],{x,0,1},PlotStyle->{RGBColor[1,0,0],Thickness[0.005]}]

graf1=ListPlot[data,PlotStyle->{RGBColor[0,0,1]}] (*ide o numericke data*)

Show[g,graf1]

h=0.005;
n=koniec/h;
Do[{x[i]=x0+i*h,y[i]=Numries[x[i-1],y[i-1],f,h]},{i,1,n,1}]
data=Table[{x[i],y[i]},{i,0,n}];
data1=Table[Abs[Abs][(y[i]-Pres[x[i]])],{i,0,n}];
vysledky=Table[{x[i],y[i],Pres[x[i]],Abs[(y[i]-Pres[x[i]])]},{i,0,n}];
maxerror=Max[data1];
Print["       hodnota x   numericke riesenie presne riesenie odchylka"]
PaddedForm[TableForm[vysledky],{12,4}]

graf2=ListPlot[data,PlotStyle->{RGBColor[0,1,1]}] (*ide o numericke data*)

Show[g,graf1,graf2]

(*EOC  ras chyby*)

h=0.01;
Do[{hz=h/j,
n=koniec/hz,
Do[{x[i]=x0+i*hz,
y[i]=Numries[x[i-1],y[i-1],f,hz]},
{i,1,n,1}],data=Table[Abs[(y[i]-Pres[x[i]])],{i,0,n}],error[j]=Max[data]},{j,1,2,1}]
a1=error[1]
b1=error[2]
rad=N[Log[2,a1/b1]]

sol4=DSolve[{a'[t]=a[t]+Cos[t*a[t]],a[0]==0},a[t],t]

sol5=NDSolve[{a'[t]==a[t]+Cos[t*a[t]],a[0]==0},a,{t,0,2*Pi}]

zmathem=Plot[{a[t]/.sol5},{t,0,2*Pi}]

f[x_,y_]:=y+Cos[y*x]
h=N[2*Pi/100];
x0=0;
y0=0;
koniec=2*Pi;

Numries[x_,y_,f_,h_]:=y+h*f[x,y]
x[0]=x0;
y[0]=y0;
n=koniec/h;
Do[{x[i]=x0+i*h,y[i]=Numries[x[i-1],y[i-1],f,h]},{i,1,n,1}]
data=Table[{x[i],y[i]},{i,0,n}];

graf2=ListPlot[data,PlotStyle->{RGBColor[0,1,1]}]

Show[graf2,zmathem]

(*--------------------------------------------------------*)

f[x_,y_]:=y^2
h=0.01;
x0=0;
y0=-4;
koniec=1;

Numries[x_,y_,f_,h_]:=y+h*f[x,y]
Pres[x_]:=-1/(x+0.25)

x[0]=x0;
y[0]=y0;
n=koniec/h;

Do[{x[i]=x0+i*h,y[i]=Numries[x[i-1],y[i-1],f,h]},{i,1,n,1}]
data=Table[{x[i],y[i]},{i,0,n}];
data1=Table[Abs[Abs][(y[i]-Pres[x[i]])],{i,0,n}];
vysledky=Table[{x[i],y[i],Pres[x[i]],Abs[(y[i]-Pres[x[i]])]},{i,0,n,10}];
maxerror=Max[data1];
Print["       hodnota x   numericke riesenie presne riesenie odchylka"]
PaddedForm[TableForm[vysledky],{12,4}]

g=Plot[Pres[x],{x,0,1},PlotStyle->{RGBColor[1,0,0]}]

graf1=ListPlot[data,PlotStyle->{RGBColor[0,1,1]}]

Show[g,graf1]

(*EOC  ras chyby*)

Do[{hz=h/j,
n=koniec/hz,
Do[{x[i]=x0+i*hz,
y[i]=Numries[x[i-1],y[i-1],f,hz]},
{i,1,n,1}],data=Table[Abs[(y[i]-Pres[x[i]])],{i,0,n}],error[j]=Max[data]},{j,1,2,1}]
a1=error[1]
b1=error[2]
rad=N[Log[2,a1/b1]]

sol6=NDSolve[{z'[t]==z[t]^2,z[0]==-4},z,{t,0,2*Pi}]

zmathem2=Plot[{z[t]/.sol6},{t,0,2}]

sol7=DSolve[{q'[t]==q[t]^2,q[0]==-4},q,t]

zmathem3=Plot[{q[t]/.sol7},{t,0,3},PlotStyle->{RGBColor[1,0,1]}]

Show[zmathem3,zmathem2,g,graf1]

h=0.01/2;
Do[{hz=h/j,
n=koniec/hz,
Do[{x[i]=x0+i*hz,
y[i]=Numries[x[i-1],y[i-1],f,hz]},
{i,1,n,1}],data=Table[Abs[(y[i]-Pres[x[i]])],{i,0,n}],error[j]=Max[data]},{j,1,2,1}]
a1=error[1]
b1=error[2]
rad=N[Log[2,a1/b1]]