Aurora Lab / Skills / Bifurcation Diagrams

Bifurcation Diagrams

Publication-ready bifurcation diagrams computed from your ODE model. Your agent traces every branch of equilibria through its folds, classifies stability from the Jacobian, locates fold, branch and Hopf points against their exact values, checks each branch by simulation, and draws it all at journal column width.

  • v1.1.0
  • Python 3.10+ · numpy, matplotlib
  • No network access
  • Works with any SKILL.md agent

Overview

A bifurcation diagram claims two things: the branches exist where they are drawn, and they have the stability shown. A brute-force parameter sweep misses the unstable branches and blurs the points where stability changes. Bifurcation Diagrams makes your agent compute the diagram from your model, check it, and draw it to publication standard:

  • Continuation through folds. Every branch of equilibria is traced by pseudo-arclength continuation, so an S-shaped curve comes out as one branch, unstable middle included.
  • Stability from the Jacobian at every point: analytic when the derivatives are easy to write, central differences otherwise.
  • Located points. Folds (SN), branch points (BP) and Hopf points (H) are found by bisection on a test function, and each is compared with its exact value when one is known.
  • Checked by simulation. On every stable or unstable segment, a perturbed point is integrated to confirm it returns or leaves as classified.
  • Limit cycles past a Hopf point, from simulation, and optional trajectories for slow passages or hysteresis sweeps.
  • One encoding, publication ready. Colour marks the branch family, solid means stable and dashed unstable, every stability switch sits on its marked point, and the figure is saved at an exact journal column width as vector PDF plus PNG.
  • Documented. A caption draft with the fixed parameters, the method and every located point, plus a results JSON with each point's value, state and error.

Other Aurora Lab skills for a paper's figures: Paper Figures designs figures from data, and Figure Audit reviews figures that already exist. Each works on its own; they pair well.

Quick start

  1. Get the skill from Agensi and add it to your agent (Claude Code, Codex CLI, Cursor, Gemini CLI or any agent that loads SKILL.md skills).
  2. Have Python 3.10+ with numpy and matplotlib. scipy is optional: when it is installed, simulations use solve_ivp; otherwise a fixed-step RK4 integrator.
  3. Ask in plain words, with your model as equations in the message or as a file.

Example requests:

  • "Draw the bifurcation diagram of my model in parameter k from 0 to 5 and mark the folds."
  • "Where does the Hopf bifurcation happen in this predator-prey model? Plot equilibria and limit-cycle amplitude."
  • "Show the hysteresis loop: steady states against input, with a slow up-and-down sweep overlaid."
  • "Check that the stability on my existing bifurcation figure is right."

