Percolation/Mean run density: Difference between revisions

ce
(Added zkl)
(ce)
Line 1:
{{task|Percolation Simulations}}{{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>,; (andthe 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>.
 
TheFor example, the following vector has <math>R_{10} = 3</math>
<pre>
[1 1 0 0 0 1 0 1 1 1]
Line 23:
on the accuracy of simulated <math>K(p)</math>.
 
Show your output here.
 
;See also
2,442

edits