Simulate n independent Bernoulli(p_true) trials and return
(estimate, lower, upper): the observed proportion and a 95% confidence
interval for it.
An estimate without an interval is close to useless, because it gives no way to tell a converged answer from a noisy one. Note the interval narrows with , so a tenfold improvement costs a hundred times the simulations.
Seed np.random.seed(seed) inside solve, immediately before drawing.
Input
p_true = 0.3
n = 10000
seed = 0
Output
(0.3055, 0.29647187000758185, 0.31452812999241814)