Re: [math-fun] periodic CFs with Round vs Floor
On 2013-12-13 15:16, Allan Wechsler wrote:
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.
Are you using non-regular (≠1) numerators? I'm just getting an initial hiccup (lasting at most three terms?), followed by the negatives of the ordinary terms. E.g., In[321]:= Reap[Nest[1/(# - Sow[Ceiling[#]]) &, Coth[1], 9]][[2, 1]] Out[321]= {2, -1, -2, -5, -7, -9, -11, -13, -15} vs In[322]:= Reap[Nest[1/(# - Sow[Floor[#]]) &, Coth[1], 9]][[2, 1]] Out[322]= {1, 3, 5, 7, 9, 11, 13, 15, 17} For quadratic surds, the periods are similarly isomorphic. For √14 In[319]:= ceiltrm /@ dismat[cfrtceil[14, 8]] Out[319]= {4, -3, -1, -6, -1, -2, -1, -6, -1} In[318]:= ContinuedFraction[Sqrt[14]] Out[318]= {3, {1, 2, 1, 6}} Below, I used Floor[#+1/2] vs round-to-even, but it shouldn't matter for irrationals.
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,
Except possibly the first.
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 --rwg Antibiotics don't actually kill bacteria--they merely hinder their reproductive cycle. For example, the widely prescribed arithromycin permits microbes that normally proliferate exponentially to grow only linearly.
participants (1)
-
Bill Gosper