# Time 12, Exercise 2: radioactive half-lives and reading the age of a sample import math # Remaining fraction after time t: N/N0 = (1/2) ** (t / half_life) # Age from remaining fraction: t = half_life * log2(N0 / N) C14 = 5730 # carbon-14 half-life, years U238 = 4.468e9 # uranium-238 half-life, years # Part 1: carbon-14 fractions for t in (5730, 11460, 20000, 50000): print("C-14 after", t, "years:", f"{0.5 ** (t / C14):.4f}", "remaining") # Part 2: ages from a measured fraction def age(half_life, fraction): return half_life * math.log2(1 / fraction) print("C-14 sample with 25% left:", round(age(C14, 0.25)), "years") print("C-14 sample with 10% left:", round(age(C14, 0.10)), "years") # Part 3: uranium-238 and the Earth print("U-238 left after 1 billion years:", f"{0.5 ** (1e9 / U238):.3f}") print("U-238 left after 4.54 billion years (Earth):", f"{0.5 ** (4.54e9 / U238):.3f}") # Part 4: a rock whose uranium is 70% intact print("rock with 70% U-238 left:", f"{age(U238, 0.70) / 1e9:.2f}", "billion years old") # Output when run: # C-14 after 5730 years: 0.5000 remaining # C-14 after 11460 years: 0.2500 remaining # C-14 after 20000 years: 0.0890 remaining # C-14 after 50000 years: 0.0024 remaining # C-14 sample with 25% left: 11460 years # C-14 sample with 10% left: 19035 years # U-238 left after 1 billion years: 0.856 # U-238 left after 4.54 billion years (Earth): 0.494 # rock with 70% U-238 left: 2.30 billion years old # Reading the output: after 50,000 years only about a quarter of one percent of the carbon-14 # is left, which is why the method stops being useful at around that age. Uranium-238 has lost # about half its atoms since the Earth formed, so it works on the billion-year scale.