Interactive Computations

Use the free Wolfram *Mathematica Player* to interact with the math
behind NUMB3RS.

Billions and billions of stars. CHARLIE (O.S.) "God does not play dice with the universe." The UNIVERSE dissolves into a PHOTO of EINSTEIN. CHARLIE (O.S.) (CONT'D) Albert Einstein said this, in response to scientists who were postulating that our world, at its most fundamental level, is irreducibly random. Lecture hall. Charlie projects SLIDES for an ungrad class. CHARLIE Einstein wasn't alone in this belief. Human beings in general have trouble with the concept of randomness. We seek patterns, we perceive cause and effect. A SLIDE of a COMMERCIAL AIRPORT with AIRLINERS. CHARLIE (CONT'D) Let's say there are three airline crashes in two months. As happened in 1996. Do you cancel your upcoming flight and drive instead? A SLIDE of a HIGHWAY filled with traffic. CHARLIE (CONT'D) What is essentially a random streak or "run," we perceive as a pattern.

Consider a game in which a fair coin is tossed repeatedly. When the cumulative number
of heads is greater than the cumulative number of tails, heads is in the lead. Tails moves to the lead when the
cumulative number of tails is greater than the cumulative number of heads. Intuition might suggest that with a large
number of coin tosses, heads and tails would spend roughly equal time in the lead.

INT. DINING ROOM. EPPES HOUSE - DAY MEGAN Charlie, in mathematics, can something be too random? CHARLIE Randomness isn't quantifiable. Something can't be a little random - - or very random. Or too random.

A random or pseudorandom number generator
(RNG) is a computational or physical device designed to generate a random sequence of numbers. There are many different
methods for generating random bits and testing their
quality.

INT. DINING ROOM. EPPES HOUSE - DAY ALAN What if there's a pattern that you just haven't been able to detect? CHARLIE That's Hidden Variable Theory. The idea that nothing in the world is ever really random -- because there's always some influence or force we can't detect. ALAN And is that theory a good one? CHARLIE That's what Einstein believed in 1935, and it proved not to be true, at least in the way he believed it. Many scientists now believe that God does play dice with the universe. ALAN But -- doesn't dice have rules? MEGAN And a die only has six sides, right? CHARLIE Okay, forget the dice, that metaphor's not so good.

This Demonstration starts with the center *C* of a regular *n*-sided polygon and draws a new point at a fraction of the distance *r* between
*C* and a random vertex. Repeating
this process will, for certain initial conditions, produce fractal images. This procedure is known as the chaos game.

INT. CALSCI. LARRY'S OFFICE -- DAY Larry's working at his chalkboard. Charlie comes in. CHARLIE Pythagorean theorem, Law of Cosines, metrics-- LARRY Equivalence principle. CHARLIE Back to basics.

The Pythagorean theorem states that
in a right triangle, the square of the length of the hypotenuse (*c*) is equal to the sum of the
squares of the lengths of the other two sides (*a* and *b*).

INT. FBI BULLPEN -- DAY Charlie pulls out the iPod again. CHARLIE Remember I talked about the shuffle mode? DAVID How people perceive patterns when there aren't any. CHARLIE The shuffle mode on this music player is controlled by an algorithm. That algorithm creates a random order for the songs to be played in. But it's a psuedorandom order. You know why? MEGAN No idea -- DAVID That's why we have you. CHARLIE There's one thing the algorithm will never do ... repeat a song. It makes sure the same song is never repeated twice.

The rule 30 elementary cellular automaton
is the engine behind *Mathematica*'s
generation of pseudorandom numbers.
This Demonstration looks at an oversimplified version of how the central column in the evolution of this automaton can
be used to generate pseudorandom real numbers between 0 and 1.