MTC Chapter 6 — The Algebra of Transformations¶
Part II · Week 5 · Seed 20260601
Order matters. From $(7,8)$ both orders of list ($L$) and securitize ($S$) are feasible but land on different states; from $(5,8)$ only one order completes at all.
In [ ]:
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 non-commuting square¶
Value asymmetry: $L$-then-$S \to (8,3)$ vs $S$-then-$L \to (6,3)$.
In [ ]:
from engines import mtc_engine_ch06 as e
r78 = e.commute_at(7,8)
fig, ax = plt.subplots(figsize=(6.5,5.5))
start = (7,8)
ls = r78["L_then_S"]; sl = r78["S_then_L"]
# draw both paths
ax.annotate("", xy=(3,8), xytext=(7,8), arrowprops=dict(arrowstyle="->", color=MTC_RED, lw=2))
ax.annotate("", xy=ls, xytext=(3,8), arrowprops=dict(arrowstyle="->", color=MTC_RED, lw=2))
ax.annotate("", xy=(10,3), xytext=(7,8), arrowprops=dict(arrowstyle="->", color=BRASS, lw=2))
ax.annotate("", xy=sl, xytext=(10,3), arrowprops=dict(arrowstyle="->", color=BRASS, lw=2))
for pt,lab,col in [(start,"start (7,8)",SLATE),(ls,f"L then S {ls}",MTC_RED),(sl,f"S then L {sl}",BRASS)]:
ax.scatter(*pt, s=90, color=col, zorder=5); ax.text(pt[0]+0.15, pt[1]+0.15, lab, color=col, fontweight="bold")
ax.set_xlabel("$k_1$ (liquidity)"); ax.set_ylabel("$k_2$ (receivables)")
ax.set_title("The square does not close: order changes the endpoint")
plt.tight_layout(); plt.show()
print("at (7,8):", r78)
print("at (5,8):", e.commute_at(5,8))
Validation¶
Every number above is reproduced by the seeded engine; the checks below must all pass.
In [ ]:
from engines import mtc_engine_ch06 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")