Every point on the floor grid represents a state (x, y) of a first-order autonomous system dx/dt = f(x,y), dy/dt = g(x,y). The tilted arrows are the direction field — the instantaneous flow direction at that state, exactly what a solution curve must follow. The glowing dots are a swarm of trajectories advanced one numerical step per frame using whichever method (Euler or RK4) is selected; the two bright trails are a fixed pair of probes released from the same starting point, one integrated with forward Euler (orange) and one with 4th-order Runge-Kutta (cyan), so you can watch them separate as step size grows.
Euler: y(n+1) = y(n) + h·f(t, y(n))
RK4: k1 = f(t, y)
k2 = f(t + h/2, y + h/2·k1)
k3 = f(t + h/2, y + h/2·k2)
k4 = f(t + h, y + h·k3)
y(n+1) = y(n) + h/6·(k1 + 2k2 + 2k3 + k4)
- System — a damped linear oscillator (spiral toward equilibrium), the Van der Pol equation (self-sustaining limit cycle), or a damped pendulum (nonlinear restoring force sin x).
- Damping / μ — the parameter that shapes the flow: higher damping pulls trajectories to the origin faster; μ controls how strongly Van der Pol's limit cycle pumps energy in and out.
- Step size h — the numerical time increment taken every frame. Small h tracks the true flow closely for both methods; large h makes Euler visibly drift off the field lines or spiral out artificially while RK4 stays much closer to the truth.
- Trajectories — how many swarm particles flow through the field at once, all integrated with the selected method (Euler or RK4).
This is the core numerical-methods trade-off for solving ODEs without a closed-form solution: RK4 costs four function evaluations per step instead of one, but tolerates a much larger step size for the same accuracy — which is why production solvers default to it (or adaptive variants) over plain Euler.