Runge-Kutta-Fehlberg

f[t_,y_]=1+Cos[t y];
a=0;
b=10;
alpha=0.;

tol=1.*^-6;
hmax=1.*^-1;
hmin=1.*^-4;

t=a;
w=alpha;
h=hmax;
flag=True;
list={{t,w}};

While[flag,
	k1=h f[t,w];
	k2=h f[t+(h/4),w+(k1/4)];
	k3=h f[t+((3 h)/8),w+((3 k1)/32)+((9 k2)/32)];
	k4=h f[t+((12 h)/13),w+((1932 k1)/2197)-((7200 k2)/2197)+((7296 k3)/2197)];
	k5=h f[t+h,w+((439 k1)/216)-8 k2+((3680 k3)/513)-((845 k4)/4104)];
	k6=h f[t+(h/2),w-((8 k1)/27)+2 k2-((3544 k3)/2565)+((1859 k4)/4104)-((11 k5)/40)];
	
	r=N[((Abs[(k1/360)-((128 k3)/4275)-((2197 k4)/75240)+(k5/50)+((2 k6)/55)])/h)];
	delta=N[0.84 ((((tol/r)))^0.25)];
	
	If[r≤tol,
		t=t+h;
		w=w+((25 k1)/216)+((1408 k3)/2565)+((2197 k4)/4104)-(k5/5);
		AppendTo[list,{t,w}]];
	
	h=Min[Max[delta,0.1],4] h;
	
	If[h>hmax,h=hmax];
	
	If[t≥b,
		flag=False,
		(* else *) If[t+h>b,
			h=b-t,
			(* else *) If[h<hmin,
				flag=0;
				Print["Minimum h exceeded"]]]]]

TableForm[list]

Clear[t]
plotw[t_]=Interpolation[list][t];
Plot[plotw[t],{t,a,b}]