# Square root on mechanical calculator

The first video shows evaluation of the square root of 1952 to five digits (three decimal places) using Monroe multiplication tables. The computations is done on Monroe calculator Model K from 1920. The video starts with introduction the parts of the calculator, application of Monroe tables follows and the whole computation is also shown. The final part of the video explains mathematical background - linear approximation.

The three other videos describe the evaluation of $\sqrt{1896}$ (the year when Christel Hamann established his company). Videos are in Czech with English subtitles.

The computations will be demonstrated on the calculator Hamann Manus,
model R. This calclator is not pinwheel calculator, but it enjoys the
switching latch-wheel
technology.
As a big advantage, this calculator **allows automatic division**! See
some comments
concerning this calculator.

You may try these methods on vintage computers. You may use also online and gratis Curta simulator or Schubert simulator

## Töpler's method

This method is also referred as Toepler's method. Following this method, the square root can be evaluated by subtracting odd numbers and counting, how many numbers have been subtracted. It is based on the fact that the sum of the first $k$ odd numbers is $k^2$ (as follows from the formula for the sum of arithmetic sequence).

- Elementary description of Töpler's method
- Advanced description, contains also the link to the first paper published on the method

**Advantages**
: no initial guess necessary, all numbers obtained are correct

**Disadvantages**
: slow convergence (but you get the first digits first, i.e. you obtain the first one or two digits relatively fast), needs a lot of work in input register (skip even numbers, change inputs in two columns), the input register is total mess (almost -- actually it is a double of the counter register, i.e. double of the square root)

## Improved Töpler's method

Töpler's method can be simplified by subtrating five-multiples of odd numbers from five-multiple of the number from which we extract the square root. You may see the table which shows the computation of $\sqrt{1984}$ using both methods (plain Töpler and 5-multiple Töpler).

**Advantages**
: like Töpler's method, but it is easier to change the numbers being subtracted and the result is in both input and counter register, i.e. both registers contain the final square root

**Disadvantages**
: slow

This method does not need initial guess, can be performed automatically and is implemented in advanced versions of Friden - the fastest mechanical calculator of the world. On older Friden you have to evaluate square root manually as on this video - see also the discussion and the comment by PopeLando.

## Linear approximation

Classical mathematical methods which replaces locally(!) a function by its tangent. The evaluation of square root is replaced by one operation of addition and one multiplication (or division).

*Given function $f(x)=\sqrt{x}$ and the value $x_0$ with known value of $\sqrt{x_0}$ we find the linear approximation of the function in the neighborhood of the point $x_0$.*

- General formula for linear approximation: $f(x)\approx f(x_0)+f'(x_0))(x-x_0)$
- Formula specified for $\sqrt{x}$: $\sqrt{x}\approx \sqrt{x_0}+\frac{1}{2\sqrt{x_0}}(x-x_0)$
- Simpification (into product): $\sqrt{x}\approx (x+x_0)\frac 1{2\sqrt{x_0}}$, coefficients $x_0$ and

$\frac 1{2\sqrt{x_0}}$ are in tables (see Monroe and Curta tables below) - Simpification (into quotient): $\sqrt{x}\approx \frac {x+x_0}{2\sqrt{x_0}}$, coefficients $x_0$ and ${2\sqrt{x_0}}$ are in tables (see Marchant table below)
- Modified method how to derive the above: the geometric mean and algebraic mean of $x$ and $x_0$ are close, if $x$ and $x_0$ are close. Hence $\sqrt{x x_0}\approx \frac{x+x_0}{2}$. From here the above formula follows immediately.
- The error of the linear approximation is expressed by the second derivative. Since $(\sqrt{x})''=-\frac{1}{4x\sqrt{x}}$, this error is bigger if $x$ is close to zero. You may observe that the tables below are much denser for smaller numbers.
- Tables for mechanical calculator: (all are designed to give five digits of the result correct)
- Monroe table,
- Marchant table, see also Marchant cube root table which is mentioned in the book of Richard Feymannn
- Curta table

**Advantages**
: fast and comfortable

**Disadvantages**
: Needs to look into the table for coefficients and does not allow iteration. Limited precision (to get more significant digits you can use one of the following formulations of Newton-Raphson method).

## Newton-Raphson method

*Given value $a$ we find $\sqrt{a}$ as the positive zero of the function $f(x)=x^2-a$.*

- General formula: $x_{n+1}=x_n-\frac{f(x_n)}{f'(x_n)}$
- Formula for $f(x)=x^2-a$: $x_{n+1}=x_n-\frac{x_n^2-a}{2x_n}$
- Simplification (Heron formula, babylonian method): $x_{n+1}=\frac{x_n+\frac{a}{x_n}}{2}$

Application for mechanical calculator: Heron formula (division required), Herrmann's method, also see below

**Advantages**
: fast convergence (quadratic), allows iterations

**Disadvantages**
: Needs initial guess. Different implementations depending on the properties of each mechanical calculator (presence of carry mechanism in counter, ability to do automatic division, ...)

## Possible implementations of Newton-Raphson on mechanical calculator

We have to evaluate $\sqrt{a}$. The initial guess is $\sqrt{a}\approx x_0$.

*Hamann-Manus*or any other with automatic division: use $x_{n+1}=\frac{x_n+\frac{a}{x_n}}{2}$ (in this setting also called Herron's method, Babylonian method, also called Sabielny's method in Curta manual)- Divide $a$ by $x_0$.
- You have $x_0$ in the input register and $\frac {a}{x_0}$ in the counter register. Mentaly find averages of both numbers, use this value as new $x_0$ and return to the previous step.

*Calculator with ten transfer in counter register*: use $x_{n+1}=x_n+\frac{a-x_n^2}{2x_n}$ (in this setting also called Herrmann's method -- see for example manual to Curta calculator)- Put input to $x_0$, turning crank put the count register also to $x_0$, the output shows $x_0^2$.
- Set input to $2x_0$ (mentally double $x_0$)
- Turning crank and moving carriage get a number close to $a$ in the output register.
- The previous operation increases the output register by additive factor $a-x_0^2$. Since this is implemented by adding $2x_0 $, the count register is by this operation increased by the additive factor $ \frac{a-x_0^2}{2x_0}$. In other words, the improved estimate $ x_0+\frac{a-x_0^2}{2x_0} $ appears in the counter register. You may use this estimate as new $x_0$ and return to the first step.

*Calculator without ten transfer in counter register*: Use any formula, but you cannot do everything in one calculation. You need to write intermediate results on paper and reuse them when necessary.

## Literature

- Mechanical Calculator web site by Wim Hasselo
- Arthur's blog by Arthur Vause
- Computarium lcd by Francis Massen
- Rechenmaschinen by Prof. Dr.-Ing. Christian-M. Hamann
- The national museum of american history
- www.curtamania.com by Alfredo Logioia