"""Two Fermi estimates: heartbeats in a lifetime, and the mass of the air in a bedroom.""" import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parents[1])) from labkit import Q, versions # noqa: E402 print("computed:", versions()) print() print("1. Heartbeats in a lifetime") rate = Q(70, "1/min") life = Q(80, "year") beats = (rate * life).to("dimensionless").magnitude print(" 70 beats a minute x 60 minutes x 24 hours x 365.25 days x 80 years") print(f" = {beats:,.0f} ~ {beats:.1e} beats") low = (Q(60, "1/min") * Q(70, "year")).to("dimensionless").magnitude high = (Q(80, "1/min") * Q(90, "year")).to("dimensionless").magnitude print(f" slow heart, short life (60 a minute, 70 years): {low:.1e}") print(f" fast heart, long life (80 a minute, 90 years): {high:.1e}") print(" every reasonable choice lands between 2 and 4 billion: about 3 x 10^9") print() print("2. The air in a room") room = Q(5, "m") * Q(4, "m") * Q(2.5, "m") air_per_cubic_metre = Q(1.2, "kg/m^3") # dry air near sea level at about 20 degrees C mass = (room * air_per_cubic_metre).to("kg") print(f" 5 m x 4 m x 2.5 m = {room.to('m^3').magnitude:.0f} cubic metres") print(f" each cubic metre of air has a mass of about 1.2 kg -> {mass.magnitude:.0f} kg of air") print(" the air in a large bedroom has about the mass of an adult")