Saturday, December 24, 2011

A Programmer's View of the Universe

Had an interesting debate with some people on an IRC channel I frequent about universal processes and it was pretty neat so here's my own take on it.

Does true stochasticity exist?
Restated: Is there any element of the universe that is completely and utterly 100% random?

A common task in programming is generating random numbers for things like simulating a dice or generating noise. And really, true RNG (Random Number Generator - I'm going to use this acronym from now on) don't exist. People usually get away with it by making what's known as a PRNG (Pseudo-Random Number Generator) that uses an algorithm that's so ridiculously complicated and nonsensical that the result is pretty much random. Take this for example:

Plotted, it looks like this:
So, given a number from -100,000 to 100,000, the result of f(x) will be pretty much random.  But there's two problems to this approach.  Firstly, this is an algorithm, and therefore, there's a pattern, so it's not real stochasticity.  Secondly, the seed (in this case, the x) itself will have to be roughly random.  No matter how random this function looks, if you put in a 5, you will always get the same result.  f(5) will always be f(5).  Programmers get away with this by using seeds that change each time the script is run, like the system date and time, but even that's not fully random.  Good enough for a dice simulator, definitely, but it's still based on an algorithm that's always the same given the same parameters, and therefore not a true RNG.

Wait, what's this have to do with the universe?


I'm going to be representing universal cause-effect relationships as a Bayes network.
Very simple.  If it's dark, then it's either nighttime or there's a solar eclipse.  Granted, this is a simplified network.  There's a small chance that it's dark because there's a giant cow blocking the sun, or something, but that's irrelevant.  The idea is that a result (Dark) is caused by a number of parameters (whether it's Nighttime and whether there's a Solar Eclipse).

We'll define the parameters as the following:

P(Nighttime)=0.5
P(Solar_Eclipse)=0.01
P(Dark|Nighttime)=0.9999
P(Dark|Solar_Eclipse)=0.9995
P(Dark|Nighttime AND Solar_Eclipse)=0.99999995

  1. The first line says the probability of it being Nighttime is 0.5 (the other half being Daytime).
  2. The second line says the probability of there being a Solar Eclipse is 0.01.  Note that this is a totally arbitrary number, and if any astronomy majors want to correct me that'd be great.
  3. The third line says the probability of it being Dark given the fact that it's Nighttime is 0.9999.  What's the other 0.0001, you say?  Factors not represented by this Bayes network.  Maybe there's a man with a giant flashlight in the sky, or something.
  4. The fourth line says the probability of it being Dark given the fact that there's a Solar Eclipse is 0.9995.  Maybe it's not a total solar eclipse, and there's still some light, hence the 0.0005.  Again, these numbers are arbitrary.
  5. The fifth line says the probability of it being Dark given both Nighttime and a Solar Eclipse is 0.99999995.  This is calculated from the previous two probabilities.  If you're interested in the math it's like this:
    P(Dark|N AND SE)=1-(P(notDark|N)*P(notDark|SE))
    (Someone please correct me if I screwed up somewhere, I'm fairly horrible at Bayesian maths)
But the fact that those numbers aren't boolean shows that there's stochasticity!
Not necessarily.  Remember that this isn't a complete Bayes network.  We only assume random probabilities because we aren't going to go consider every parameter because that'd take forever.  Say for example, the line P(Dark|Nighttime)=0.9999, where we state that if we know for a fact that it's nighttime, there's a 9999/10000 chance that it will also be dark.  That's a probability, isn't it?  And by definition, probabilities represent random distributions.  The thing is, if we expand the network, we get something interesting.

Let's assume there's no other parameters we haven't accounted for.  The probability come out like this:

P(Dark|No_Giant_Flashlight AND Nighttime AND Total_Solar_Eclipse) = 1

whoa what what's going on I'm so confused I'm gonna cry

In the first example, we assumed there were parameters that we didn't take into account.  The reason P(Dark|Nighttime) was 0.9999 and not 1 was because we left room for things like massive sky flashlights.  Now, we've expanded our network to include every possible thing that can happen in the universe, and we no longer need that 0.0001 bit of leeway.  There is no longer a need to assume randomness.

Actually, what I just said isn't completely accurate.  We haven't actually accounted for everything.  It could be dark because the sun exploded, or something.  But if we were to theoretically expand this tree to take account every possible little thing, then randomness gets forced out of the picture.

That makes no sense!  What if the universe was infinitely complex?  Also, what about the P(Nighttime) and P(Solar_Eclipse) nodes?  They have no causes aside from randomness!

If the universe was infinitely complex, then we would simple need a network that can expand horizontally and vertically, infinitely, and the nodes would all still be completely deterministic.

Let's say that a state in the universe is defined by the positions of atoms in 3-dimensions, XYZ.  If there are an infinite number of atoms, then our network would expand horizontally to infinity; that is, there would be an infinite number of atoms defining our state, the universe.

If there were infinitely many sections and subsections of the atoms, then our network would expand vertically to infinity.

And if there were infinitely many dimensions, then our network would expand in depth to infinity; if I were to draw the network in 3D then it'd be in the back.  Each node (excluding the final universal state node) would have that many dimensions defining it.

Tried my best to draw it out.  Green would be horizontal, blue would be vertical, and red would be depth.  I only drew the dimensions for one atom, but really it'd apply for all atoms (and all subatoms too).

If we were to expand the three directions indefinitely, there'd still be no room for stochasticity.  And therefore, if the universe is actually infinite, then everything in it is deterministic.

I can't read all of that!  I actually have a life!

TL;DR everything is caused by something else.  Nothing is conscious.  Free will is a lie.  If you made a decision, it's because the neurons in your brain happened to fire that way, and they did so because of the combination of the temperature of the air or the vibrations of someone tapping on a desk and a ton of other factors all added together.  The universe is an algorithm, and if you were to start it off with the same seeds and parameters and logic then it will end exactly the same way.

What about God?

If there's a higher being that controls what we see and do, then logically, if the universe is infinite, there's something that controls that God, too.

What the hell!  You said you were agnostic!

I'm really making a few assumptions, here.   I'm assuming that the universe follows a sense of logic, and that our own sense of logic aligns correctly with this.  If the universe really doesn't follow any logic or science whatsoever and does as it pleases with no reason whatsoever, then I'm all out of options; there's room for stochasticity, there's room for God.

--

A small thanks to Goebbels from the #gmc channel at irc.twigathy.com for inspiring this post.  Also thanks to Wolfram Alpha for providing the graphs and stuff, and Fabio Cozman of Carnegie Mellon University for providing the fantastic Bayes network Java applet.

4 comments:

  1. http://27.media.tumblr.com/tumblr_lu9kgfZwNl1qg39ewo1_500.gif

    ReplyDelete
  2. Poor butler guy's forced in the shot.

    orange08 is it really that's fantastic

    ReplyDelete