29 lines
1.1 KiB
Text
29 lines
1.1 KiB
Text
{{Percolation Simulation}}
|
|
Let <math>v</math> be a vector of <math>n</math> values of either <tt>1</tt> or <tt>0</tt> where the probability of any
|
|
value being <tt>1</tt> is <math>p</math>; the probability of a value being <tt>0</tt> is therefore <math>1-p</math>.
|
|
Define a run of <tt>1</tt>s as being a group of consecutive <tt>1</tt>s in the vector bounded
|
|
either by the limits of the vector or by a <tt>0</tt>. Let the number of such runs in a given
|
|
vector of length <math>n</math> be <math>R_n</math>.
|
|
|
|
For example, the following vector has <math>R_{10} = 3</math>
|
|
<pre>
|
|
[1 1 0 0 0 1 0 1 1 1]
|
|
^^^ ^ ^^^^^
|
|
</pre>
|
|
Percolation theory states that
|
|
|
|
:<math>K(p) = \lim_{n\to\infty} R_n / n = p(1 - p)</math>
|
|
|
|
;Task
|
|
|
|
Any calculation of <math>R_n / n</math> for finite <math>n</math> is subject to randomness so should be
|
|
computed as the average of <math>t</math> runs, where <math>t \ge 100</math>.
|
|
|
|
For values of <math>p</math> of 0.1, 0.3, 0.5, 0.7, and 0.9, show the effect of varying <math>n</math>
|
|
on the accuracy of simulated <math>K(p)</math>.
|
|
|
|
Show your output here.
|
|
|
|
;See also
|
|
* [http://mathworld.wolfram.com/s-Run.html s-Run] on Wolfram mathworld.
|
|
|