Table of Contents
Fetching ...

Simulating a coin with irrational bias using rational arithmetic

Luis Mendo

TL;DR

This work tackles generating a Bernoulli random variable with parameter $\tau \in (0,1)$ from unbiased coin inputs while performing only rational arithmetic. It requires a positive-term series representation $\tau = \sum_{j=1}^ ∞ a_j$ with $a_j \in \mathbb{Q}_{>0}$ and a computable truncation error bound $\varepsilon(N)$ that vanishes as $N \to \infty$, and embeds this into a Buffon-machine style Bernoulli factory using a random stopping index $M$ and quantized interval updates. The framework proves strong efficiency guarantees: the input count $L$ has an exponential tail with $\Pr[L>l] \le 2^{-l+1}$ and $\mathbb{E}[L] \in [2,3]$, while the number of series terms $N_M$ satisfies $\Pr[N_M>n] < 4\varepsilon(n)$ and has finite expectation under a suitable decay of $\varepsilon(n)$. Applications to Euler's constant $\gamma$ (solving an open problem for rational-arithmetic simulation) and to $\pi/4$ demonstrate practicality and efficiency, and the approach extends to other $\tau$ expressible via rational-term series, with potential extensions to biased inputs.

Abstract

An algorithm is presented that, taking a sequence of independent Bernoulli random variables with parameter $1/2$ as inputs and using only rational arithmetic, simulates a Bernoulli random variable with possibly irrational parameter $τ$. It requires a series representation of $τ$ with positive, rational terms, and a rational bound on its truncation error that converges to $0$. The number of required inputs has an exponentially bounded tail, and its mean is at most $3$. The number of arithmetic operations has a tail that can be bounded in terms of the sequence of truncation error bounds. The algorithm is applied to two specific values of $τ$, including Euler's constant, for which obtaining a simple simulation algorithm was an open problem.

Simulating a coin with irrational bias using rational arithmetic

TL;DR

This work tackles generating a Bernoulli random variable with parameter from unbiased coin inputs while performing only rational arithmetic. It requires a positive-term series representation with and a computable truncation error bound that vanishes as , and embeds this into a Buffon-machine style Bernoulli factory using a random stopping index and quantized interval updates. The framework proves strong efficiency guarantees: the input count has an exponential tail with and , while the number of series terms satisfies and has finite expectation under a suitable decay of . Applications to Euler's constant (solving an open problem for rational-arithmetic simulation) and to demonstrate practicality and efficiency, and the approach extends to other expressible via rational-term series, with potential extensions to biased inputs.

Abstract

An algorithm is presented that, taking a sequence of independent Bernoulli random variables with parameter as inputs and using only rational arithmetic, simulates a Bernoulli random variable with possibly irrational parameter . It requires a series representation of with positive, rational terms, and a rational bound on its truncation error that converges to . The number of required inputs has an exponentially bounded tail, and its mean is at most . The number of arithmetic operations has a tail that can be bounded in terms of the sequence of truncation error bounds. The algorithm is applied to two specific values of , including Euler's constant, for which obtaining a simple simulation algorithm was an open problem.

Paper Structure

This paper contains 2 sections, 7 equations, 1 figure.

Figures (1)

  • Figure :