This is my first Computer Science note so I would love a bit of feed back in the comments.
The most comforting thing about Newtonian Mechanics is that everything happens for a reason.For example,if you push one end of the lever,the other end goes up.You throw an object and it travels in a parabolic path.The physical world is a completely deterministic place-all the future states are derived form the previous s ones.For centuries we had this prevailing scientific wisdom,then came the Copenhagen doctrine,led by Bohr and Heisenberg.The proponents of this doctrine argued that at the most fundamental level,the behavior of a physical system cannot be determined.This led to a serious debate regarding the validity of causal non-determinism,ie every event is not caused by previous events.People like Einstein and Schrodinger found this philosophy unacceptable as exemplified by Einstein's often repeated comment - "God does not play dice".The question of causal non-determinism is still unsettled but there is ample evidence to prove that certain systems can only be modeled accurately by stochastic processes.A process is called stochastic if it's next step depends on both previous states and some random event.
We all know how to calculate the basic probability of occurrence of certain events.But how do we interpret the significance of the results obtained?The answer is in this age of fast computers we can run multiple simulations of an event and record the outcomes and compare the results with the mathematically calculated value!Then in front of our own eyes we can see how powerful the theory of probability is!
We all know that one of the most influential figures in the history of Probability Theory was Blaise Pascal.His interest in the field began when a friend asked him the following question
"Would it be profitable given 24 rolls of a pair of fair dice to bet against there being at least one double six"
Pascal and Fermat exchanged a number of letters to solve this issue which apparently looks easy in the 21st century.Let us calculate it.
The probability of rolling on one dice =
The probability of rolling on both dice = =
The probability of not rolling a double on first roll = =
The probability of not rolling a double on 24 rolls = = .
It states that in repeated independent tests,with actual probability of a particular outcome in each test,the change that the fraction of times that outcome occurs differs from converges to as the number of trails go to infinity.
In other words we are going to organize a large number of trails of Pascal's experiment and expect that the simulation results will get very close to the mathematically calculated value.
The programming language we are going to use is Python.We will use Python's random module to construct a program to check the results.It is given by the following code with the comments explaining each line.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
When I ran the program, the outcome was .Pretty close to Pascal's math!Try it out in a Python 2.7 interpreter!!
This note was inspired by a chapter from "Introduction to Computaion and programming in Python" by John V.Guttag.
Those of you wondering about the matrix picture it is because the movie depicts the ultimate computer simulation.