Files
plot_mu_trajectories/README.md
T
loicvhandClaude Opus 5 b2b782394a Add mu-trajectory plot for the projection onto an ellipse
Cleaned-up extraction of test_mu_ellipse from proj_ellipsoid:
- quadric.py: minimal Ellipsoid class (standardization, KKT trajectory,
  extreme roots by exact bracketing, degenerate points, asymptotes).
- plot_mu_trajectories.py: the 4-panel figure, typeset with LaTeX.
- test_quadric.py: checks against brute-force sampling of the ellipse.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-15 20:50:05 +02:00

29 lines
1.1 KiB
Markdown

# mu-trajectories
Visualize the KKT trajectory of the Euclidean projection of a point `x0` onto an ellipse
`x'Ax + b'x + c = 0`:
x(mu) = (I + mu A)^{-1} (x0 - mu b / 2)
The figure shows the trajectory in the plane, `f(mu) = psi(x(mu))`, the distance
`||x0 - x(mu)||` and `f'(mu)`, together with the nearest/farthest KKT points `x(mu*)`,
`x(mu**)` and, when `x0` has a zero standardized coordinate, the degenerate point `x^d`.
## Usage
pip install -r requirements.txt
python plot_mu_trajectories.py # degenerate case x0 = (0, -0.1)
python plot_mu_trajectories.py --x0 0.3 0.2 --output figures/generic
pytest
The ellipse is set by `A`, `B`, `C` at the top of `plot_mu_trajectories.py`.
Text is typeset with LaTeX (`text.usetex`) when `latex` is on the `PATH`, with the `cm-super` and
`type1cm` packages; otherwise matplotlib's Computer Modern math font is used.
## Files
- `quadric.py`: the `Ellipsoid` class (standardization, trajectory, extreme roots, degenerate points).
- `plot_mu_trajectories.py`: the figure.
- `test_quadric.py`: checks against brute-force sampling of the ellipse.