THE CALCULATING MACHINES STORED IN THE PALACE MUSEUM IN
               BEIJING, THEIR STRUCTURE AND ALGORITHMS
 

Bai Shangshu
Dept. of Mathematics, Beijing Normal University, Beijing, 100875,
P.R. China

Li Di
Institute  for  the  History  of  Science,  Inner  Mongolia  Normal   University,   Huhhot,
010022, P.R. China
 

In  1978,  Bai  Shangshu  and  Li  Di  fortunately  visited  Beijing  Palace  Museum  and
located  ten  calculating  devices  collected  in  the  storeroom  of  the  Palace  Museum.
After  preliminary  textual  research,  the  calculating   devices   are   deemed   to   be
designed  and  made  during  the  reign  of  Kangxi  by  the  Manufacture  Bureau  of   the
Qing  government.  At  that  time  there  were  many   officials   as   well   as   foreign
missionaries in that bureau. Thus  the  formation  of  those  calculating  devices  may  be
somehow influenced by foreign calculating devices.

In Beijing's first archives of Chinese  history,  there  are  files  of  "Memorial  to  the
throne ratified by  Kangxi  in  red  ink",  "Present  Tribute  to  the  Sovereign",  "Items
offered as tributes"  which  have  been  checked  and  it  was  found  that  there  was  no
concrete  record  concerning  the  calculating  devices.  In  the  Brussels  exhibition  in
Belgium, among the ten pieces of historic relics  were  two  calculating  devices.  It  was
said according to the exhibit directions that  the  disk  calculator  was  made  in  1659
by a Frenchman, Christian Huygens  (1629-1 695)  and  it  is  in  the  shape  of  Biaise
Pascal  (1623-1662).  But  Huygens  was   a   famous   Dutch   mathematician,   not   a
Frenchman.  Though  the  disk  calculator  is  similar  to   the   Pascal   calculator   in
appearance, their structures  are  quite  different  from  each  other.  So  the  statement
is open to question.

After research was  made,  we  found  that  those  calculators  could  be  classified  into
three types: six disk calculators (Fig. 1 ), three bone rod-type calculators (Fig.  2)  and
a paper strip rod-type calculator. Several short articles  were  published  in  the  Journal
of Palace Museum 1980,           A  Collection  of  Papers  on  the  History   of   Chinese
Mathematics (/) 1985,  Annals  of  the  History  of  Computing.  The  results  were  also
used by other articles. Nevertheless, no article has  ever  explained  their  principle  of
structure and rules in calculation. Having  inquired  into  the  subject,  we  now  publish
this article to ask for advice from specialists at home  and  abroad  and  our  colleagues.

I.       Relations   between   the    gear    structure    of    disk    gear    calculating
machines and carrying or borrowing a number.

On the surface of the disk calculator there are ten or twelve  input  disks,  which  are
divided into upper disk and the disk beneath. The upper disk is smaller  and  fixed.  On
the centre of the input disk the digits from 1  to  9  are  engraved  counter-clockwise.
There is a blank between 1 and 9 (Fig. 3).  Carved in the centre of the disk are the
names of digits, such as "hao" (0.0001 7637 ounce), "Ii" (0.001 7637 ounce), "fen"
(0.01 7637 ounce), "qian" (0.1  7637  ounce),  "liang"  (1.7637  ounces),  "shi"  (ten),
"bai" (hundred), "qian" (thousand), "wan" (ten thousand), "shiwan" (hundred
thousand), etc. In the blank space there is a small sliding copper cover  which  can  be
moved  upward  and  downward.  When  the  cover  is  moved,  a  number   on   the   disk
underneath can be seen. Three circles are formed by  three  concentric  circles  at  the
disk underneath. The outside circle is revealed outside the upper disk.  There  are  ten
small holes around the outer circle. Pins are inserted  into  the  holes  and  the  disk
underneath can be rotated clockwise. On the  middle  circle  and  inner  circle  of  the
disk underneath the digits of  opposite  sequence  from  0  to  9  are  engraved,  which
are covered by the upper disk and only one digit could be  read  from  the  blank  space
(Fig. 4).

