I am trying to set up a function to do Riemann Sum as follows. It does not work.

If you were pro or familiar with this, please give me help. Thank you for your time.

ClearAll[f, rightRsum2, x, a, b, n]

rightRsum2[f_, {x_, a_, b_, n_}] :=

Block[

{approx, delx, i},

delx = (b - a)/n;

approx = 0

Do[

{

x = a + i*delx;

approx = approx + delx * f[x];

}, {i, 1, n, 1}

]

]

g[x_] := x^2

rightRsum2[g[x], {x, 0, 1, 100}]