Moves vertically

Moves horizontally

Number of lines:

Move any of the green points.

Vertical lines

Horizontal lines

Area=

×

Area=average length of all horizontal lines × average length of all vertical lines.

n = 5 (slider from 1 to 400, step 1)
A = Point(yAxis)
s(t) = y(A)
C = Point(s)
beg = 0
end: x(C)
diff: end - beg
B = Sequence(Segment[(p, 0), (p, s(p))], p, beg, end, diff / (n + 1))
vlen: y(A)
sumvlen: ((n - 1) * vlen)
D = Intersect(xAxis, yAxis)
a = Segment(A, D)
E: (x(C), 0)
b = Segment(C, E)
c = Segment(D, E)
d = Segment(A, C)
inputBox1 = Textfield(n)
text1: "Average=\frac{" + (LaTeX[vlen]) + "×" + (LaTeX[n]) + "}{" + (LaTeX[n]) + "}=" + (LaTeX[vlen]) + ""
F = Sequence(Segment[(0, p), (diff, p)], p, 0, vlen, vlen / (n + 1))
text3: "Average=\frac{" + (LaTeX[d]) + "×" + (LaTeX[n]) + "}{" + (LaTeX[n]) + "}=" + (LaTeX[d]) + ""
e = Segment(D, E)
f = true
g = true
text5: "" + (LaTeX[a]) + ""
text8: "" + (LaTeX[e]) + ""
ar: (a * e)
text7: "=" + (LaTeX[ar]) + ""