Notebook software for exploring integral approximation with finite sums?

Calc 2 (integration) courses often begin by introducing the idea of approximating the area under curves by rectangles, drawing pictures like this one of $y=\sqrt{x}$

Here we can approximate the area under the curve by the sum (yellow rectangles):

$0.2 (\sqrt{0.2} + \sqrt{0.4} + \sqrt{0.6} +\sqrt{0.8} +\sqrt{1}) \approx 0.75$

Doing these sums by hand gets tiresome very quickly, so when teaching this material I often resort to a spreadsheet for calculations. The drawback of using a spreadsheet is that it can't easily draw pretty pictures like the one above. I imagine this would be a good use case for Mathematica or Matlab, but I'd prefer not to use such expensive software for a brief topic like this.

Is there free or open source software that would allow me to demonstrate and explore, both graphically and numerically, approximating integrals by finite sums such as these? I don't mind if a bit of programming is required on my part. It would be nice it was easy to share my workbook/code with students.

I do this kind of thing using SageMath every time I teach it. In this case, there are even pre-made interactive things for this.

You can even embed them in webpages, use them in the Sage cell server (try it!), as well as in notebooks locally or online.

Note: Geogebra should also be able to make very nice things for this, but I haven't used them in quite some time and their license is no longer as free as in speech as it used to be. But it's certainly also an appropriate tool for this, certainly.

• There really are many other such solutions - gnuplot is another - so I really hope a few more people answer this, as it's likely to come up in web searches, what with SX folks being so good at SEO for their stuff... – kcrisman Apr 5 '17 at 12:53
• @krisman, Thank you. Great stuff. You've encouraged me to learn and use SageMath. – petehern Apr 6 '17 at 16:36
• That's the only thanks I need! – kcrisman Apr 7 '17 at 16:08

Desmos has the capability to do this and here is a worksheet that has done this pretty successfully.

• Thank you. Great demonstration of what's possible with Desmos--I use Desmos, but I didn't realize you could do much! – petehern Apr 6 '17 at 16:33

In Geogebra you can use the commands UpperSum[function, x-start, x-end, n] and LowerSum[function, x-start, x-end, n] to get both a visualization and the computed area of the rectangles. You can also add a slider for $n$, so students can interactively see how the visualization and computed area get closer to the desired area.

These commands however require you to work with intervals of the form $[x_0+k \Delta x, x_0+(k+1)\Delta x]$. If you need to, you can do some programming yourself (or let your students do it) to get different intervals.

• Thanks, Huy. I took the liberty of adding a screenshot. – petehern Apr 6 '17 at 16:47