Before getting to rivers, let’s figure out where spaces are likely to appear in the (fictional) Fiddlish language, which includes only three- and four-letter words. These words are separated by spaces, but there is no other punctuation. Suppose a line of Fiddlish text is generated such that each next word has a $50$ percent chance of being three letters and a $50$ percent chance of being four letters.
Suppose a line has many, many, many words. What is the probability that any given character deep into the line is a space?
Let's suppose that we have $N \gg 1$ words in a line. Then there would be $N-1$ spaces, whereas the total length of the line would be $L = 4F + 3T + N-1$ characters, where $F$ is the number of four-letter words and $T$ is the number of three-letter words. Since $F+T = N,$ we have $$L = 4F+3(N-F) + N-1 = 4N + F - 1.$$ Since F is binomially distributed with frequency $\frac{1}{2},$ the expected value of $F$ is $\mathbb{E}[F] = \frac{N}{2},$ so the expected length is $$\mathbb{E}[L] = \frac{9}{2}N - 1.$$
Therefore, the expected frequency of spaces in the line, which is equivalent to the probability that any given character deep into the line is a space, is then $$p = \frac{N-1}{\mathbb{E}[L]} = \frac{N - 1}{\frac{9}{2}N - 1} \to \frac{2}{9} = 22.222\dots\%$$ as $N \to \infty.$
No comments:
Post a Comment