This package contains Python code to generate the point-flow data used for the portrait plot matrices.
For ordered points on the unit interval, it studies the energy
E(x_1,...,x_k) = sum_{i<j} exp(-|x_j-x_i|^q).
The script computes a projected gradient-descent flow:
- starting from a uniform configuration shifted slightly into the interior
- taking small steps in the negative gradient direction
- clipping and sorting points back into the unit interval
- using simple backtracking if a step increases the energy
The helper generate_all_panels() builds the 2-column × 4-row portrait collection:
k=9, q=0.1k=9, q=1k=9, q=q_oddk=9, q=2k=10, q=0.1k=10, q=1k=10, q=q_10k=10, q=2
where:
q_odd = log(1/(-log((1+e^-1)/2))) / log(2)q_10 = 1.238523533
Install NumPy:
pip install numpyRun the script directly:
python gradient_flow_data_generation.pyIt will:
- generate all panels
- print a small summary for the
k=9, q=q_oddcase - write one CSV-like file called
k9_qcrit_flow_data.csv
-
energy(x, q)
Computes the discrete energy. -
gradient(x, q)
Computes the gradient with respect to the point positions. -
gradient_flow(k, q, n_steps=400, dt=0.0025, margin=0.03)
Generates one flow path. -
generate_all_panels()
Generates the full 2×4 portrait data set. -
to_csv_like_table(flow)
Exports one flow as plain CSV-like text. -
tikz_coordinates(flow, y_scale=1.0)
Converts a flow into point trajectories suitable for TikZ. -
print_tikz_trajectory_block(flow, y_scale=1.0)
Prints TikZ coordinate blocks for trajectory plotting.
- Endpoints are not fixed in this version.
- The initial condition is an equally spaced configuration inside
[margin, 1-margin]. - Very small gaps are snapped to exact collisions for cleaner downstream plotting.
gradient_flow_data_generation.pyREADME.md