This is a note for the book Population Genetics: A Concise Guide (Second Edition).
Page 27
Problem 2.4 Graph Ht and Gt for 100 generations with H0 = 1 and population sizes of 1, 10, 100, and 1,000,000.
Note:
According to the formula:
import numpy as np
from matplotlib import pyplot as plt
def h(t,y):
return (1-1/(2*y))**t
fig = plt.figure(figsize=(24, 12))
t = np.arange(1, 100, 1)
plt.plot(t, h(t,1) , color='red')
plt.plot(t, h(t,10) , color='blue')
plt.plot(t, h(t,100) , color='green')
plt.plot(t, h(t,1000000) , color='purple')
plt.xlabel('Generation')
plt.ylabel('Ht')
x_ticks = np.arange(1, 100, 1)
y_ticks = np.arange(0, 1, 0.1)
plt.xticks(x_ticks)
plt.yticks(y_ticks)
plt.show()
Output:

This indicates that genetic drift has a greater impact on small populations rather than large populations, small populations tend to lose genetic diversity more quickly than large populations.
Graph Gt where
import numpy as np
from matplotlib import pyplot as plt
def g(t,y):
return 1-(1-1/(2*y))**t
fig = plt.figure(figsize=(24, 12))
t = np.arange(1, 100, 1)
plt.plot(t, g(t,1) , color='red')
plt.plot(t, g(t,10) , color='blue')
plt.plot(t, g(t,100) , color='green')
plt.plot(t, g(t,1000000) , color='purple')
plt.xlabel('Generation')
plt.ylabel('Gt')
x_ticks = np.arange(1, 100, 1)
y_ticks = np.arange(0, 1, 0.1)
plt.xticks(x_ticks)
plt.yticks(y_ticks)
plt.show()
Output:
