LRAM

RRAM

MRAM

f(x)=

f(x) = 16 - x^(2)
n = 4 (slider from 1 to 50, step 1)
x2 = 4 (slider from -5 to 10, step 0.1)
x1 = 0 (slider from -5 to 10, step 0.1)
h: (x2 - x1) / n
M2 = Sequence(f(i) * h, i, x1 + h / 2, x2 - h / 2, h)
R2 = Sequence(f(i) * h, i, x1 + h, x2, h)
L2 = Sequence(f(i) * h, i, x1, x2 - h, h)
L1 = Sequence((i, f(i)), i, x1, x2, h)
LeftP = Sequence(Polygon[(x(Element[L1, i]), 0), Element[L1, i], (x(Element[L1, i + 1]), y(Element[L1, i])), (x(Element[L1, i + 1]), 0)], i, 1, n)
RightP = Sequence(Polygon[(x(Element[L1, i]), 0), (x(Element[L1, i]), y(Element[L1, i + 1])), Element[L1, i + 1], (x(Element[L1, i + 1]), 0)], i, 1, n)
LM = Sequence((i + h / 2, f(i + h / 2)), i, x1, x2 - h, h)
MidP = Sequence(Polygon[(x(Element[L1, i]), 0), (x(Element[L1, i]), y(Element[LM, i])), (x(Element[L1, i + 1]), y(Element[LM, i])), (x(Element[L1, i + 1]), 0)], i, 1, n)
ShowLeft = true
ShowRight = false
ShowMid = false
LRAM = Sum(L2)
text1: " = " + LRAM
RRAM = Sum(R2)
text2: " = " + RRAM
MRAM = Sum(M2)
text3: " = " + MRAM
text4 = LaTeX(LRAM, true, true)
text5 = LaTeX(RRAM, true, true)
text6 = LaTeX(MRAM, true, true)
inputBox1 = Textfield(f)
A = Element(L1, 2)