B&S2026 Figure 3 Python Hopf continuation

User

Please start work on TASK-028.

Assistant

Started TASK-028:

  • Set status to In Progress
  • Assigned to @pi
  • Confirmed dependencies TASK-026 and TASK-027 are Done

Implementation plan already exists on the task. I’ll proceed with:

  1. Build reusable augmented Hopf packing/residual/phase infrastructure.
  2. Seed lower/upper branches at T=230 K.
Show remaining 5 lines
  1. Continue branches over T=190–240 K.
  2. Write curated Episode 006 outputs.
  3. Add smoke/regression tests.

Please confirm you approve this plan, and I’ll begin coding.

User

Go ahead.

Assistant

Completed TASK-028 and marked it Done.

Implemented:

  • src/bergner_spichtinger_2026/hopf.py
  • Augmented Hopf unknown packing
  • Residual equations
  • Eigenvector normalization
  • Previous-eigenvector phase condition
  • Fixed-temperature solves and branch continuation
  • episodes/006-figure3-hopf-bifurcation/scripts/generate_python_hopf_loci.py
Show remaining 13 lines
  • Seeds both branches at T=230 K
  • Continues over T=190–240 K
  • Writes curated loci, seeds, diagnostics, metadata
  • Curated outputs in:
  • episodes/006-figure3-hopf-bifurcation/outputs/figure3_python_hopf_loci/
  • Tests:
  • tests/test_hopf.py
  • tests/test_episode6_python_hopf.py
  • Updated Episode 006 README and package exports.

Verification:

  • uv run pytest
  • Result: 80 passed, with 3 solver-probe overflow warnings already expected/benign.
User

Can you make a figure as well as the output data? Just like for episode 5, there should be a figure for each continuation method, then a final integrated comparison figure.

Assistant

Done.

Added:

  • Per-method plotting utility:
  • episodes/006-figure3-hopf-bifurcation/scripts/plot_figure3_hopf_loci.py
  • Python method figure:
  • episodes/006-figure3-hopf-bifurcation/outputs/figure3_python_hopf_loci/python_figure3_hopf_loci.png
  • Integrated comparison figure, currently Python + Table II fits:
  • episodes/006-figure3-hopf-bifurcation/outputs/figure3_backend_comparison/figure3_hopf_backend_comparison.png
Show remaining 8 lines

Also updated:

  • Python generator now writes both data and figures.
  • README documents the plot workflow.
  • Episode 6 smoke test checks figure artifacts exist.

Verification:

  • uv run pytest
  • Result: 80 passed, with 3 expected solver-probe overflow warnings.
User

Those results look pretty bad. The Python Hopf loci on the plot don't match the Table II approximations at all.

Assistant

You’re right — the plotted loci were bad.

Root cause: the explicit eigenvector augmented system was admitting spurious roots. The physical-coordinate Hopf eigenvectors are extremely ill-conditioned, so the solve could drive the augmented residual tiny while not actually enforcing Re(lambda)=0.

I fixed the Python production workflow by switching the Hopf row to the robust 3D characteristic-polynomial condition:

a1*a2 - a3 = 0

for the physical ODE Jacobian characteristic polynomial. Equilibrium rows still use log-state/log-w conditioning.

Show remaining 14 lines

Regenerated:

  • episodes/006-figure3-hopf-bifurcation/outputs/figure3_python_hopf_loci/python_figure3_hopf_loci.csv
  • episodes/006-figure3-hopf-bifurcation/outputs/figure3_python_hopf_loci/python_figure3_hopf_loci.png
  • episodes/006-figure3-hopf-bifurcation/outputs/figure3_backend_comparison/figure3_hopf_backend_comparison.png

Now the Python loci track the Table II fits closely:

  • max relative deviation over curated grid: < 1%

Added a regression guard so this doesn’t recur:

  • Episode 006 smoke test now asserts loci stay within 2% of Table II reference at smoke-grid temperatures.

Verification:

  • uv run pytest
  • 80 passed, with the same expected solver-probe overflow warnings.
User

That now looks great! Please commit the changes.

Assistant

Committed changes.

Commit:

  • 2ec83e3 Implement Python Figure 3 Hopf continuation

Working tree is clean.