implicitEuler[f_,u0_,h_,t0_,T_]:=(
n=Ceiling[(T-t0)/h];
t=Table[i h,{i,0,n}];
y=Table[0,{n+1}];
y[[1]]=u0;
For[i=1,i<n+1,i++,
initialGuess=y[[i]]+h f[t[[i]],y[[i]]];
y[[i+1]]=yNew/.FindRoot[yNew==y[[i]]+ h f[t[[i+1]],yNew],{yNew,initialGuess}]
];
y
)