Attached below each of the input disks is a gear wheel with 1 0  teeth.  When  the  disk
underneath is rotated, the input wheel is rotated as  well.  When  the  reading  on  the
blank space of the upper disk exceeds 9, if  the  disk  underneath  is  further  rotated
the ten-teeth gear wheel will drive the ten-teeth gear wheel  on  its  left  to  advance
one place to make the reading on the left add 1 or minus 1. That is  to  say,  read  the
digit on the middle circle of the disk underneath to play the function of  carry,  which
is adaptable to addition and multiplication; read the digit of the inner circle  of  the
disk  underneath  to  play  the  function  of  falling  out  one  place   adaptable   to
subtraction and division (Fig. 5).

Inside the calculator  there  is  an  intermediate  gear  wheel  between  two  ten-teeth
gears, the intermediate gear wheel  also  has  ten  ratchets  to  engage  the  ten-teeth
gear wheel to its right and depart  from  the  ten-teeth  gear  wheel  to  its  left.  A
projecting falcon is mounted on the  surface  of  the  intermediate  gear  wheel.  While
using the pin to rotate the ten-teeth gear wheel clockwise, the intermediate  disk  will
rotate  counter-clockwise.   When   the   ten-teeth   gear   wheel   rotated   clockwise
surpassing ten lattices, that is a circle, the falcon will drive the ten-teeth wheel  to
its left rotate clockwise one lattice. Thus the reading on the left input disk can  play
the function of carry or receding one place.

II. Four arithmetic operations on the disk gear calculating machines.

A  disk  calculator  can  only  carry  out  the   arithmetic   operations   of   addition,
subtraction, multiplication and division. The method  of  calculation  is  just  like  the
method used today to calculate from high digit to low digit, for example:
 

1 .   Addition
     Ex. 1. Sum up 872503 plus 1 35920

To calculate the sum of 872503 plus 1  35920,  first  set  the  augment  on  their  places
according to their digital positions:  set  8  on  "hundred  thousand",  set  7  on  "ten
thousand", set 2 on "thousand", set 5 on "hundred", set  0  on  "ten",  set  3  on  "unit"
and set the addend on the fan-shaped holes at the lower part of the calculator.

This is an additive operation. Therefore, push upward  the  sliding  cover  at  the  empty
lattice of the input disk to the lower part so as to read the digits at the middle  circle
of the disk underneath above the sliding cover.

Insert the pin into hole 1 on "hundred  thousand",  rotate  the  disk  clockwise  to  make
the pin set at the empty lattice of  the  input  disk,  then  the  reading  on  the  empty
lattice will turn to 9. Then insert the pin into hole 3  on  the  "ten  thousand",  rotate
the disk underneath clockwise and set the pin to  the  empty  lattice,  then  the  reading
on the empty lattice  will  turn  to  0.  Since  7+3=10  and  1  is  carried  to  "hundred
thousand", there is 9 at "hundred thousand". Since 9+1 =l 0, then  the  1  is  carried  to
"million" and the reading at "million"  is  1,  and  0  at  "hundred  thousand"  and  "ten
thousand". At "thousand" of the input disk,  insert  the  pin  into  hole  5,  rotate  the
disk underneath clockwise and set the pin at the empty lattice,  the  reading  there  will
turn to 7, then insert the pin into hole  9  at  "hundred",  rotate  the  disk  underneath
clockwise and set the pin at the empty lattice, the reading there will turn  to  4.  Since
5+9=14, the reading  at  "hundred"  will  be  4  and  1  is  carried  to  "thousand",  the
reading at "thousand" will turn to 8. Insert the pin at hole 2 on the "ten" of  the  disk,
rotate the disk underneath clockwise and set the  pin  to  the  empty  lattice,  here  the
reading will turn to 2; the addend at the unit position is 0,  so  there  is  no  need  to
rotate the disk at "unit". The reading at "unit" is  still  3.  The  sum  of  the  augment
and addend is 872503+135920 =1008423.
 

