There are three classes of corn, of which three bundles of the first class, two of the second, and one of the third make 39 measures. Two of the first, three of the second, and one of the third make 34 measures. And of the first, two of the second, and three of the third make 26 measures. How many measures of grain does one bundle of each class has?
Note: this problem is from an ancient Chinese book The Nine Chapters on the Mathematical Art, which was composed from the 10th-2nd century BCE.It provides solutions to 346 problems. But it doesn't include detail to convince the reader the solution is correct. There are several ancient people in China commenting on this book to provide more detail. Liu Hui, born aroud 250 CE, wrote the popular one and his book appeard before 295 CE. In his book, he applied the elimination method to solve system of equations problem, which we restated above.
The ancient Chinese people naturally developed their own concepts and methods to solve the practical problems they met, one of which we restated above. You can refer to The Nine Chapters on the Mathematical Art for more examples. And they have developed their own number system to facility the calculation. Since around at least 200 BC, the number system more or less like the following one has been used in ancient China.
The number on the top is 1971 and the number on the bottom is 1972. The most significant number is the first symbol from the left, the same as the Arabic number. There are two types of symbols used to represent digits. Please see the following. I will explain it shortly.
Symbols in the first line are Arabic numbers you are familiar with. The corresponding symbols in the second line are called vertical rods. And the corresponding symbols in the third line are called horizontal rods. To represent the number 1971 (you can refer to the top part of our first picture), the first digit from the right is chosen from the vertical rods, and the second digits from the right is chosen from the horizontal rods. The vertical rods and the horizontal rods appear alternatively.
We can have the following system of equations, where x, y and z are the measures of the first, second and third classes of corn. $$ \begin{cases} 3x + 2y + z = 39\\ 2x + 3y + z = 34\\ x + 2y + 3z = 26 \end{cases} $$
Following the guides in Nine Chapters on Mathematical Art, we can organize it as following matrix, each column reprensents one equation and the rightmost column of which reprensents the first equation above. $$ \begin{bmatrix} 1 & 2 & 3\\ 2 & 3 & 2\\ 3 & 1 & 1\\ 26 & 34 & 39 \end{bmatrix} $$
We follow the guids in Nine Chapters on Mathematical Art to solve this system.
The above algorithm until now is similar to the forward phase in the Gaussian-Jordan elimation.
The solution is: $$ \begin{cases} x = 9\frac{1}{4} \\ y = 4\frac{1}{4} \\ z = 2\frac{1}{4} \end{cases} $$
import matplotlib.pyplot as plt
import numpy as np
fig, ax = plt.subplots()
ax.tick_params(top=False, labeltop=False, bottom=False, labelbottom=False, labelleft=False,left=False)
plt.xlim((0,10))
plt.ylim((0, 3))
for i in range(1, 10):
ax.text(i-0.1, 2.5,f"{i}", fontsize="x-large", fontweight=600)
plot_vertical(ax, i, 0.1)
plot_horizontal(ax, i, 0.05)
ax.spines["left"].set_visible(False)
ax.spines["right"].set_visible(False)
ax.spines["top"].set_visible(False)
ax.spines["bottom"].set_visible(False)
plt.savefig("number_characters.jpg", dpi=300)
plt.show()
def plot_vertical(axes, n, step):
if n <= 5:
for i in range(1, n+1):
x = n + step * (i - 1) - step * (n - 1)
axes.plot([x, x],[1.9, 2.1], color="k")
else:
axes.plot([n-0.25, n + 0.25],[2.1, 2.1], color="k")
for i in range(6, n+1):
x = n + step * (i-5 - 1) - step * (n - 5 -1)/2.0
axes.plot([x, x],[1.9, 2.1], color="k")
def plot_horizontal(axes, n, step):
if n <= 5:
for i in range(1, n+1):
y = 1 + step * (i - 1) - step * (n - 1)
axes.plot([n-0.25, n+0.25],[y, y], color="k")
else:
axes.plot([n, n],[0.9, 1.1], color="k")
for i in range(6, n+1):
y =0.9 - step * (i-5 - 1)
axes.plot([n-0.25, n+0.25],[y, y], color="k")