The quadric, x(mu), f, f', mu* and the degenerate points now come from quadproj; the script keeps small helpers for what quadproj does not provide: mu**, the asymptotes and the ellipse boundary. The tests check these helpers against brute-force sampling and quadproj.project. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
32 lines
1.3 KiB
Markdown
32 lines
1.3 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 # every case, into figures/
|
|
python plot_mu_trajectories.py x_trajectories_mu_2 # a single case
|
|
pytest
|
|
|
|
Cases (`A`, `x0`, and optionally `b` and `c`) are listed in `CASES` at the top of
|
|
`plot_mu_trajectories.py`; each one produces `<name>.png` and `<name>.pdf`.
|
|
|
|
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
|
|
|
|
- `plot_mu_trajectories.py`: the figure. The quadric, `x(mu)`, `f`, `f'`, `mu*` and the degenerate
|
|
points come from [quadproj](https://loicvh.gitlab.io/quadproj); the script only adds `mu**`,
|
|
the asymptotes and the ellipse boundary.
|
|
- `test_plot_mu_trajectories.py`: checks these helpers against brute-force sampling of the ellipse
|
|
and against `quadproj.project`.
|