<< 
      Graphics`Colors`
Off[
        General::"spell1"];
Off[
        General::"spell"];
MakeDataBarsOnly[dataTable_]:=Module[
{n, x = dataTable[[All, 1]], 
              y = dataTable[[All, 2]], maxY, minY, bars, edges, 
              prettyBars, points = dataTable}, 
n = 
              Length[x]; 
If[Max[y] > 0, maxY = Max[y], 
              maxY = 0]; 
If[Min[y] < 0, minY = Min[y], 
              minY = 0]; 
bars = 
              List[]; 
Do[
              bars = Append[bars, 
                  Graphics[{GrayLevel[0.9], 
                      Rectangle[{x[[j - 1]], 0}, {x[[j]], 
                          y[[j - 1]]}]}]], {j, 2, 
                n}]; 
edges = List[]; 
Do[
              edges = Append[edges, 
                  Graphics[{GrayLevel[0.7], 
                      Line[{{x[[j]], 0}, {x[[j]], 
                            y[[j]]}, {x[[j + 1]], 
                            y[[j]]}, {x[[j + 1]], 0}}]}]], {j, 1, 
                n - 1}]; 
prettyBars = 
              Join[bars, edges]; 
dots = 
              ListPlot[points, PlotStyle -> {PointSize[0.02]}, 
                DisplayFunction -> Identity]; 
Return[
              Show[{prettyBars, dots}, Axes -> True, 
                AxesOrigin -> {x[[1]], 0}, 
                DisplayFunction -> $DisplayFunction, 
                PlotRange -> {minY, maxY}]];
];
MakeDataBars[dataTable_, yhat_] := 
          Module[
{n, x = dataTable[[All, 1]], 
              y = dataTable[[All, 2]], bars, edges, prettyBars, 
              points = dataTable}, 
n = 
              Length[x]; 
bars = 
              List[]; 
Do[
              bars = Append[bars, 
                  Graphics[{GrayLevel[0.9], 
                      Rectangle[{x[[j - 1]], 0}, {x[[j]], 
                          y[[j - 1]]}]}]], {j, 2, 
                n}]; 
edges = List[]; 
Do[
              edges = Append[edges, 
                  Graphics[{GrayLevel[0.7], 
                      Line[{{x[[j]], 0}, {x[[j]], 
                            y[[j]]}, {x[[j + 1]], 
                            y[[j]]}, {x[[j + 1]], 0}}]}]], {j, 1, 
                n - 1}]; 
prettyBars = 
              Join[bars, edges]; 
dots = 
              ListPlot[points, PlotStyle -> {AbsolutePointSize[10]}, 
                DisplayFunction -> Identity]; 
curve = 
              Plot[yhat[t], {t, Min[x], Max[x]}, 
                DisplayFunction -> Identity]; 
Return[
              Show[{prettyBars, dots, curve}, Axes -> True, 
                AxesOrigin -> {x[[1]], 0}, 
                DisplayFunction -> $DisplayFunction]];
];
MakeRiemannBars[f_, xPartition_] := 
          Module[
{n, x = xPartition, y, minY, maxY, bars, 
              edges, prettyBars, points = dataTable}, 
y = 
              f[x]; 
If[Max[y] > 0, maxY = Max[y], 
              maxY = 0]; 
If[Min[y] < 0, minY = Min[y], 
              minY = 0]; 
n = 
              Length[x]; 
bars = 
              List[]; 
Do[
              bars = Append[bars, 
                  Graphics[{GrayLevel[0.9], 
                      Rectangle[{x[[j - 1]], 0}, {x[[j]], 
                          y[[j - 1]]}]}]], {j, 2, 
                n}]; 
edges = List[]; 
Do[
              edges = Append[edges, 
                  Graphics[{GrayLevel[0.7], 
                      Line[{{x[[j]], 0}, {x[[j]], 
                            y[[j]]}, {x[[j + 1]], 
                            y[[j]]}, {x[[j + 1]], 0}}]}]], {j, 1, 
                n - 1}]; 
prettyBars = 
              Join[bars, edges]; 
curve = 
              Plot[f[t], {t, Min[x], Max[x]}, 
                DisplayFunction -> Identity]; 
Return[
              Show[{prettyBars, curve}, Axes -> True, 
                AxesOrigin -> {x[[1]], 0}, 
                DisplayFunction -> $DisplayFunction, 
                PlotRange -> {minY, maxY}]];
];

Example: Find the area of bars of width 0.2 under the curve of y = -2 (x^3) + 8  x from x = 0.6 to x = 1.6

Define the function:

f[x_] = -2*x^3 + 8  x;

Part a:

Sum[f[0.6 + i*0.2], {i, 0, 5}]*0.2

Graphical representation:

MakeRiemannBars[f, 
        Range[0.6, 1.6, 0.2]];

Part b:

Sum[f[0.6 + i*0.01], {i, 0, (1.6 - 0.6)/0.01}]*0.01

Graphical representation:

MakeRiemannBars[f, 
        Range[0.6, 1.6, 0.01]];

Part c:

Limit[Sum[f[0.6 + i*dx], {i, 0, (1.6 - 0.6)/dx}]*dx, 
      dx -> 0]

Part d:

Sum[f[0.6 + i*0.2], {i, 0, 15}]*0.2

Graphical representation:

MakeRiemannBars[f, 
        Range[0.6, 3.6, 0.2]];

Part e:

Limit[Sum[f[0.6 + i*dx], {i, 0, (3.6 - 0.6)/dx}]*dx, 
      dx -> 0]