1
0

acidity.nbt 291 B

12345678910
  1. # Compute the pH (acidity) of a solution based
  2. # on the activity of hydrogen ions
  3. #
  4. # https://en.wikipedia.org/wiki/PH
  5. fn pH_acidity(activity_hplus: Molarity) -> Scalar =
  6. - log10(activity_hplus / (mol / L))
  7. print(pH_acidity(5e-6 mol / L))
  8. assert_eq(pH_acidity(5e-6 mol / L), 5.3, 0.1)