Hi! I draw graphic using function 
gr1[f_, xmin_, xmax_, slices_] := 
  Module[{span = (xmax - xmin)/slices, ext}, 
   ext[op_, r_] := First@Quiet@op[{f, r <= x <= r + span}, x];
   Plot[f, {x, xmin, xmax}, 
    Prolog -> {FaceForm, EdgeForm, 
      Rectangle @@@ ({{#, ext[Minimize, #]}, {# + span, 
            ext[Maximize, #]}} & /@ Most@Range[xmin, xmax, span])}]];
f[x_] := x + 3*Sin[x + 2];
gr1[f, -5, -3, 10]
then I want loop this drawing ,for example  a=-5,b=-3,eps=0.1   
While[abs(b-a)>eps,gr1[f, a, b, 10]; a=(a+b)/2+0,5,b=(a+b)/2+0,5)]
but when I run this code it doesn't work, please help)