Riemann Sums
Author: LFS
Date: November 2009

Riemann Sums

To change the number of intervals, click and drag slider n.
To change interval of integration, type new values for a and b on the input line: example: a=0 (enter) and then b = 10 (enter)
To change the function, type new f(x) on input line. (Double-click in graphics view to open for zooming.)

Left Riemann Sum

Right Riemann Sum

Midpoint Riemann Sum

Integral (Exact Area)

a = 0
b = 5
n = 5 (slider from 0 to 40, step 1)
h: (b - a) / n
e = 2.718281828459045
f(x) = x^(3.0) - 5.0 * x^(2.0) + 2.0 * x + 15.0
g = Integral(f(x))
c = Integral(f(x), a, b)
ListX = Sequence(i, i, a, b, h)
ListY = Sequence(f(i), i, a, b, h)
LeftR = Sequence(Polygon[(Element[ListX, i], 0.0), (Element[ListX, i], Element[ListY, i]), (Element[ListX, i + 1.0], Element[ListY, i]), (Element[ListX, i + 1.0], 0.0)], i, 1.0, n, 1.0)
LeftSum: h * Sum[ListY] - h * f(b)
RightR = Sequence(Polygon[(Element[ListX, i], 0.0), (Element[ListX, i], Element[ListY, i + 1.0]), (Element[ListX, i + 1.0], Element[ListY, i + 1.0]), (Element[ListX, i + 1.0], 0.0)], i, 1.0, n, 1.0)
RightSum: h * Sum[ListY] - h * f(a)
ListXM = Sequence(xi, xi, a + h / 2.0, b - h / 2.0, h)
ListPtM = Sequence((i, f(i)), i, a + h / 2.0, b - h / 2.0, h)
ListPt = Sequence((i, f(i)), i, a, b, h)
ListYM = Sequence(f(i), i, a + h / 2.0, b - h / 2.0, h)
MidR = Sequence(Polygon[(Element[ListX, i], 0.0), (Element[ListX, i], Element[ListYM, i]), (Element[ListX, i + 1.0], Element[ListYM, i]), (Element[ListX, i + 1.0], 0.0)], i, 1.0, n, 1.0)
MidSum: h * Sum[ListYM]
ShowLeft = true
ShowRight = false
ShowMid = false
ShowExact = false
text1: " = " + LeftSum
text2: " = " + RightSum
text3: " = " + MidSum
text4: " = " + c