Saturday, August 22, 2009

The fly and the train, contd.

Thinking about the famous story involving von Neumann and the infinite series, I guessed that if we have a series where:

each succeeding term xn+1 is produced from the preceding term xn by multiplying by the factor 1/r, then the sum of all the terms xn+1 + xn+2... is equal to xn * 1/(r-1).

So, I ran a Python simulation and it turns out to be correct!

def test(r):
n = 100 # works for other n as well
rL = [n]
f = 1.0/r
for i in range(10):
print str(r).ljust(3),
print round(n*1.0/sum(rL[1:]),2)

for r in range(2,10): test(r)

2   1.0
3 2.0
4 3.0
5 4.0
6 5.0
7 6.0
8 7.0
9 8.0

If I'm reading the article correctly, this turns out to be a simple result from the theory of geometric series, and it looks like it works even for fractional r. Modifying the code above to test fractional r shows this is true. Department of "learn something new every day"....

My guess is that von Neumann saw all three pieces instantly:
• the first term and step size of the series
• the formula for the terms after the first one
• the easy way