a=0 b=2 f=function(x){ sin(x) } d=(b-a)/10000 s=seq(a,b,by=d) t=0 for(i in 1:length(s)){ t=t+f(s[i]) } t=t*d cat(t)