[math-fun] What could be Mathematica's rationale?
In[74]:= ContinuedFraction[-π, 6] Out[74]= {-3, -7, -15, -1, -292, -1} vs the conventional In[75]:= MapAt[# - 4 &, ContinuedFraction[4 - π, 6], 1] Out[75]= {-4, 1, 6, 15, 1, 292} Nonpositive noninitial terms lose uniqueness, and the elegant definition cf[1/0] = {}; cf[x_] := Join[{Floor@x}, cf[1/(x - Floor@x)]] cf[-99/70] {-2, 1, 1, 2, 2, 2, 2} In Mma, adding or subtracting an integer can change *all* the terms. What would Knuth say? —rwg
Maybe it’s Mma’s homage to the lunar landing 50 years ago, when Fortran’s array declaration “DIMENSION” could be spelled “DAMNATION”. Is Mma function “ContinuedFraction” a synonym for “ConfusingFraction”? — Mike
On Jul 20, 2019, at 2:17 PM, Bill Gosper <billgosper@gmail.com> wrote:
In[74]:= ContinuedFraction[-π, 6]
Out[74]= {-3, -7, -15, -1, -292, -1}
vs the conventional In[75]:= MapAt[# - 4 &, ContinuedFraction[4 - π, 6], 1]
Out[75]= {-4, 1, 6, 15, 1, 292}
Nonpositive noninitial terms lose uniqueness, and the elegant definition cf[1/0] = {};
cf[x_] := Join[{Floor@x}, cf[1/(x - Floor@x)]]
cf[-99/70]
{-2, 1, 1, 2, 2, 2, 2}
In Mma, adding or subtracting an integer can change *all* the terms. What would Knuth say? —rwg _______________________________________________ math-fun mailing list math-fun@mailman.xmission.com https://mailman.xmission.com/cgi-bin/mailman/listinfo/math-fun
participants (2)
-
Bill Gosper -
Mike Beeler