[math-fun] LLL algorithm, Hebrew calendar, Antikythera mechanism
A while ago I mentioned how to use continued fractions to design efficient calendars. If we want lunisolar calendars or eclipse cycles, we need to find an integer relation between more than two values. Instead of continued fractions, we can employ the LLL algorithm. I've used this to 're-discover' the Saros cycle, Metonic cycle and Exeligmos cycle: http://cp4space.wordpress.com/2012/09/12/lunisolar-calendars/ The Metonic cycle features in the Hebrew lunisolar calendar. All three are incorporated into the Antikythera mechanism. Sincerely, Adam P. Goucher http://cp4space.wordpress.com/
I can't afford Mathematica, so I'd appreciate an example that uses the qflll function in PARI/GP, or an example using the LLL method in Sage. In the meantime, I found that the direct approach is more than adequate and even a bit more useful. It gives all the same answers: the 6940 : 19 : 235 Metonic cycle and Adam's 20819 : 57 : 705 answer; the common 6585 : 242 : 223 eclipse/saros ratios and Adam's 19756 : 726 : 669. Furthermore, it lists all of the successive approximations in order of increasing accuracy and increasing size of the integers, just as one would get from continued fractions. (For a new answer to count, both ratios must be better than the mean of the two ratio-errors in the previous answer.) It is easily adapted to approximating three or more ratios. By contrast, LatticeReduce[] appears to give just one answer, it looks like I'd have to invoke it again to get a coarser or finer approximation. Here is the output (annotated). Runtime was less than 1/100 of a second: Days : Years : Synodic Months Approximating i1 : i2 : i3 :: 1.0 : 1/365.24219040 : 1/29.53058885 1096 : 3 : 37 2922 : 8 : 99 6940 : 19 : 235 Metonic cycle 13879 : 38 : 470 20819 : 57 : 705 Adam's example 80353 : 220 : 2721 101172 : 277 : 3426 121991 : 334 : 4131 William Williams, "Primitive history" (1789) 237042 : 649 : 8027 257861 : 706 : 8732 616894 : 1689 : 20890 1613640 : 4418 : 54643 3485141 : 9542 : 118018 5098781 : 13960 : 172661 Days : Draconic : Synodic Approximating i1 : i2 : i3 :: 1.0 : 1/27.21222082 : 1/29.53058885 327 : 12 : 11 354 : 13 : 12 1034 : 38 : 35 1388 : 51 : 47 6585 : 242 : 223 Saros cycle 7973 : 293 : 270 9007 : 331 : 305 9361 : 344 : 317 19756 : 726 : 669 Exeligmos (also Adam's example) 50261 : 1847 : 1702 70017 : 2573 : 2371 161178 : 5923 : 5458 Hipparchus (see John Narrien, 1833) 231195 : 8496 : 7829 442634 : 16266 : 14989 955285 : 35105 : 32349 1397919 : 51371 : 47338 2071748 : 76133 : 70156 3469667 : 127504 : 117494 5984049 : 219903 : 202639 9453716 : 347407 : 320133 and the source code: void ratio3(double a1, double a2, s64 sizelim) { s64 d1, m1, y1; double tr1, tr2, close1, close2, best; printf("Approximating i1 : i2 : i3 :: 1.0 : 1/%.8f : 1/%.8f\n", a2, a1); best = 0.01; d1 = 1; for(y1 = 1; d1<sizelim; y1++) { d1 = floor(0.5 + ((double)y1)*a2); m1 = floor(0.5 + ((double)y1)*a2/a1); tr1 = ((double)d1)/((double)m1); tr2 = ((double)d1)/((double)y1); close1 = fabs(a1/tr1 - 1.0); close2 = fabs(a2/tr2 - 1.0); if ((close1 < best) && (close2 < best)) { printf(" %lld : %lld : %lld\n", d1, y1, m1); best = (close1 + close2) / 2.0; } } } void ratios(void) { printf("Days : Years : Synodic Months\n"); ratio3(29.530588853, 365.242190402, 10000000); printf("\n"); printf("Days : Draconic : Synodic\n"); ratio3(29.530588853, 27.212220817, 10000000); } On 9/12/12, Adam P. Goucher <apgoucher@gmx.com> wrote:
A while ago I mentioned how to use continued fractions to design efficient calendars. If we want lunisolar calendars or eclipse cycles, we need to find an integer relation between more than two values. Instead of continued fractions, we can employ the LLL algorithm.
I've used this to 're-discover' the Saros cycle, Metonic cycle and Exeligmos cycle:
http://cp4space.wordpress.com/2012/09/12/lunisolar-calendars/
The Metonic cycle features in the Hebrew lunisolar calendar. All three are incorporated into the Antikythera mechanism.
-- Robert Munafo -- mrob.com Follow me at: gplus.to/mrob - fb.com/mrob27 - twitter.com/mrob_27 - mrob27.wordpress.com - youtube.com/user/mrob143 - rilybot.blogspot.com
participants (2)
-
Adam P. Goucher -
Robert Munafo