User:Kpufferfish/sandbox

Clearing
To clear a soroban, the right index finger and thumb is placed between the five-beads and the one-beads of the leftmost rod. The right hand is then moved from left to right, such that all beads are pushed away from the reckoning bar. This sets all rods to zero.

Addition
The addition of two positive numbers is carried out from left to right. If there are sufficient unused beads on the current rod, the current digit of the addend can be added directly. Otherwise, one may employ one of the following techniques:

Subtraction
The subtraction of a positive subtrahend from a larger minuend is carried out from left to right. If there are sufficient used beads, the digit of the subtrahend can be subtracted directly. Otherwise, one may employ one of the following techniques:

Multiplication
Let the multiplicand and multiplier be a × 10p and b × 10q respectively in scientific notation.

For all m and n, the mth significant digit of the multiplicand is multiplied with the the nth significant digit of the multiplier to give a two-digit product (if this product is less than 10, keep a leading zero). These two digits are added to the (m + n – 1)th and (m + n)th rod from the left.

The product is given by
 * (a × 10p) × (b × 10q) = ab × 10p + q

⌊ab⌋, which is represented by first two rods of the product, is either a two-digit number or a one-digit number with a leading zero. The decimal point is inserted just after the (p + q + 2)th rod to obtain the product.

Division
Several methods have been devised to divide one positive number by another. The traditional Chinese technique would require all the beads of the suanpan and hence cannot be conducted on the soroban. The following method has emerged to be the most popular since the 1930s.

For clarity, the significant digits of the divisor can be set near the left of the abacus. The dividend is initially set near the right. Division is then executed from left to right using a method similar to long division. In this process, the quotient gradually occupies the rods representing the dividend.

Let the dividend and divisor be a × 10p and b × 10q respectively in scientific notation. The first rod of the quotient refers to the rod two to the left of the dividend. Let n be the number of significant digits of the divisor. (n + 1) digits of the divisor will be handled at each step.

First, find the largest integer x1 such that b x1 is smaller than or equal to the number represented on rods 2 through (n + 2). Set the 1st rod as x1, and subtract b x1 from rod 2 through (n + 2). Next, find the largest integer x2 that such that b x2 is smaller than or equal to the number represented on rods 3 through (n + 3). Set the 2nd rod as x2, and subtract b x2 from rods 3 through (n + 3). Repeat this process until the dividend vanishes, or until desired level of precision has been achieved.

The quotent is given by
 * (a × 10p) ÷ (b × 10q) = $a⁄b$ × 10p - q

⌊$a⁄b$⌋, which occupies the first rod, is either the first digit of the quotient or its leading zero. The decimal point is inserted just after the (p - q + 1)th rod to obtain the quotient.

Other operations
Methods have been devised to handle negative numbers, as well as compute the square root and cube root of a number.