(no title)
the_origami_fox | 2 years ago
It's based on the simple idea that:
Z = (a + b)^2 = (a^2 + (2a+b)*b)
=> (2a+b)* b < Z-a^2
Given an initial estimate "a", we need to find the largest "b" such that the term on the left is less than the term on the right. Therefore our estimate will always be slightly less than the actual answer and we can repeat the process to get slightly closer.For the first iteration, Z=2 and a=1. We choose b=x/60:
(2+x/60)*x/60 < 2-1^2
120x + x^2 < 3600
x = 24 ... 3456 < 3600
x = 25 ... 3625 > 3600
So our first term is 24/60.Repeat with a=1+24/60 and b=x/60^2:
(2(1+24/60)+x/60^2)*x/60^2< 2-(1+24/60)^2
10080x+x^2 < 518_400
x = 51 ... 516_681 < 518_400
x = 52 ... 526_864 > 518_400
Repeat multiple times.Writing this in code I can easily get: 1;24,51,10,7,46,6,4,44,50,28 = 1.4142135623730951
This whole process can be codified into the long division algorithm for square roots which works quite neatly with base 10.
Edit: formatting
PretzelPirate|2 years ago
gleapsite2|2 years ago
> Sexagesimal, also known as base 60 or sexagenary, is a numeral system with sixty as its base. It originated with the ancient Sumerians in the 3rd millennium BC, was passed down to the ancient Babylonians, and is still used—in a modified form—for measuring time, angles, and geographic coordinates.
zeroonetwothree|2 years ago
For example if you choose 2 you will get the binary expansion.
LombardBaker|2 years ago