MTC Chapter 13 — Crisis: Coupled Networks¶

Part IV · Week 12 · Seed 20261301

Example 13.7: three firms, two fates. The loaded price $P(s)=\max(12-5s,1)$ produces an orderly equilibrium $S^-=\{A\}$ and a spiral $S^+=\{A,B,C\}$; the gap $\{B,C\}$ is an equilibrium selection.

In [1]:
import sys, os
sys.path.insert(0, r"/home/claude/mtc/mtc-course/downloads/engine_lib")
sys.path.insert(0, r"/home/claude/mtc/nbbuild")
from mtcplot import apply_style, MTC_RED, BRASS, SLATE, MTC_RED_LITE, MTC_RED_DARK
import matplotlib.pyplot as plt
import numpy as np
apply_style()

The loaded price and the two fixed points¶

Marked equity $2+P(s)-9$ is non-negative at $s=1$ (orderly) but $-6$ at $s=3$ (spiral).

In [2]:
from engines import mtc_engine_ch13 as e
ss = [1,2,3]
P = [e.loaded_price(s) for s in ss]
eq = [e.marked_equity(s) for s in ss]
fig, ax = plt.subplots()
ax.plot(ss, P, "-o", color=MTC_RED, lw=2.2, label="loaded price $P(s)$")
ax.plot(ss, eq, "-s", color=BRASS, lw=2.2, label="marked equity $2+P(s)-9$")
ax.axhline(0, color=SLATE, ls="--")
ax.scatter([1],[e.marked_equity(1)], s=140, color=MTC_RED_DARK, zorder=5)
ax.text(1.05, 0.3, "$S^-=\\{A\\}$ orderly", color=MTC_RED_DARK)
ax.scatter([3],[e.marked_equity(3)], s=140, color=MTC_RED_DARK, zorder=5)
ax.text(2.2, -5.5, "$S^+=\\{A,B,C\\}$ spiral", color=MTC_RED_DARK)
ax.set_xticks(ss); ax.set_xlabel("forced sellers $s$"); ax.set_ylabel("value")
ax.set_title("Coupled clearing: the gap $\\{B,C\\}$ is an equilibrium selection")
ax.legend()
plt.tight_layout(); plt.show()
print("S- =", sorted(e.least_fixed_point()), " S+ =", sorted(e.greatest_fixed_point()), " gap =", e.crisis_gap())
No description has been provided for this image
S- = ['A']  S+ = ['A', 'B', 'C']  gap = ['B', 'C']

Validation¶

Every number above is reproduced by the seeded engine; the checks below must all pass.

In [3]:
from engines import mtc_engine_ch13 as _e
v = _e.validation_checks(); v.pop("_values", None)
for k, val in v.items():
    print(f"  {k}: {val}")
assert v["ALL_PASS"], "validation failed"
print("\nALL_PASS — matches notebook + workbook + API")
  V1_P_at_s1_is_7: True
  V2_P_at_s3_is_1: True
  V3_neighbors_mark_0_at_s1: True
  V4_all_forced_at_s3: True
  V5_Sminus_is_A: True
  V6_Splus_is_ABC: True
  V7_gap_is_BC: True
  V8_tolerated_failure_1: True
  ALL_PASS: True

ALL_PASS — matches notebook + workbook + API