![]() |
|
|
|
|
|
|
6
20th March 23:45
External User
Posts: 1
|
Find a book an how to use an abacus that includes square
and cube roots. I once bought a cheap abacus in a chinatown store that included a little book. For the square root algorithm, similar to the integer square root algorithm you mention, successive odd integers are subtracted from the high digit, and the number of such is counted. (The sum of the first n odd integers is n**2.) (Though with a shift of the decimal point it will work for fixed point non-integer numbers, too.) Then there is a correction when you shift to the next lower digits (one in the accumulating square root, and two in the ever decreasing starting number.) The square root algorithm comes from the identity (10A+B)**2=100A+20AB+B**2 The cube root algorithm takes three sets of abacus columns, accumulating x and x**2 while reducing the original number by x**3. (For more digits you put two abaci side by side.) See: http://hem.passagen.se/ceem/china.htm The cube root algorithm comes from: (10A+B)**3=1000A**3+300*A**2*B+30*A*B**2+B**3 -- glen |
|
|
7
20th March 23:45
External User
Posts: 1
|
| > What I'm looking for is a specific routine just for integer cube roots,
| > similar to the integer square root (above), which isn't (as far as I | > know, an integer version of Newton's method). I know there is one, and | > I was hoping that somebody whould know of it (or where it is on the www). | > The general routine (above) for any root seems like overkill for what I | > wanted to do. __________________________________________________ Gerard S. | | | Find a book an how to use an abacus that includes square | and cube roots. I once bought a cheap abacus in a chinatown | store that included a little book. Oh, great. I ask what time it is, and you tell me to buy a book on how to build a watch. Not everyone has access to a good book store. _____Gerard S. | For the square root algorithm, similar to the integer square | root algorithm you mention, successive odd integers are subtracted | from the high digit, and the number of such is counted. | (The sum of the first n odd integers is n**2.) | (Though with a shift of the decimal point it will work for | fixed point non-integer numbers, too.) I don't see that in the code below, a subroutine to find the integer squart root: __________________________________________________ ____ /*find integer sqrt of a non-negative #.*/ isqrt: procedure; parse arg x; x=trunc(x); r=0; q=1 do while q<=x q=q*4 end do while q>1 q=q%4 _=x-r-q r=r%2 if _>=0 then do x=_ r=r+q end end return r __________________________________________________ _____ (% is integer divide in Rexx). __________________Gerard S. | Then there is a correction when you shift to the next lower digits | (one in the accumulating square root, and two in the ever decreasing | starting number.) The square root algorithm comes from the identity | (10A+B)**2=100A+20AB+B**2 | | The cube root algorithm takes three sets of abacus columns, | accumulating x and x**2 while reducing the original number by x**3. | (For more digits you put two abaci side by side.) | | See: http://hem.passagen.se/ceem/china.htm | | The cube root algorithm comes from: | (10A+B)**3=1000A**3+300*A**2*B+30*A*B**2+B**3 | -- glen |
|