{
 "nbformat": 4,
 "nbformat_minor": 5,
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "name": "python",
   "version": "3"
  }
 },
 "cells": [
  {
   "cell_type": "code",
   "id": "cell-0",
   "metadata": {},
   "execution_count": null,
   "outputs": [],
   "source": "# --- house style (the Press palette: accent/navy/gold/parchment) ---\nimport matplotlib as mpl\nACCENT, NAVY, GOLD, PARCH = '#7a1f1f', '#1f3a5f', '#b8860b', '#f7f2e7'\nmpl.rcParams.update({'figure.facecolor': PARCH, 'axes.facecolor': '#fffdf6',\n                     'axes.edgecolor': '#c9bfa3', 'font.family': 'serif'})\n\nimport numpy as np\nimport matplotlib.pyplot as plt\n\nw = np.array([3.0, -2.0, 4.0, -1.0, -2.5, 1.5])\nwp, wm = np.maximum(w, 0), np.maximum(-w, 0)\n\nassert np.allclose(w, wp - wm)\nassert not np.any((wp > 0) & (wm > 0))      # disjoint supports: uniqueness\nprint(f\"w  = {w}\\nw+ = {wp}\\nw- = {wm}\")\nprint(f\"net = {wp.sum() - wm.sum():g} = w+ {wp.sum():g} - w- {wm.sum():g}  (Thm 4.2)\")\n\nfig, ax = plt.subplots(figsize=(8, 3))\nax.bar(np.arange(6) - 0.2, wp, width=0.4, color='seagreen', label='$w^+$')\nax.bar(np.arange(6) + 0.2, -wm, width=0.4, color=ACCENT, label='$-w^-$')\nax.axhline(0, color='k', lw=0.8)\nax.set(xlabel='tessera', title='Jordan decomposition: $w = w^+ - w^-$ on disjoint supports')\nax.legend(); plt.tight_layout(); plt.show()\n"
  }
 ]
}