What does The Sandbox, Determinism and Active Inference conclude, in numbers, about “Two Routes: Change the Mind, or Change the World”?
Answer: Take the first part first. When the agent's outcome prior is "rejection" (acceptance only 0.2), the risk of opening is large (0.701), because opening would bring too much acceptance that it "does not expect"; the risk of guarding is almost zero, because guarding brings exactly the rejection it expects. Add the fact that guarding's outcome is more predictable (lower ambiguity), and it opens only 3 % of the time. In the same world, an agent whose outcome prior is 0.8 opens 97 % of the time.
Scope of the numbers: Marked boxes separate published evidence, runnable Python calculations (15 programs, all checked), classical sources and the author's hypotheses. This book is not psychotherapy or diagnosis; its account of old priors driving repeated setbacks is a hypothesis and a cross-disciplinary analogy and never implies that victims are responsible for what happened to them.
Data table
The numbers below are printed verbatim by the chapter's Python program and can be reproduced by running it. standard-library Python onlyprinted values that match the answer: 0.2, 0.701, 0.8
| C(accepted) | 0.2: G(open) = 0.701+0.499 = 1.200, G(guard) = 0.020+0.349 = 0.369, P(open) = 0.03 |
| C(accepted) | 0.5: G(open) = 0.131+0.499 = 0.630, G(guard) = 0.316+0.349 = 0.666, P(open) = 0.54 |
| C(accepted) | 0.8: G(open) = 0.007+0.499 = 0.506, G(guard) = 1.059+0.349 = 1.409, P(open) = 0.97 |
| the same world: always 'open' is accepted 0.75 of the time, always 'guard' 0.125 | |
| learned preferences, last 100 of 400 trials (200 simulated lives each): | |
| hopeful start C | 0.8 P(open) 0.75, share of lives mostly open 85% |
| bleak start C | 0.2 P(open) 0.01, share of lives mostly open 0% |
| bleak start + 10 sandbox trials of 'open' P(open) 0.16, share of lives mostly open 16% | |
| bleak start + 30 sandbox trials of 'open' P(open) 0.62, share of lives mostly open 70% |
Key formula
Show the full program
# A minimal active-inference agent caught in a self-confirming loop (a simplified model).
# Two actions: 'open' (reach out) and 'guard' (pre-emptive coldness). Two outcomes: accepted, rejected.
# Hidden state: the other person is warm or cool (prior 50:50). In active inference the agent's
# preferences ARE prior beliefs about outcomes, C = p(o). Expected free energy of an action:
# G = risk + ambiguity = KL[q(o|a) || C] + E_q(s)[ H[p(o|s,a)] ]
import math, random
A = {"open": {"warm": 0.90, "cool": 0.60}, # p(accepted | state, action)
"guard": {"warm": 0.20, "cool": 0.05}}
Q_S = {"warm": 0.5, "cool": 0.5}
def H(p):
return -sum(x * math.log(x) for x in (p, 1 - p) if x > 0)
def G(action, c_acc):
qa = sum(Q_S[s] * A[action][s] for s in Q_S) # predicted p(accepted)
risk = qa * math.log(qa / c_acc) + (1 - qa) * math.log((1 - qa) / (1 - c_acc))
ambiguity = sum(Q_S[s] * H(A[action][s]) for s in Q_S)
return risk, ambiguity
def p_open(c_acc, gamma=4.0):
g = {a: sum(G(a, c_acc)) for a in A}
z = {a: math.exp(-gamma * g[a]) for a in A}
return z["open"] / (z["open"] + z["guard"])
for c in (0.2, 0.5, 0.8):
ro, ao = G("open", c); rg, ag = G("guard", c)
print(f"C(accepted) = {c}: G(open) = {ro:.3f}+{ao:.3f} = {ro+ao:.3f}, "
f"G(guard) = {rg:.3f}+{ag:.3f} = {rg+ag:.3f}, P(open) = {p_open(c):.2f}")
def life(c0, trials=400, forget=0.99, n0=10.0, forced_open=0, seed=1):
"""C is learned: it tracks the outcomes the agent has experienced (Dirichlet counts with forgetting).
forced_open = number of early low-stakes trials in which the agent tries 'open' regardless."""
rng = random.Random(seed)
acc, rej = c0 * n0, (1 - c0) * n0
opens = []
for t in range(trials):
c = min(max(acc / (acc + rej), 0.01), 0.99)
a = "open" if t < forced_open or rng.random() < p_open(c) else "guard"
s = "warm" if rng.random() < 0.5 else "cool"
accepted = rng.random() < A[a][s]
acc = forget * acc + accepted
rej = forget * rej + (not accepted)
opens.append(a == "open")
return sum(opens[-100:]) / 100, acc / (acc + rej)
print("the same world: always 'open' is accepted", sum(Q_S[s] * A["open"][s] for s in Q_S),
"of the time, always 'guard'", sum(Q_S[s] * A["guard"][s] for s in Q_S))
print("learned preferences, last 100 of 400 trials (200 simulated lives each):")
for label, c0, f in (("hopeful start C=0.8", 0.8, 0), ("bleak start C=0.2", 0.2, 0),
("bleak start + 10 sandbox trials of 'open'", 0.2, 10),
("bleak start + 30 sandbox trials of 'open'", 0.2, 30)):
res = [life(c0, forced_open=f, seed=k) for k in range(200)]
po = sum(r[0] for r in res) / len(res)
esc = sum(r[0] > 0.5 for r in res) / len(res)
print(f" {label:42s} P(open) {po:.2f}, share of lives mostly open {esc:.0%}")Single source and citation
Fan, Y. (2026). The Sandbox, Determinism and Active Inference (Version 1.0.0), Chapter 2: Two Routes: Change the Mind, or Change the World. 5D Library. https://doi.org/10.5281/zenodo.23738794
DOI: 10.5281/zenodo.23738794 · Read the monograph · 5DL-B-015 · v1.0.0 · CC-BY-NC-ND-4.0
BibTeX
@book{fan2026015,
author = {Fan, Yafu},
title = {The Sandbox, Determinism and Active Inference},
year = {2026},
publisher = {5D Library},
edition = {1.0.0},
doi = {10.5281/zenodo.23738794},
url = {https://doi.org/10.5281/zenodo.23738794}
}Other chapter answers in this book
- Chapter 1 · The Bayesian Brain and the Self-Fulfilling Prophecy
- Chapter 3 · Markov Blankets and the Boundary of the Individual
- Chapter 4 · Escaping the Local Optimum: Exploration and Exploitation
- Chapter 5 · Structured Sandboxes and the Reshaping of Priors
- Chapter 6 · Determinism, Chaos and Agency
- Chapter 8 · Practice and a Pre-Registered Trial