2.   Subtraction
     Ex. 2. Calculate the difference of 705268 minus 24371 9

Set  the  minuend  705268  at  the  input  disk  of  the  calculator  according  to  their
positions, then set the subtrahend at the fan-shaped  holes  at  the  lower  part  of  the
calculator. In order to carry out subtraction, put the  cover  at  the  empty  lattice  of
the input disk so that the readings at the  inner  circle  of  the  disk  beneath  can  be
seen.

The subtraction can begin either from lower digit or from  higher  digit.  Here  we  take
the calculation from higher digit as an example:

Insert the pin into hole 2 at "hundred thousand" of  the  input  disk,  rotate  the  disk
beneath clockwise. Set the pin to the empty lattice of the input  disk,  then  the  digit
there will turn from 7 to 5, then insert the pin into hole 4 at  "ten  thousand"  of  the
input disk, rotate the disk underneath clockwise, set the pin to  the  empty  lattice  of
the input disk and 0 turns to 6. Since the digit at "hundred  thousand"  was  5  and  the
digit at "ten thousand"  was  0,  so  50-4=46.  Thus  the  digit  at  "hundred  thousand"
turns to 4 and the digit at "ten thousand" turns to 6. Then insert the pin  into  hole  3
at "thousand" of the input disk,  rotate  the  disk  underneath  clockwise  and  set  the
pin to the empty lattice of the input disk, the digit turns from 5  to  2.  It  is  2  at
"thousand" of the input disk and 2 at "hundred"  of  the  input  disk.  Since  22-7=1  5,
the digit turns to 1 at "thousand" of the input disk and 5  at  "hundred"  of  the  input
disk. Then insert the pin into 1 of the empty lattice at "ten" of the input disk,  rotate
the disk underneath clockwise and set the pin at empty lattice of  the  input  disk.  The
digit at the empty lattice turns from 6 to  5.  Insert  the  pin  into  9  of  the  empty
lattice at "unit" of the input disk, rotate the disk underneath  clockwise  and  set  the
pin to the empty lattice on the input disk, where the digit turns from 8  to  9.  It  was
5 at "ten" and 8 at "unit" of the input disk. Since 58-9=49, so  the  digit  turns  to  4
at "ten" of the input disk and 9 at "unit" of the input disk.

Hence, the difference of 705268 and 24371 9 on the input disk is 461 549.

            705268-24371 9=461549

Operation steps could be seen from the above example of subtraction.
 

3.   Multiplication
     Ex. 3. Calculate the product of 534 and 961 37

In order to carry out  multiplication,  push  upward  the  sliding  cover  at  the  empty
lattice of the input disks so that the engraved digit at the lower disk  could  be  seen.
First set the multiplicand 961 37 on the fan-shaped  holes  at  the  upper  part  of  the
calculator, then set the multiplier 534 on the fan-shaped  on  the  fan-shaped  holes  at
the lower part of the calculator, then carry on the operation of multiplication.

If the multiplier is a n digit number, the  operation  must  be  carried  on  before  the
multiplicand n-1 or n digit; if the multiplier is a 3-digit number,  the  operation  must
be carried on before multiplicand 3-1 = 2 or on 3 digit. If  the  multiplicand  is  a  m-
digit number, the operation must  be  carried  on  at  m+n-1  or  m+n  digit.  Since  the
multiplier is a 5 digit number, a number at "ten thousand",  so  the  operation  must  be
carried on at 5+2 = 7 or 5+3 = 8 digit, that is at "ten million" or "million".

