N.B.: Examples ported from my grad laptop scripts folder. I haven't done bench work in over ten years, so the example values may not be sane, but the math should still be correct.
# Absorbance
A = 1
# Sample volume (uL)
v = 5
# Solvent volume (uL)
V = 100
# Length/bp
L = 1000
Double Stranded DNA (50ug/mL per OD Maniatis E.5)
Molality (mg/mL)
$\frac{.05AV}{v}$
.050 * A * V/v
Molarity (M)
$\frac{.05AV}{v}\frac{660}{L}$
.050 * A * V/v / 660 / L
Single Stranded DNA or RNA (40ug/mL per OD Maniatis E.5)
Molality (mg/mL)
$\frac{.04AV}{v}$
.040 * A * V/v
Molarity (M)
$\frac{.05AV}{v}\frac{660}{L}$
.040 * A * V/v / 660 / L
Single Stranded oligos (20ug/mL per OD Maniatis E.5)
Molality (mg/mL)
$\frac{.02AV}{v}$
.020 * A * V/v
Molarity (M)
$\frac{.05AV}{v}\frac{660}{L}$
.020 * A * V/v / 660 / L
N.B.: This example uses the log and sqrt functions from the math module. This isn't covered in the primer, but we'll go over it in class.
# pKa of the (weak acid) buffer
pka = 3.8
# target pH (N.B.: if abs(pka-pH) > 1, consider picking a different buffer)
pH = 4.2
# total concentration of the buffer (molar)
total = .01
Expected initial pH:
$protonated_i = k_a + 2*total - \sqrt{\frac{k_a^2+4*total*k_a}{2}}$
$deprotonated_i = total - protonated_i$
$pH_i = -\log_{10}{deprotonated_i}$
from math import log, sqrt
ka = 10**(-pka)
# Calculate initial concentrations using the quadratic equation
protonated_i = (ka + 2 * total - sqrt((ka**2) + 4*total*ka))/2
deprotonated_i = total - protonated_i
pH_i = -log(deprotonated_i)/log(10)
pH_i
Add strong base to this concentration:
$deprotonated_f = total \left(1 - \frac{1}{1+10^{pH - pKa}}\right)$
$base = deprotonated_f - deprotonated_i$
# Calculate final concentrations using Henderson-Hasselbach
deprotonated_f = total * (1 - 1/(1 + 10**(pH - pka)))
protonated_f = total - deprotonated_f
# Calculate the concentrations of protons that we need to suck up
# (by adding this concentration of strong base) in order to arrive
# at the target pH
base = deprotonated_f - deprotonated_i
base
$1+\frac{1}{1!}+\frac{1}{2!}+\frac{1}{3!}+\frac{1}{4!}\ldots$
x=1
y=1
z=1
y*=z
x+=1/y
z+=1
x,y,z
y*=z
x+=1/y
z+=1
x,y,z
y*=z
x+=1/y
z+=1
x,y,z
y*=z
x+=1/y
z+=1
x,y,z
y*=z
x+=1/y
z+=1
x,y,z
y*=z
x+=1/y
z+=1
x,y,z
y*=z
x+=1/y
z+=1
x,y,z
y*=z
x+=1/y
z+=1
x,y,z
y*=z
x+=1/y
z+=1
x,y,z
Here we use the math module to check that the series approximates $e$, the base of the natural logarithm.
from math import exp
exp(1)
exp(1)-x