[math-fun] periodic CFs with Round vs Floor
Superficial observations. How much does rounding (thereby disabling terms =1, and enabling negative terms) shorten the period? In[281]:= rtcfperiod /@ Range[69] - rndcfperiod /@ Range[69] Out[281]= {{0}, 0, 0, {1}, 0, 0, 2, 0, {2}, 0, 0, 0, 2, 2, 0, {3}, 0, \ 0, 2, 0, 2, 2, 2, 0, {4}, 0, 0, 0, -3, 0, 2, 2, 2, 2, 0, {5}, 0, 0, \ 0, 0, 0, 0, 4, 4, 2, 4, 2, 0, {6}, 0, 0, 2, -3, 2, 0, 0, 2, -1, 2, 2, \ 4, 2, 0, {7}, 0, 0, 2, 0, 2} It actually lengthened √29 (and √53) by three! and √241 by seven: In[282]:= rtcfperiod /@ Range[239, 288] - rndcfperiod /@ Range[239, 288] Out[282]= {2, 0, -7, 4, 2, 12, 4, 4, -2, 2, 6, 2, 4, 2, 8, 2, 0, \ {15}, 0, 0, 2, 0, 4, 4, 4, 0, 2, 0, 2, 6, 0, 0, 8, 0, 2, 2, 2, 4, 6, \ 2, -2, 0, 4, 4, 8, 6, 2, 2, 2, 0} The biggest helps seem to outweigh the biggest hurts. The curlybraces mark the terminating (square) cases. In[275]:= cfrnt[29, 9] Out[275]= {{{0, 29}, {1, 0}}, {{5, 1}, {4, -5}}, {{7, 4}, {-5, -7}}, {{3, -5}, {-4, -3}}, {{5, -4}, {-1, -5}}, {{5, -1}, {-4, -5}}, {{7, -4}, {5, -7}}, {{3, 5}, {4, -3}}, {{5, 4}, {1, -5}}, {{5, 1}, {4, -5}}} The actual √29 roundcf, In[276]:= rndtrm /@ % Out[276]= {5, 3, -2, -2, -10, -3, 2, 2, 10, 3} vs the vanilla one, In[278]:= ContinuedFraction[Sqrt[29], Length[%%]] Out[278]= {5, 2, 1, 1, 2, 10, 2, 1, 1, 2} In[279]:= FromContinuedFraction /@ {%276, %278} Out[279]= {315156/58523, 9801/1820} of course converges faster, term for term: In[280]:= % - Sqrt[29.] Out[280]= {-1.35546*10^-10, 2.80303*10^-8} Even faster, period for period. --rwg
You've investigated the pure ceiling flavor, have you not? An interesting feature of these is that they can be sorted by magnitude just using dictionary ordering. On Fri, Dec 13, 2013 at 5:46 PM, Bill Gosper <billgosper@gmail.com> wrote:
Superficial observations. How much does rounding (thereby disabling terms =1, and enabling negative terms) shorten the period? In[281]:= rtcfperiod /@ Range[69] - rndcfperiod /@ Range[69]
Out[281]= {{0}, 0, 0, {1}, 0, 0, 2, 0, {2}, 0, 0, 0, 2, 2, 0, {3}, 0, \ 0, 2, 0, 2, 2, 2, 0, {4}, 0, 0, 0, -3, 0, 2, 2, 2, 2, 0, {5}, 0, 0, \ 0, 0, 0, 0, 4, 4, 2, 4, 2, 0, {6}, 0, 0, 2, -3, 2, 0, 0, 2, -1, 2, 2, \ 4, 2, 0, {7}, 0, 0, 2, 0, 2}
It actually lengthened √29 (and √53) by three! and √241 by seven: In[282]:= rtcfperiod /@ Range[239, 288] - rndcfperiod /@ Range[239, 288]
Out[282]= {2, 0, -7, 4, 2, 12, 4, 4, -2, 2, 6, 2, 4, 2, 8, 2, 0, \ {15}, 0, 0, 2, 0, 4, 4, 4, 0, 2, 0, 2, 6, 0, 0, 8, 0, 2, 2, 2, 4, 6, \ 2, -2, 0, 4, 4, 8, 6, 2, 2, 2, 0}
The biggest helps seem to outweigh the biggest hurts. The curlybraces mark the terminating (square) cases. In[275]:= cfrnt[29, 9]
Out[275]= {{{0, 29}, {1, 0}}, {{5, 1}, {4, -5}}, {{7, 4}, {-5, -7}}, {{3, -5}, {-4, -3}}, {{5, -4}, {-1, -5}}, {{5, -1}, {-4, -5}}, {{7, -4}, {5, -7}}, {{3, 5}, {4, -3}}, {{5, 4}, {1, -5}}, {{5, 1}, {4, -5}}}
The actual √29 roundcf, In[276]:= rndtrm /@ %
Out[276]= {5, 3, -2, -2, -10, -3, 2, 2, 10, 3}
vs the vanilla one, In[278]:= ContinuedFraction[Sqrt[29], Length[%%]]
Out[278]= {5, 2, 1, 1, 2, 10, 2, 1, 1, 2}
In[279]:= FromContinuedFraction /@ {%276, %278}
Out[279]= {315156/58523, 9801/1820}
of course converges faster, term for term: In[280]:= % - Sqrt[29.]
Out[280]= {-1.35546*10^-10, 2.80303*10^-8}
Even faster, period for period. --rwg _______________________________________________ math-fun mailing list math-fun@mailman.xmission.com http://mailman.xmission.com/cgi-bin/mailman/listinfo/math-fun
participants (2)
-
Allan Wechsler -
Bill Gosper