This section gives a worked example of the rod calculus square root algorithm.
In my opinion this is by far the most sophisticated piece of mathematics in the entirety of Sun Tzŭ's Computational Classic, which is why I have provided a fully annotated and diagrammed walkthrough, along with a pseudocode summary in the Extended commentary.
Chinese source text: Version A, Version B, Version C, Version D.
Unless noted otherwise, I follow the text from Version D, 《知不足齋叢書》本.
Source text | Target text | Notes |
---|---|---|
今有積二十三萬四千五百六十七步。問為方幾何。 | Suppose there be area twenty-three myriad four thousand five hundred [and] sixty-seven paces. [We] ask, how much be [this a] square [of edge]? | |
答曰、四百八十四步九百六十八分步之三百一十一。 | Answer saith: four hundred [and] eighty-four paces [and] three hundred [and] eleven nine hundred [and] sixty-eighths of [a] pace. |
|
術曰、置積二十三萬四千五百六十七步為實。 | Method saith: put [down the] area twenty-three myriad four thousand five hundred [and] sixty-seven paces as [the] dividend. |
|
次借一算為下法。步之、超一位、至百而止。 | Next borrow one rod [to] be [the] lower divisor. Step it [forth], leaping over one place, halting [when] arriving at [the] hundreds. |
|
上商置四百於實之上。 | [For the] upper quotient, put four hundred above [the] dividend. |
|
副置四萬於實之下、下法之上、名為方法。 | Subsidiarily put four myriad below [the] dividend, [and] above [the] lower divisor, [its] name being [the] upright divisor. |
|
命上商四百除實。 | Name [the] upper quotient's four hundred [and] remove [this] from [the] dividend. |
|
除訖、倍方法。 | [The] removal finished, double [the] upright divisor. |
|
方法一退、下法再退。 | [The] upright divisor retreateth once; [the] lower divisor retreateth twice. | |
復置上商八十、以次前商。 | Put again [for the] upper quotient eighty, to [be] next [after the] former quotient. |
|
副置八百於方法之下、下法之上、名為廉法。 | Subsidiarily put eight hundred below [the] upright divisor, [and] above [the] lower divisor, [its] name being [the] incorrupt divisor. |
|
方廉各命上商八十、以除實。 | Each of [the] upright [and the] incorrupt nameth [the] upper quotient's eighty, to remove from [the] dividend. | |
除訖、倍廉法、上從方法。 | [The] removal finished, double [the] incorrupt divisor, [which] followeth [the] upright divisor above. | |
方法一退、下法再退。 | [The] upright divisor retreateth once; [the] lower divisor retreateth twice. |
|
復置上商四、以次前。 | Put again [for the] upper quotient four, to [be] next [after the] former. |
|
副置四於方法之下、下法之上、名曰隅法。 | Subsidiarily put four below [the] upright divisor, [and] above [the] lower divisor, [its] name [being] called [the] moral divisor. |
|
方廉隅各命上商四、以除實。 | Each of [the] upright, [the] incorrupt, [and the] moral nameth [the] upper quotient's four, to remove from [the] dividend. |
|
除訖、倍隅法、從方法。 | [The] removal finished, double [the] moral divisor, [which] followeth [the] upright divisor. |
|
上商得四百八十四、下法得九百六十八、不盡三百一十一。 | [The] upper quotient resulteth in four hundred [and] eighty-four, [and the] lower divisors result in nine hundred [and] sixty-eight, remainder three hundred [and] eleven. |
|
是為方四百八十四步九百六十八分步之三百一十一。 | This be [a] square [of edge] four hundred [and] eighty-four paces [and] three hundred [and] eleven nine hundred [and] sixty-eighths of [a] pace. |
|
In modern notation, Sun Tzŭ's algorithm for computing the square root of the positive integer x proceeds thus:
Stare at the following identity for a long time:
Conway (2023). "Sun Tzŭ's Computational Classic: Volume II §19". <https://yawnoc.github.io/sun-tzu/ii/19> Accessed yyyy-mm-dd.