I Can’t Derive These Summation Formulas — So, I’ll Just Model Them in Python

Rhett Allain
The Startup
Published in
4 min readJul 20, 2020

--

Yes, I’m doing a bunch of calculus stuff right now. My son is currently in calculus 1, so I end up answering questions. When I don’t really know the answer — I have to blog about it in some way.

So, why would anyone need these summation formulas? They are needed if you want to find the area under a curve by breaking the area into smaller rectangles. You then take the limit as the number of pieces goes to infinity — and boom. You get the area. Of course, you also get these summations in there that you have to evaluate.

Once you reduce the problem to one of these summation formulas, you can look up the expression. But why? I hate these formulas because I can only grok 2 of them. Let’s go over all four.

Sum of a constant.

This one is pretty easy.

Let’s start with a simple example of this. Suppose I have a constant c = 3 and I am summing from i = 1 to 4. If you write it out, it would look like this.

You could change “3” to c and “4” to n and you get the result. Simple.

But how would you do this in python? Here is my code. Note: I’m using Glowscript Vpython. It’s a little different in this case, in particular for print statements.

--

--

Rhett Allain
The Startup

Physics faculty, science blogger of all things geek. Technical Consultant for CBS MacGyver and MythBusters. WIRED blogger.