According to the concrete  number  of  this  question,  the  operation  must  be  carried
on at "ten million". Insert the pin into hole 4 on the "ten million" of the  input  disk,
rotate the disk underneath clockwise. Set the pin at  the  empty  lattice  of  the  input
disk, where the reading is 4. Insert the pin into hole 5 at "million" of the input  disk,
rotate the disk underneath clockwise, set the pin at  the  empty  lattice  of  the  input
disk, where the reading is 5, that is 9x5 = 45. Then  insert  the  pin  into  hole  5  at
"million" of the input disk, rotate the disk underneath clockwise, set the  pin  at  the
empty lattice of the input disk,  where  the  reading  is  7,  because  5  at  the  empty
lattice now turned to 7. Then insert the pin into hole  7,  rotate  the  disk  underneath
clockwise, set the pin at the empty lattice of the input disk where  the  reading  is  7.
That is 9><3 = 27. Then insert the pin into hole 3 at "hundred  thousand"  of  the  input
disk, rotate the disk underneath clockwise, set the pin  at  the  empty  lattice  of  the
input disk, where the reading is 0, because there was  7  at  the  empty  lattice.  Since
7+3 = 1 0, so the reading at the empty lattice  is  0.  The  number  at  the  input  disk
was 7, now it turns to 8. Then insert the pin into  hole  6  at  "ten  thousand"  of  the
input disk, rotate the disk underneath clockwise and set the pin  at  the  empty  lattice
of the input disk, where the reading is 6. Up till now the  readings  at  "ten  million",
"million", "hundred thousand", "ten thousand", are 4,  8,  0,  6  respectively.  This  is
the product of the first digit of the multiplicand 9 and multiplier 5 3 4, that is

               9 x 534 = 4806.

The  product  can  also  be  taken  as  90000x534   =   48060000.   Operation   must   be
carried on in the same way, the products of the 2nd, 3rd,  4th,  5th  digit  multiplicand
6, 1, 3, 7 and multiplier  534  are  6x534  =  3204,  1  x534  =  534,  3x534  =  1  602,
7x534  =  3738.  The  products  can  also  be  taken  as  6000x534=  3204000,  1   00x534
=   53400,   30x534   =   16020,   7x534   =   3738.   Adding   the   product,   we   get
48060000+3204000+53400+]  6020+3738  =   51   3371   58.   This   is   the   product   of
multiplicand 961 36 and multiplier 534, that is

          961 37x534 = 51 3371 58.

Steps of the multiplication operation could be seen from the above example.
 

4.   Division
     Ex. 4. Find the quotient of 32771 58 divided by 534

Get the dividend 3, 2, 7, 7, 1, 5, 3, at the digits  of  "million",  "hundred  thousand",
"ten thousand", "thousand", "hundred", "ten       unit" of the input disk. Then  set  the
divisor  5,  3,  4  at  the  fan-shaped  holes  at  the  lower  part  of  the  calculator
respectively. In order to carry on the operation of division,  push  down  the  cover  at
the empty lattice of the input disk, so as to  read  the  engraved  figure  on  the  disk
underneath.

Since the divisor is a 3 digit number, the first three digits of the divided. 327 can  be
used in test division, since 727<534, so 327 is  not  enough  to  be  divided.  Then  the
first four digits, 3277 is used in test division and the  quotient  is  6.  6  multiplies
divisor 534, 6><534 = 3204. Insert the pin into holes 3, 2, 0, 4 at  "million",  "hundred
thousand", "ten thousand"  and  "thousand"  of  the  input  disk,  rotate  clockwise  the
disk underneath and set the pins to the empty lattices, where  the  readings  are  0,  0,
7, 3 respectively. This is dividend 3277 divided by divisor  534  and  get  the  quotient
6, the remainder is 73. It can also be taken as

               3277000+534 =6000.....        73000,
or                    6000x534/73000= 3277000.

