import numpy as np import matplotlib.pyplot as plt # ── Parameters ────────────────────────────────────────────────────────────── seed = 3903 n_petals = 6 # k in r = A|cos(k·θ/2)| amplitude = 1.576224 n_points = 1000 # ── Data ──────────────────────────────────────────────────────────────────── theta = np.linspace(0.0, 2.0 * np.pi, n_points) r = amplitude * np.abs(np.cos(n_petals * theta / 2.0)) # ── Plot ───────────────────────────────────────────────────────────────────── fig, ax = plt.subplots(subplot_kw={"projection": "polar"}, figsize=(5, 5)) ax.plot(theta, r, linewidth=1.5) ax.set_title( f"Rose Curve (k={n_petals}, A={amplitude:.2f})", pad=15 ) fig.tight_layout() plt.show()