How it works

  1. Model. Your equations become a Python function of the state and one parameter; all other parameters are fixed and stated. Where the derivatives are easy, the agent also writes the Jacobian.
  2. Continuation. Each branch family is traced in both directions from a seed (an equilibrium found by Newton's method or by simulating to a steady state). Folds are passed without special handling.
  3. Stability and events. The Jacobian's eigenvalues give stability at every point. Where the number of unstable eigenvalues changes, the point is located by bisection: det J for a real eigenvalue (a fold if the branch turns back, a branch point if it carries on), the bialternate product for a complex pair (a Hopf point, with its frequency).
  4. Branch points. At a branch point another family crosses. The agent seeds that family and traces it separately; there is no automatic branch switching.
  5. Simulation check. On every stability segment, the point farthest from marginal stability is perturbed and integrated. Every segment must agree with its classification; a disagreement means the model, the Jacobian or the seed is wrong, and the agent fixes it rather than restyling the line.
  6. Limit cycles. Past a Hopf point, the cycle's maximum and minimum come from simulation, sampled more densely near the onset. For a supercritical Hopf the two curves are joined to the Hopf point, where the cycle is born with zero amplitude: this is the standard drawing, and the caption says so. Cycles found on the stable side of a Hopf point mean it is subcritical; the unstable cycle cannot be reached by simulation, and the caption says that too.
  7. Draw. One line per stability run, each starting and ending exactly on its event; open circles labelled SN, BP or H; a two-part legend (colour for family, grey keys for stable and unstable); the component that carries the story named on the axis.
  8. Save, document, look. Vector PDF and 600-dpi PNG at the chosen column width, the caption-and-spec file, the results JSON, and a final look at the rendered figure for collisions, branches meeting where they should and switches sitting on their circles.

Encoding rules it applies

Rule Why
Colour marks the branch family, never stability Stability is already carried by line style; two codes for one thing confuse readers
Solid for stable or attracting, dashed for unstable The convention readers expect in dynamical-systems papers
Every solid-to-dashed switch sits on a marked point A switch between grid points would misplace the bifurcation
Each stability run drawn as its own line Joining all stable points of a family would draw false straight segments
Colour-blind-safe Okabe-Ito colours, one family keeps its colour across panels Readable in print and for every reader
Fixed parameters, method and located points in the caption A reader can reproduce the diagram from the caption alone

Files it reads and writes

Path
Reads your model (equations in the message or a file you name); optionally parameter values in research/results/*.json or claims.md to mark as operating points
Writes research/figures/<name>.py, the diagram script: your model, the branches to compute and the drawing; it redraws the figure with numpy and matplotlib alone
research/figures/<name>-branches.json, the computed branches, stability, located points, simulation checks and limit cycles the script draws from
research/figures/<name>.pdf and .png, the diagram
research/figures/<name>.md, the caption draft and spec
research/results/<name>-bifurcations.json, one entry per located point: kind, parameter value, state, residual, frequency for Hopf points, and the exact value and error when known

Without a research/ folder it writes where you say. Your model file is never modified, and no file of the skill itself is copied into your project.

Helper and diagram script

The skill ships one helper, bifurcation_plot.py, a single file the agent runs from the skill folder, on standard input or from a temporary copy. Its compute command reads the diagram script's DIAGRAM description and writes the branch data; the diagram script then draws from that data.

DIAGRAM key What it holds
name, parameter, p_range, model Output name, the parameter and its range, a one-line model description
families One entry per branch family: a seed (x0 at p0, optionally simulated first with settle), continuation options, or a curve you already have
cycles Limit cycles past a Hopf point: range, number of runs, simulation length; joined to the Hopf point, with a run on the other side to tell supercritical from subcritical
sweeps Runs driven by a time-varying parameter (slow passage, hysteresis sweep) to overlay
analytic Exact values to compare the located points with

The diagram script carries a short drawing block (no import of the skill): draw_family, mark_points, draw_cycle, stability_legend, operating_point, overlay_trajectory, mm for column widths and save for PDF plus 600-dpi PNG.

python bifurcation_plot.py compute research/figures/<name>.py --out research   # compute (the agent runs this)
python research/figures/<name>.py                                              # redraw, numpy + matplotlib only
python bifurcation_plot.py selftest

FAQ

What does my model need to look like?

A system of ODEs with one parameter to vary. Type the equations, point to a Python file, or paste code from another language; the agent writes it as a Python function and, where it can, an analytic Jacobian.

How accurate are the located points?

With an analytic Jacobian, typically 1e-10 or better: the bundled examples match their exact values to between 1e-17 and 2e-10, and the demo run to about 1e-12. With finite differences, about 1e-6. Known exact values and the errors go into the report and the results JSON.

Why are the cycle curves joined to the Hopf point?

At a supercritical Hopf the cycle is born with zero amplitude at the Hopf point, so joining its maximum and minimum curves there is the standard drawing. The simulations start just past the point, and the caption states that the curves are joined.

Does it draw unstable limit cycles?

No. Cycles come from forward simulation, which reaches only attracting ones. For a subcritical Hopf, period-doubling or two-parameter diagrams, the method notes point you to dedicated continuation packages (AUTO-07p, MatCont, PyDSTool, BifurcationKit.jl).

Can I change the figure later?

Yes. Labels, colours, limits and sizes live in the diagram script, which redraws the figure with numpy and matplotlib alone: edit it and run python research/figures/<name>.py. To change the model, the parameter range or the branches, ask your agent to rerun the compute step; the caption draft is never overwritten by a redraw.

Does it work through Agensi's MCP connection, without a skill folder?

Yes. Your agent loads the instructions and the helper on request, runs the helper in-session and writes only the diagram script, the branch data, the figure, the caption draft and the results JSON into your project. The diagram script you keep is self-contained, and no skill file is copied into your project. Version 1.1 was tested this way.

Will it change my files?

No. It writes new figure, caption, results, branch-data and diagram-script files; your model file is never modified.

Limitations

  • One-parameter continuation of equilibria only; no two-parameter curves of folds or Hopf points.
  • Limit cycles come from simulation, so only attracting cycles are drawn; unstable cycles, period-doubling, torus and homoclinic bifurcations need a dedicated package.
  • No automatic branch switching: the agent seeds each family at a branch point separately.
  • ODEs only: delay equations, PDEs and discrete maps are not supported.
  • With a finite-difference Jacobian, located points are accurate to about 1e-6.
  • Branches of neutral (non-hyperbolic) equilibria, as in conservative models, need treatment by hand.
  • Journal column widths are built in; check your venue's current figure guidelines.

Changelog

1.1.0 · October 2026 · Works when the skill is delivered without a local folder (Agensi's MCP connection): the helper is one self-contained file that runs in-session, and its new compute command writes the branch data as JSON, so the diagram script you keep draws on its own and never imports or copies the skill. The compute step also checks a supplied Jacobian against finite differences and runs once on the stable side of a Hopf point to tell supercritical from subcritical. Same mathematics and the same located points as 1.0.

1.0.0 · October 2026 · First release.