Then we take the first three digits 731 from the input  disk  and  test  divide  it  with
divisor 534, the quotient is 1. Multiply 534 with  1x534  =  534.  Insert  the  pin  into
holes 5, 3, 4 on the "ten thousand", "thousand", "hundred"  of  the  input  disk,  rotate
the disk underneath clockwise and set  the  pins  at  the  empty  lattice  of  the  input
disk, where the readings are 1, 9, 7 respectively.  That  is  the  dividend  731  divided
by divisor 534 and get the quotient 1, the remainder is 1 97. It can also be taken as

or
or   731/534 =l..... 197,
     1 x534/ 197 = 73 1,
     6 1 00*534/ 19700 = 32771 00.

Then take the first four digits 1975 from the  input  disk  and  test  divide  it  with
divisor 534, the quotient is 3. Multiply 534 with 3, 3x534  =  1  602.  Insert  the  pins
into holes 1, 6, 0,  2  at  "ten  thousand",  "thousand",  "hundred"  and  "ten"  of  the
input disk, rotate  the  disk  underneath  clockwise  and  set  the  pins  at  the  empty
lattices, where the readings are 3, 7, 3 respectively. That is  dividend  1  975  divided
by divisor 534 and get the quotient 3, the remainder is 373. It can also be taken as

or
or   1975/534 =3..... 373,
     3x534+373 =1975,
     6130x534/3730= 3277150.

Then take the first four digits 3738 at the input disk and test divide  it  with  divisor
534, the quotient is 7. Multiply 534 with 7, 7x534 = 3738.  Insert  pins  into  holes  3,
7, 3, 8 at "thousand", "hundred", "ten", "unit"  of  the  input  disk,  rotate  the  disk
underneath clockwise and set the pins at the empty lattices  of  the  input  disk,  where
the readings are 0, 0, 0, 0 respectively. That is the dividend 3738  divided  by  divisor
534 and get quotient 7, 3738-- 534 = 7. It can also be taken as

             6137x534= 3277158.

Actually it is 3277158/534 = 6137.  Steps  could  be  seen  from  the  above  division
operation.

III. The rod-type calculating machines, their structure and use.

The rod-type instruments collected  in  the  Palace  Museum  can  be  classified  into  two
kinds. One is  a  bone  rod-type  instrument,  the  other  one  is  a  paper-slip  rod-type
instrument. But as to their structures, they  are  of  one  type.  They  are  designed  and
made  according  to  the  Napier  bones.  So  the  principle  of  the  structure  is  quite
simple. It  is  showing  the  Napier  bones  on  the  surface  of  the  instrument  through
certain method to operate with Napier bones.

For the convenience of horizontal written calculation,  the  form  of  Napier  bones  is  a
vertical/oblique lattice. After Napier bones  were  introduced  into  China,  in  order  to
cope with the  custom  of  -vertical  written  calculation,  the  vertical/oblique  lattice
changed to horizontal/semicircular lattice or vertical lattice. So  after  reformation  the
Napier bones were called Chinese-type Napier bones.

Enlightened  by  the  Arabian  lattice  calculation,  the  British   mathematician   Napier
invented  Napier  bones,  which  were  used  in  calculation.  This  operation   not   only
speeded up the calculation but also saved the  trouble  of  drawing  lattices,  so  it  was
very popular  in  Europe.  Since  the  Arabian  lattice  operation  can  only  be  used  in
multiplication and division, so also the Napier bones. At  that  time,  Napier  bones  only
had rod 1, rod 2, rod 3, rod 4, rod 5, rod 6, rod 7, rod 8 and rod  9.  Only  after  Napier
bones  had  been  introduced  to  China,  there  was  rod  0,  rod  square  and  rod  cube.
Though the rod-type instruments collected  in  the  Palace  Museum  are  rods  of  vertical
oblique lattice or semicircular lattice, it can carry out multiplication, division as  well
as multiplication and division related to zero, square or cube.

From  the  statement  above  we  can  see  that  the  Chinese  disk  calculation  and  rod-
type  instruments  are  later  than  Pascal's  calculator  and  Napier   bones,   but   the
function of their operations surpassed the creations made by Pascal and Napier.