Page 15
Problem 1.5 Graph the ratio of the frequencies of A1A2 heterozygotes to A2A2 homozygotes as a function of q using both the exact and the approximate formulae.
Note:
Exact formula by using Python:
import numpy as np
from matplotlib import pyplot as plt
fig = plt.figure(figsize=(12, 6))
q = np.arange(0.01, 1, 0.01)
plt.plot(q, 2*(1-q)/q, color='red')
plt.xlabel('q')
plt.ylabel('2*(1-q)/q')
plt.show()
Output:

Approximate formula by using Python:
import numpy as np
from matplotlib import pyplot as plt
fig = plt.figure(figsize=(12, 6))
q = np.arange(0.01, 1, 0.01)
plt.plot(q, 2/q, color='red')
plt.xlabel('q')
plt.ylabel('2/q')
plt.show()
Output:
