傳統算盤與珠算/開方
外觀
< 傳統算盤與珠算
求平方根和立方根是元素算術中最複雜的操作。東方算盤非常適合透過直接有效的方法求平方根,但不幸的是,對於立方根來說,情況並非如此,雖然可能,但需要一個曲折的路徑,充滿了來回,容易出錯。
卡吉爾·吉爾頓·諾特 (1856 - 1922),現代地震學的奠基人之一,是一位蘇格蘭物理學家和數學家,曾擔任東京帝國大學數學、聲學和電磁學教授九年;之後,他在 1891 年被明治天皇授予旭日勳章。他在日本期間接觸了日本算盤,並對其進行了深入研究,毫無疑問,他將其作為一名教師和研究員在自己的工作中進行了專業運用。這項研究的結果是一篇著名的 55 頁文章[1],於 1885 年發表,長期以來一直是英文中最有見地的關於算盤歷史和基礎的著作,也是必不可少的參考書。本書接下來的兩章發展和擴充套件了諾特對傳統開平方根和立方根方法的看法,這是西方科學家和數學家的看法,提供了理論和實踐方法,並用幾個例子進行說明。
本書的這一部分包含以下章節
用算盤求平方根和立方根可能是一個相當漫長的過程,在學習階段,有一個工具可以讓我們控制是否做對了,這一點很有趣。
對於平方根,你可以嘗試優秀的村田的用奇偶法求平方根的教程,這是一個 JavaScript 應用程式,你可以直接在你的瀏覽器中執行,也可以從它的GitHub 儲存庫下載到你的電腦。你只需要在左側的小輸入框中輸入根,然後反覆按下螢幕上的“下一步”按鈕,就可以看到一步一步的過程發展。
主要是對於立方根,以下BC 程式碼可能會有所幫助,複製並貼上到一個文字檔案中,並將其命名為 knott.bc
/*
Functions to help to learn/verify square and cube roots a la Knott
with the abacus, soroban, suanpan.
See: https://jccabacus.blogspot.com/2021/06/roots-la-knott.html
as a reference.
Jesús Cabrera, June 2021
CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
Use at your oun risk!
*/
define int(x)
{
# Integer part of x
auto os,r
os=scale; scale=0
r=x/1
scale= os
return (r)
}
define cbrt(x)
{
# Cube root of x
return (e(l(x)/3))
}
define knott2(r0, y0, alpha)
{
/*
Square root following Cargill G. Knott steps
See example of use in file sr200703.bc
use: $ sr200703.bc |bc -l knott.bc
*/
auto so, div
so = scale; /* Store old scale value */
scale = 1
a = 10*y0
div = 100*r0 + alpha/2
print "New dividend: ",div/1,"\n"
b = int(div/(a))
tf = div -b*a -b^2/2
if (tf<0){
b=b-1;print "Revising down, b = ",b, "\n"
tf = div -b*a -b^2/2
}
print "New root: ", a+b,", New half-remainder: ", tf/1
print "\n==================\n\n"
scale = so; /* restore old scale value */
return
}
define knott3(r0, y0, alpha)
{
/*
Cube root following Cargill G. Knott steps
See example of use in file cr488931400152.bc
use: $ cat cr488931400152.bc |bc -l knott.bc
*/
auto so, div, ta, tb, tc, td, te
so = scale; /* Store old scale value */
scale = 0
a = 10*y0
div = 1000*r0 + alpha
print "New dividend: ",div,"\n\n"
ta = div/y0; rem1 = div % y0
print "a) /a: ", ta, " rem1: ", rem1, "\n"
tb = (10*ta)/3; rem2 = (10*ta) % 3
print "b) /3: ", tb, " rem2: ", rem2, "\n"
b = tb/(100*a)
print " b = ",b,"\n"
tc = tb - b*(a+b)*100
print "d) : ",tc,"\n"
b = tb/(100*(a+b))
print " b = ",b,"\n"
tc = tb - b*(a+b)*100
print "d) : ",tc,"\n"
if(b==10){
/* Trick to avoid some problems */
b = 9
print "b: ",b,"\n"
tc = tb - b*(a+b)*100
print "d) tc: ",tc,"\n"
}
td = tc*3 +rem2
print "e) *3: ",td,"\n"
te = (td/10)*y0 +rem1
print "f) *a: ",te,"\n"
tf = te - b^3
print "g) -b^3: ",tf,"\n"
print "\nNew root: ",(a+b)," New remainder: ",tf,"\n\n"
print "==================\n\n"
scale = so; /* restore old scale value */
return
}
/*
Example: square root of 200703
Use:
$ cat sr200703.bc |bc -l knott.bc
or
$ bc -l knott.bc < sr200703.bc
*/
print "\nSquare root of ", 200703, " = ", sqrt(200703), "\n\n"
/*
Decompose in pairs of digits (will be alpha): 20, 07, 03
Initialize (first step)
*/
alpha = 20
b = int(sqrt(alpha))
r0 = alpha - b^2
a = 0
tf = r0/2
print "First root: ", b, ", First half-remainder: ", tf, "\n"
print "==================\n\n"
/*
Main:
Repeat for each pair of digits (alpha)...
*/
alpha =07
mute=knott2(tf, a+b, alpha)
alpha =03
mute=knott2(tf, a+b, alpha)
/*
For additional digits continue with alpha = 00
*/
alpha =00
mute=knott2(tf, a+b, alpha)
alpha =00
mute=knott2(tf, a+b, alpha)
alpha =00
mute=knott2(tf, a+b, alpha)
alpha =00
mute=knott2(tf, a+b, alpha)
輸出
Square root of 200703 = 447.99888392718122931160 First root: 4, First half-remainder: 2.00000000000000000000 ================== New dividend: 203.5 Revising down, b = 4 New root: 44, New half-remainder: 35.5 ================== New dividend: 3551.5 Revising down, b = 7 New root: 447, New half-remainder: 447.0 ================== New dividend: 44700.0 Revising down, b = 9 New root: 4479, New half-remainder: 4429.5 ================== New dividend: 442950.0 New root: 44799, New half-remainder: 39799.5 ================== New dividend: 3979950.0 New root: 447998, New half-remainder: 395998.0 ================== New dividend: 39599800.0 New root: 4479988, New half-remainder: 3759928.0 ==================
/*
Example: cube root of 488931400152
Use:
$ cat cr488931400152.bc |bc -l knott.bc
or
$ bc -l knott.bc < cr488931400152.bc
*/
print "\nCube root of ", 488931400152, " = ", cbrt(488931400152), "\n\n"
/*
Decompose in triplets (will be alpha): # 488, 931, 400, 152
Initialize (first step)
*/
alpha = 488
b = int(cbrt(alpha))
r0 = alpha - b^3
a = 0
tf = r0
print "First root: ", b, ", First remainder: ", r0, "\n"
print "==================\n\n"
/*
Main:
Repeat for each triplet (alpha)...
*/
alpha = 931
mute = knott3(tf, a+b, alpha)
alpha = 400
mute = knott3(tf, a+b, alpha)
alpha = 152
mute = knott3(tf, a+b, alpha)
/*
For additional digits continue with alpha = 000
*/
輸出
Cube root of 488931400152 = 7877.99999999999999999871
First root: 7, First remainder: 145
==================
New dividend: 145931
a) /a: 20847 rem1: 2
b) /3: 69490 rem2: 0
b = 9
d) : -1610
b = 8
d) : 7090
e) *3: 21270
f) *a: 14891
g) -b^3: 14379
New root: 78 New remainder: 14379
==================
New dividend: 14379400
a) /a: 184351 rem1: 22
b) /3: 614503 rem2: 1
b = 7
d) : 63603
b = 7
d) : 63603
e) *3: 190810
f) *a: 1488340
g) -b^3: 1487997
New root: 787 New remainder: 1487997
==================
New dividend: 1487997152
a) /a: 1890720 rem1: 512
b) /3: 6302400 rem2: 0
b = 8
d) : 0
b = 8
d) : 0
e) *3: 0
f) *a: 512
g) -b^3: 0
New root: 7878 New remainder: 0
==================
- ↑ Knott, Cargill G. (1886), "算盤,從歷史和科學的角度", 日本亞洲學會會刊, 14: 18–73