Use random Z_i

Show Z_i

k = false
n = 5 (slider from 1 to 30, step 1)
b = 6
a = 1
h: (b - a) / n
f(x) = -(x + 1) * (x - 8) / 5
z = 0.5 (slider from 0 to 1, step 0.1)
Z = Sequence(If[k, random() + 0 i, z], i, 1, 30)
list4 = Sequence(h f(a + (i - 1) h + Element[Z, i] h), i, 1, n)
list2 = Sequence(Segment[(a + (i - 1) h, 0), (a + (i - 1) h, f(a + (i - 1) h + Element[Z, i] h))], i, 1, n)
L = Sequence(If[i > n, 0, Element[list4, i]], i, 1, 30)
list3 = Sequence(Segment[(a + (i - 1) h, f(a + (i - 1) h + Element[Z, i] h)), (a + i h, f(a + (i - 1) h + Element[Z, i] h))], i, 1, n)
Approx: Element[L, 1] + Element[L, 2] + Element[L, 3] + Element[L, 4] + Element[L, 5] + Element[L, 6] + Element[L, 7] + Element[L, 8] + Element[L, 9] + Element[L, 10] + Element[L, 11] + Element[L, 12] + Element[L, 13] + Element[L, 14] + Element[L, 15] + Element[L, 16] + Element[L, 17] + Element[L, 18] + Element[L, 19] + Element[L, 20] + Element[L, 21] + Element[L, 22] + Element[L, 23] + Element[L, 24] + Element[L, 25] + Element[L, 26] + Element[L, 27] + Element[L, 28] + Element[L, 29] + Element[L, 30]
Exact = Integral(f, a, b)
list5 = Sequence(Segment[(a + i h, 0), (a + i h, f(a + (i - 1) h + Element[Z, i] h))], i, 1, n)
Z_i = Sequence((a + (i - 1) h + Element[Z, i] h, 0), i, 1, n)
list1 = Sequence(Polygon[(a + (i - 1) h, 0), (a + (i - 1) h, f(a + (i - 1) h + Element[Z, i] h)), (a + i h, f(a + (i - 1) h + Element[Z, i] h)), (a + i h, 0)], i, 1, n)
list6 = Sequence((a + (i - 1) h + Element[Z, i] h, f(a + (i - 1) h + Element[Z, i] h)), i, 1, n)
list7 = Sequence(Segment[Element[Z_i, i], Element[list6, i]], i, 1, n)
c = false