Using Jupyter as a Worksheet for Strong Acid / Strong Base Calculations¶
In [1]:
import sympy.physics.units as u
from math import log10
In [2]:
# atomic mass, taken from a Periodic Table of the Elements
H=1.0079
Cl=35.453
Na=22.990
O=15.999
K=39.098
Ca=40.078
Ba=137.33
S=32.065
$$ Ba(OH)_2 $$
In [3]:
# Barium Hydroxide molecular mass computed using the atomic mass variables, with units "mmu", molar mass units
# ... automatically converted to kg/mol
moleculeMass=(Ba+2*(O+H))*u.mmu
moleculeMass
Out[3]:
In [4]:
# 4 grams of Barium Hydroxide
# ... automatically converted to kg
labWeight=4.00*u.g
labWeight
Out[4]:
In [5]:
# kg of substance divided by kg/mol gives number of moles, rounded to 3 significant digits
(labWeight/moleculeMass).n(3)
Out[5]:
$$ [OH^-] $$
In [6]:
# 4 grams of Barium Hydroxide dissolved in 0.500L water
# if concentration is calculated with Sympy Units, it will automatically convert from liters to m**3
# so best to abandon Sympy Units at this point, and simply divide moles by liters
OHconcentration=2*(0.0233/0.500) # moles x2 because 2 moles hydroxide ions for each mole of barium hydroxide
OHconcentration
Out[6]:
In [7]:
# Hydroxide Ion concentration is in mol/L, so it can be used to find pOH
pOH = -1*log10(OHconcentration)
pOH
Out[7]:
In [8]:
# pH is 14 minus pOH
14-pOH
Out[8]:
$$ [H^+] $$
In [9]:
# Hydrogen Ion concentration can be computed with 10**(-14) equilibrium constant
Hconcentration=(10**(-14))/OHconcentration
Hconcentration
Out[9]:
In [10]:
# pH can also be computed from the Hydrogen Ion concentration, and compared to pH compute above
-1*log10(Hconcentration)
Out[10]: