Contents
--------

This set of programs and OpenSCAD files constructs a set of multiplying
rods and a cradle and lid to hold these rods.  The rods, cradle, and
lid can be used to compute products of a multiple-digit number by any
single-digit number, and to help to compute products of two
multiple-digit numbers.  The rods use Slonimsky's theorem.

The programs are:

render           Outputs an OpenSCAD file font.scad which draws a primitive 
                 font.  Written in C++.  Uses the file fontdesc.txt, which 
                 describes the font, as input.

table            Outputs an OpenSCAD file table.scad which contains tabular 
                 data used to construct the rods, cradle and lid.  Written in C.

The OpenSCAD files are:

main.scad        Contains modules which, together with font.scad and table.scad,
                 generate the rods, cradle, and lid.

assembly3.scad   Shows an example assembly of three rods, a cradle, and a lid.  
                 Uses font.scad, table.scad, and main.scad.

assembly4.scad   Shows an example assembly of four rods, a cradle, and a lid.  
                 Uses font.scad, table.scad, and main.scad.

cradle.scad      These files generate the individual parts of the machine.
lid.scad         They use font.scad, table.scad, and main.scad.
rod.scad


Building
--------

Use the supplied Makefile, which by default compiles the programs render 
and table, and uses them to build font.scad and table.scad.  Once these 
files have been built, the OpenSCAD file assembly3.scad will illustrate 
the example given in the next section of the use of the rods, cradle, 
and lid.

The files cradle.scad, lid.scad, and rod.scad can be used to 
generate the individual parts of the machine.  You may also use
"make stl" to generate STL files for the assemblies, lid, cradle,
and rods 0, 1, ..., 9.


How to use the rods
--- -- --- --- ----

I will describe this by a base 10 example.  To multiply the number 36
by 7, you may use:

* One rod for each of the digits 0, 3, and 6.  The digit 
  corresponding to a rod is indicated by a large character on
  the top of the rod.
* A cradle which can hold at least three rods.
* The lid to this cradle.

Remove the lid of the cradle and place a 6 rod into the slot at the
right-hand end of the cradle, the 3 rod into the slot to the left of
the 6 rod, and the 0 rod into the slot to the left of the 3 rod.

Place the lid on the cradle.  The sides of the three rods placed into the
cradle should be visible through slots in the lid.  Through each slot,
a column of symbols should be visible, with the following characters,
from top to bottom:

* The multiplicand digit (e.g., 6 for the rightmost rod.)
* A carry symbol, which may be blank.
* An output list of ten digits.
* Another carry symbol, which may be blank.

Rotate the rightmost rod so that its top carry symbol is blank.  Then
locate its bottom carry symbol, which in this case is Q.  Rotate the next
rod to the left so that its top carry symbol is also Q.  Moving repeatedly
to the left, repeat this operation by continuing to rotate each rod
so that its top carry symbol is the same as the bottom carry symbol on
the rod to its right.  After this is done, the product of 36 by 7 can
be read out, from left to right, by looking at the eighth digit in the
output list in each slot.  The products of 36 by each of 0, 1, 2, 3,
4, 5, 6, 8, and 9 can also be read out in a similar way.

To multiply two multiple-digit numbers, e.g., 36 by 237, you
may set up the rods as above and read out the products of 36 by 2,
3, and 7.  Then, shift the product by 2 left two places and
shift the product by 3 left one place, and add all three products
together.


Principle of operation
--------- -- ---------

I assume again that the base is 10.  Let a multiple-digit number m be
multiplied by each of 0, 1, ..., 9, and look at the carries into a given
digit position, say the 10^e-th position.  Let c[i] be the carry into
this position when m is multiplied by i and write down the sequence

                       S = (c[0], ..., c[9]).

Slonimsky's theorem states that there are only 28 possible values S can
take on.  To see why this is true, divide m by 10^e.  The portion of
m represented by the digits to the right of the 10^e-th position then
becomes a fraction, f, which is between 0 and 1 (inclusive of 0 and
exclusive of 1), and

          S = (floor(0 f), floor(1 f), floor(2 f), ..., floor(9 f)),

where the floor of a number x, floor(x), is defined to be the largest
integer less than or equal to x.  As we increase f from 0 to 1, the
entries in S will also increase.  For the (d+1)st entry in S to increase
from n-1 to n, floor(d f) needs to increase from n-1 to n.  Since this
happens when

                        d f = n, i.e., f = n / d,

S will increase when and only when f equals a fraction with denominator
9 or lower.  Since f < 1 and, to be a number where S increases, f must
be positive, the denominator d of f must be between 2 and 9, inclusive,
and the numerator n of f must be at least 1 and less than the denominator
of f.  There are

          (2-1) + (3-1) + ... + (9-1) = 1 + 2 + ... + 8 = 8*9 / 2 = 36

such (n,d) pairs, but some generate equal fractions (for example, 1/2
= 2/4 = 3/6 = 4/8.)  After removing duplicate fractions, we have 27
fractions n/d:

       1/9, 1/8, 1/7, 1/6, 1/5, 2/9, 1/4, 2/7, 1/3, 3/8, 2/5, 3/7, 4/9, 
       1/2, 5/9, 4/7, 3/5, 5/8, 2/3, 5/7, 3/4, 7/9, 4/5, 5/6, 6/7, 7/8, 
       and 8/9.

Since these are the breakpoints between successive values of S, we have
28 possible values of S:

              (0,0,0,0,0,0,0,0,0,0)      for 0   <= f < 1/9,
              (0,0,0,0,0,0,0,0,0,1)      for 1/9 <= f < 1/8,
              (0,0,0,0,0,0,0,0,1,1)      for 1/8 <= f < 1/7,
              (0,0,0,0,0,0,0,1,1,1)      for 1/7 <= f < 1/6,
              (0,0,0,0,0,0,1,1,1,1)      for 1/6 <= f < 1/5,
              (0,0,0,0,0,1,1,1,1,1)      for 1/5 <= f < 2/9,
              (0,0,0,0,0,1,1,1,1,2)      for 2/9 <= f < 1/4,
              (0,0,0,0,1,1,1,1,2,2)      for 1/4 <= f < 2/7,
              (0,0,0,0,1,1,1,2,2,2)      for 2/7 <= f < 1/3,
              (0,0,0,1,1,1,2,2,2,3)      for 1/3 <= f < 3/8,
              (0,0,0,1,1,1,2,2,3,3)      for 3/8 <= f < 2/5,
              (0,0,0,1,1,2,2,2,3,3)      for 2/5 <= f < 3/7,
              (0,0,0,1,1,2,2,3,3,3)      for 3/7 <= f < 4/9,
              (0,0,0,1,1,2,2,3,3,4)      for 4/9 <= f < 1/2,
              (0,0,1,1,2,2,3,3,4,4)      for 1/2 <= f < 5/9,
              (0,0,1,1,2,2,3,3,4,5)      for 5/9 <= f < 4/7,
              (0,0,1,1,2,2,3,4,4,5)      for 4/7 <= f < 3/5,
              (0,0,1,1,2,3,3,4,4,5)      for 3/5 <= f < 5/8,
              (0,0,1,1,2,3,3,4,5,5)      for 5/8 <= f < 2/3,
              (0,0,1,2,2,3,4,4,5,6)      for 2/3 <= f < 5/7,
              (0,0,1,2,2,3,4,5,5,6)      for 5/7 <= f < 3/4,
              (0,0,1,2,3,3,4,5,6,6)      for 3/4 <= f < 7/9,
              (0,0,1,2,3,3,4,5,6,7)      for 7/9 <= f < 4/5,
              (0,0,1,2,3,4,4,5,6,7)      for 4/5 <= f < 5/6,
              (0,0,1,2,3,4,5,5,6,7)      for 5/6 <= f < 6/7,
              (0,0,1,2,3,4,5,6,6,7)      for 6/7 <= f < 7/8,
              (0,0,1,2,3,4,5,6,7,7)      for 7/8 <= f < 8/9, and
              (0,0,1,2,3,4,5,6,7,8)      for 8/9 <= f <   1.

A rod for the digit j will then have 28 sides, one for each value of S.
A carry symbol corresponding to S is shown at the top of each side,
together with the least significant digit of the result of multiplying j
by 0, 1, ..., 9 and then adding the input carry from S.  The sequence of
10 output carries which results from this must also be a possible value of
S; the carry symbol at the bottom of each side then corresponds to this S.


History
-------

Slonimsky's theorem was discovered by Hayyim Selig Slonimsky (b. 1810,
Bialystok; d. 1904, Warsaw) [1], [4].  A proof of the theorem was
published in 1846 by A. L. Crelle [2].

Slonimsky made a multiplying device based on his theorem.  It consisted
of a frame holding eight cylinders, each of which could be adjusted to
select the correct digit in the multiplicand, as well as the correct
input carry sequence.  As with the rods constructed here, an indicator
of the input carry sequence at each cylinder had to be adjusted to equal
the indicator of the output carry sequence of the cylinder to the right
[1], [4].

In 1847, Henry Knight published a series of multiplying tables which
used Slonimsky's theorem [6].

Around 1860, Herschell Filipowski also made a multiplying device based on 
Slonimsky's theorem.  His device had 56 wooden rods, each with 10 columns, 
together with a wooden tray that could hold up to 8 rods [3], [5].

The inventor Joffe presented a set of 70 multiplying rods based on
Slonimsky's theorem in 1881.  Each rod was square, with 4 sides, for
a total of 280 sides in all. A similar set of rods was constructed by
Peter Roubos in 1990  [1].


References and further reading
---------- --- ------- -------

[1]: "Slonimsky's Multiplying Device, 
      an impressive Example for Applied Mathematics",
     Stephan Weiss.
     <http://locomat.loria.fr/reconstructions/weiss/SloniMultE.pdf>.

[2]: "Démonstration d'un théorème de Mr. Slonimsky sur les nombres, 
      avec une application de ce théorème au calcul de chiffres",
     August Leopold Crelle,
     Journal für die reine und angewandte Mathematik 
     30 (1846), #3, pp. 215-229.
     <http://www.digizeitschriften.de/main/dms/img/?IDDOC=511397>.

[3]: "Successors of Slonimsky's Multiplying Device 1844",
     Stephan Weiss.
     <http://www.mechrech.info/publikat/JoffeFilipowski.pdf>.

[4]: "Hayyim Selig Slonimski".
     <http://history-computer.com/MechanicalCalculators/19thCentury/Slonimski.html>.

[5]: "Herschell Filipowski".
     <http://history-computer.com/CalculatingTools/Gadgets/Filipowski.html>.

[6]: "Multiplication Tablets Derived from a Theorem of S. Slonimski",
     Henry Knight,
     Birmingham: Josiah Allen and Son, 1847.
     <http://www.mechrech.info/publikat/KnightTablets1847.pdf>.


For more information, also see:


  "Allgemeine Bemerkungen über Rechenmaschinen, 
   und Prospectus eines neu erfundenen Rechen-Instruments",
  Ch. Z. Slonimsky,
  Journal für die reine und angewandte Mathematik
  28 (1844), #2, pp. 184-190.

  "Chaim Selig Slonimski and His Adding Devices",
  Valéry Monnier, Walter Szrek, and Janusz Zalewski, 
  IEEE Annals of the History of Computing
  35, #3 (July-September 2013), pp. 42-53,
  DOI: 10.1109/MAHC.2013.13  .

  "Hayyim Selig Slonimski", 
  Eli Maor and Stephen James O'Meara, 
  Sky & Telescope
  88, #3 (September 1994.)

  "Polnische Rechenmaschinenerfinder des 19. Jahrhunderts",
  Max Detlefsen, 
  Wissenschaft und Fortschritt,
  26 (1976), pp. 86-90.
  <http://www.rechenmaschinen-illustrated.com/Detlefsen.pdf>.


Author of this file
------ -- ---- ----

David Moews
22-VI-2014

This file is in the public domain.
