Integrate the worm epidemic model dI/dt = beta*I*(N-I) over fixed steps and print the infected count every three minutes, so the response window is visible.
Integrate the worm epidemic model dI/dt = beta*I*(N-I) over fixed steps and print the infected count every three minutes, so the response window is visible.
Answer
N = 100000 beta = 1e-5 dt = 0.01 I = 1.0 peak_minute = 0 peak_gain = 0.0 rows = [] for minute in range(1, 25): start = I for _ in range(100): I = I + beta * I * (N - I) * dt gain = I - start if gain > peak_gain: peak_gain = gain peak_minute = minute if minute % 3 == 0: rows.append((minute, round(I), round(gain))) for minute, infected, gain in rows: print(f"t={minute:2d} min infected={infected:6d} new={gain:6d}") print(f"steepest minute: {peak_minute} (+{round(peak_gain)} hosts)")
Stallings & Brown, Computer Security 5e, ch6 §6.4