Vicsek dynamics, order-disorder transitions, and agent-based rules
Collective motion is the first session where the main model is not a continuous-time ODE. The dynamics come from a repeated update rule applied to many agents at once.
Start with Vicsek alignment, noise, constant speed, and periodic boundaries.
Measure the transition with the order parameter instead of relying on animation alone.
Then ask what changes when you add repulsion, predators, or richer decision rules.
State changes came from derivatives and continuous-time rate laws.
Each time step updates headings and positions directly from neighbor information, so a simulation loop is more natural than solve_ivp().
\[ \theta_i(t + \Delta t) = \langle \theta_j(t) \rangle_{j \in \mathcal N_i} + \frac{\eta}{2} \xi_i \]
\[ \mathbf x_i(t + \Delta t) = \mathbf x_i(t) + v_0 \Delta t (\cos \theta_i, \sin \theta_i) \]
At each step, every boid aligns with neighbors inside a radius \(r\), adds noise, moves at constant speed, and wraps back into the box with periodic boundary conditions.
Higher noise breaks alignment and pushes the system toward disorder.
More local contacts make alignment easier.
This sets who can influence whom at each step.
This controls how quickly local alignment propagates through the box.


Use the average normalized velocity to quantify how ordered the flock is. The interesting part is the transition, not just the animation.
Add a repulsion zone so agents avoid collisions instead of only aligning.
Add an escape rule, then decide whether the predator is passive, autonomous, or includes eating-spawning dynamics.
for step in range(num_steps):
theta = update_angles(xy, theta, radius=r, noise=eta)
xy = xy + speed * dt * np.vstack((np.cos(theta), np.sin(theta)))
xy = xy % box_size
order[step] = compute_order_parameter(theta)This is the discrete-time analogue of the solver loop from the ODE sessions.
Session overview Vicsek model Vicsek animation Vicsek validation Couzin model Predator extension Assignment
Applied Math Lab