Thursday, 1 May 2014

(and Infinity Beyond)

So I came across this paradox called Thomson's Lamp, and immediately thought- "Well, isn't this what quantum theory is all about?"

Niels Bohr had once said-
"If quantum mechanics hasn't profoundly shocked you, you haven't understood it yet."

Let's try and simulate the phenomenon that creates this paradox.

(defn thomsons-lamp []
  (iterate (fn [[onoff dur]]
             [(not onoff) (/ dur 2)])
           [true 1]))

This Clojure function returns an infinite list of (on/off, duration)pairs where every successive on/off value is toggled (between true/false) and duration is halved.

NOTE: You can follow along on an awesome live REPL here.

So now when I call:
(take 10 (thomsons-lamp))

I get:
([true 1] 
 [false 0.5] 
 [true 0.25] 
 [false 0.125] 
 [true 0.0625] 
 [false 0.03125] 
 [true 0.015625] 
 [false 0.0078125] 
 [true 0.00390625] 
 [false 0.001953125])

...which is precisely what I wanted. Time to have some fun.

(nth (thomsons-lamp) 100) ;=> [true 7.888609052210118e-31]
(nth (thomsons-lamp) 1000) ;=> [true 9.332636185032189e-302]
(nth (thomsons-lamp) 10000) ;=>  [true 0]

Wait, what?

(nth (thomsons-lamp) 10001) ;=>  [false 0]
(nth (thomsons-lamp) 10002) ;=>  [true 0]

So it is on for 0 seconds, then turns off for the next 0 seconds, and keeps toggling every 0 seconds?

Basically, after some point, we don't know whether the lamp is on or off. In fact, it can be thought to be in both the states at the same time. We can know only if we observe or measure its state at a particular moment.

The problem is: we know that every even position (starting from 0) will return true, and every odd position will return false.

Measuring the state changes the outcome.

This has deep parallels with quantum theory, where electrons travelling at high velocities can either be observed as physical matter, or as waves of energy, depending on how we observe them (more).

Coming back to Thomson's problem, I define:

(defn state [t]
  (let [t-vals (map second (thomsons-lamp))]
    (loop [i 1]
      (if (<= t (apply + (take i t-vals)))
        ((comp first last) (take i (thomsons-lamp)))
        (recur (inc i))))))

which returns the state of the lamp at time = t seconds.

(state 1)    ;=> true
(state 1.5)  ;=> false
(state 1.51) ;=> true
(state 2)    ;=> false
(state 2.1)  ;=> ...(stuck)

Just as the paradox says, we will never know what the status of the lamp is after around 2 seconds.

PS: I got the idea after reading this list. You might like it too.

No comments:

Post a comment