Tuesday, July 28, 2015

Limit of Sigma? Python to the Rescue!

I got an email today from a college student I tutor:
Hey Peter, there's a problem in the sigma notation section to find the limit as n goes to infinity, i=1 ending at n that goes like: 2/n((2i/n)^3+5(2i/n)). Please help! Thank you.
Translating a complicated problem into an email isn't easy. This is how the problem looks in a textbook:

It's been a long time since I forced myself to solve sigma problems by hand, so the first thing I did was set up a Python program to make i go from 1 to n and return the sum:

Python 2 will round this off to whole numbers, so I added the "from __future__" line to tell it to use decimals. I discuss this in my book Hacking Math Class with Python

Now I ran the program and made n a million. It's not infinite, but it should give an idea of what the sum is as n gets really large.


Looks like it gets really close to 14. The algebraic solution requires that we separate the n's and the i's. 

At this point you can replace the sigma-i's with their equivalent expressions in n. It's in every calculus book:
Making the substitutions and slogging through the algebra:


 Now we can stop and let n get really large. That will just make all the terms with n's in the denominator get really small. We can replace them with 0's.

4(1 + 0 + 0) + 10(1 + 0)
4(1) + 10(1)
14

As usual the algebraic solution is six times as long as a numerical solution using a short computer program. Thanks, Python!

No comments:

Post a Comment