Find rational approximation to given real number. Based on the theory of continued fractions if x = a1 + 1/(a2 + 1/(a3 + 1/(a4 + ...))) then best approximation is found by truncating this series (with some adjustments in the last term). Note the fraction can be recovered as the first column of the matrix ( a1 1 ) ( a2 1 ) ( a3 1 ) ... ( 1 0 ) ( 1 0 ) ( 1 0 ) Instead of keeping the sequence of continued fraction terms, we just keep the last partial product of these matrices.
Required Ruby Version
None
Authors
Pavel Valodzka
Versions
-
0.9.6
-
source
- 0.9.6 source January 17, 2013 (10 KB)
-
-
0.9.5
-
source
- 0.9.5 source July 25, 2011 (7.5 KB)
-
-
0.9.4
-
source
- 0.9.4 source June 23, 2011 (8 KB)
-
-
0.9.3
-
source
- 0.9.3 source May 26, 2010 (5.5 KB)
-
-
0.9.2
-
source
- 0.9.2 source May 25, 2010 (4.5 KB)
-