# prize35-7 Exercise 2: does the starting advantage matter when competition is strong? def run(a, n1, n2, years=200): k, r = 1000, 0.4 for _ in range(years): g1 = r * n1 * (1 - (n1 + a * n2) / k) g2 = r * n2 * (1 - (n2 + a * n1) / k) n1, n2 = max(n1 + g1, 0.0), max(n2 + g2, 0.0) return n1, n2 for a in (0.8, 1.2): for start in ((100, 50), (50, 100)): f1, f2 = run(a, *start) print(f"alpha {a}, start {start}: species 1 = {f1:.0f}, species 2 = {f2:.0f}") # Output: # alpha 0.8, start (100, 50): species 1 = 556, species 2 = 556 # alpha 0.8, start (50, 100): species 1 = 556, species 2 = 556 # alpha 1.2, start (100, 50): species 1 = 1000, species 2 = 0 # alpha 1.2, start (50, 100): species 1 = 0, species 2 = 1000 # Reading it: with alpha 0.8 (each species hurts the other less than itself) both settle at 556 whichever starts # ahead: stable coexistence. With alpha 1.2 each species hurts the other more than itself, so the early leader wins # everything and the other is lost. Strong competition makes the outcome depend on the starting point.