# prize35-9 Exercise 2: how often can a patch burn and still become mature? import random random.seed(1) MATURE = 60 def mature_share(p, patches=2000, years=1000): ages = [0] * patches for _ in range(years): ages = [0 if random.random() < p else age + 1 for age in ages] return sum(age >= MATURE for age in ages) / patches print("disturbance/yr mature (model) mature (formula)") for p in (0.001, 0.01, 0.02, 0.05, 0.10): print(f"{p:14.3f} {mature_share(p) * 100:12.1f}% {(1 - p) ** MATURE * 100:13.1f}%") # Formula (1 - p) ** 60 = 0.10 -> p = 1 - 0.10 ** (1 / 60) p10 = 1 - 0.10 ** (1 / MATURE) print(f"\nmature wood falls to 10% of patches at about {p10:.4f} per year, once every {1 / p10:.0f} years on average") print("model check:", f"{mature_share(round(p10, 4)) * 100:.1f}%") # Output: # disturbance/yr mature (model) mature (formula) # 0.001 94.0% 94.2% # 0.010 55.3% 54.7% # 0.020 29.5% 29.8% # 0.050 4.5% 4.6% # 0.100 0.3% 0.2% # # mature wood falls to 10% of patches at about 0.0376 per year, once every 27 years on average # model check: 9.8% # Reading it: the model agrees closely with the formula (1 - p) ** 60; the small gaps are random chance with 2000 patches. # Mature wood needs 60 quiet years, so even a modest disturbance rate (one patch in 27 per year) leaves only about one patch in ten mature.