4 ms·
Random walk illustrated with D3
- paulgb 14y agoThe code for this is neat and impressively short, anyone looking to see the power of D3 should check it out: https://gist.github.com/wrr/4750218 https://gist.github.com/wrr/4750218 My only suggestion is that .data([color_idx]) would be more idiomatic (I think) if it were .datum(color_idx)
- mixedbit 14y agoThanks! It is now changed to datum().
- deleted 14y ago[deleted]
- mikeash 14y agoInteresting fact about the interesting facts at the bottom: each point is reached an infinite number of times only when a random walk is performed in one or two-dimensional space. For dimensions >=3, an infinite walk visits each point a finite number of times, which means that, while the random walker may return to the starting point one or more times after starting, it will eventually wander off forever. This has been described as, "A drunk man will find his way home, but a drunk bird may get lost forever."
- jeffwass 14y agoOr, in human terms, you can eventually find your car in a 2D parking lot, but not a 3D parking garage (as per Seinfeld http://en.wikipedia.org/wiki/The_Parking_Garage http://en.wikipedia.org/wiki/The_Parking_Garage)
- mturmon 14y agoI had forgotten that one. You inspired me to visit Wikipedia where I learned that the probability of a 3D random walk returning to the origin (given an unbounded number of steps) is about .34 (in 2D, as you note, this probability is 1). The probability of eventual return goes down as dimensionality increases. As you say, get lost forever.
- nevinera 14y ago"A moral of this is that any lucky series will always eventually be reversed and an expected outcome of a random walk is always 0. Or in other words - don’t play roulette ;)" The apriori expected outcome of a random walk is zero. The expected outcome of a random walk from a given position is the position itself. So no, 'any lucky series' will not 'always eventually be reversed'. I'm afraid that's not how probability works. But you still shouldn't play roulette.
- mixedbit 14y agoThe way I understand this, is that for a random walk of infinite length, your expected outcome is always 0. It doesn't matter that you started very lucky by winning 10 games in a row, because if you play an infinite number of times, you will balance this by loosing 10 games in a row (you'll do it an infinite number of times). In real life people usually don't play an infinite number of times, but the more you play, the better the theory approximates your final outcome. After very large number of games, you will very likely encounter a bad luck series. This is a bit counter intuitive, because according to the theory, there is a difference between a person that enters a fair game with 10$ and a person that enters with 1$ and wins 9$ in the first 9 games. The first person is expected to finish with 10$, the second with 1$, even though both have the same amount of money at some point. But laws that involve infinity are often counter intuitive.
- nevinera 14y ago>The way I understand this, is that for a random walk of infinite length, your expected outcome is always 0. It doesn't matter that you started very lucky by winning 10 games in a row, because if you play an infinite number of times, you will balance this by loosing 10 games in a row (you'll do it an infinite number of times). You understand it incorrectly. >This is a bit counter intuitive, because according to the theory, there is a difference between a person that enters a fair game with 10$ and a person that enters with 1$ and wins 9$ in the first 9 games. The first person is expected to finish with 10$, the second with 1$, even though both have the same amount of money at some point. But laws that involve infinity are often counter intuitive. That is exactly the example I would give of why your understanding is flawed. This is not 'counter-intuitive', it is a clear contradiction of basic logic. You are making a fairly common error in confusing a priori probability with conditional probability: http://en.wikipedia.org/wiki/Gamblers_fallacy http://en.wikipedia.org/wiki/Gamblers_fallacy. A standard phrase used by gamblers to refer to this truth is that "the dice have no memory." If you start a random walk from Chicago, you are expected to end up in Chicago. If you start a random walk from New York, you are expected then to end up in New York. If you, later on that same walk, notice that you are currently in Chicago, you can start expecting yourself to end up in Chicago, despite that your random walk started in New York: you have observed the actual events (collapsed the waveform), and now you have just taken a walk. This is the core of the misconception: "The first person is expected to finish with 10$, the second with 1$, even though both have the same amount of money at some point." The first person was expected to finish with 10$, and the second was expected to finish with 1$, but after the second player has won 9 games, he is then expected to finish with 10$, and anyone standing around watching who still has faith in their earlier expectation is uninformed.
- deleted 14y ago[deleted]
- taliesinb 14y agoand with Mathematica: ... http://taliesinb.net/visualizing-random-walks http://taliesinb.net/visualizing-random-walks
- halter73 14y agoToo bad this doesn't work in IE since it loads JS from github: http://stackoverflow.com/questions/7180099/including-js-from-raw-github-com http://stackoverflow.com/questions/7180099/including-js-from... At least in IE 10, it would work if it wasn't for this.
- mixedbit 14y agoThanks for pointing this out, it is now fixed.
- misleading_name 14y agoDoesn't work on my Windows Firefox... got it working on Chrome though.