Search code examples
javaalgorithmuser-interfaceparadox

Program to simulate Zeno's paradox in Java


So I was reading in a book of a certain paradox: Say you are in a room with a door opposite of you. In order to leave though, you must travel half the distance there each time. So the first stride you make half the distance, and the second stride you take half again, and so on (1/2 + 1/4 + 1/8) etc. The claim is if you will never reach the door if you continue like this. This is I guess easy to prove using calculus, but it would be interesting to simulate this in Java or any other program with a ball that starts on the left side, and makes its way to the right side by traveling half the distance each time, while showing the number of 'steps' taken so far and its progress. I would love to do it myself but I'm still a beginner in Java and dont know GUI programming. Can anyone simulate this?

(Sorry if this is not a 'real' question. I'm just really curious how many steps it would take for the ball to even look like it was almost there.)


Solution

  • See this plot, which visualizes the paradox:

    http://www.wolframalpha.com/input/?i=1-1/(2^n)+for+0<n<10