Is there anyone still unaware of Fibonacci numbers? And the mnemonic for rough conversion between miles and kilometers via the next or previous Fibonacci number, depending on which way you’re converting? E.g., 55 km ~ 34 mi, and 55 mi ~ 89 km, so long as we’re nerdy enough to remember that
In[]:=
Fibonacci[{x-1,x,x+1}]
Out[]=
{34,55,89}
even though we’ve forgotten that x = 10. This works because the conversion factor is
In[]:=
longer[UnitConvert[Quantity[1,"Miles"],"Kilometers"][[1]],11]//OutputForm
Out[]//OutputForm=
whereas consecutive Fibonacci ratios have the continued fractions
In[]:=
longer[#,8]&/@Ratios[Fibonacci[Range[3,9]]]//OutputForm
Out[]//OutputForm=
What about numbers like 40, which aren’t Fibonacci? The usual trick is to write it as a sum of Fibonaccis, and convert them separately:
In[]:=
40==55-13-2
Out[]=
True
In[]:=
km[40]==89-21-3
Out[]=
km[40]65
In[]:=
mi[40]==34-8-1
Out[]=
mi[40]25
Too bad 40 needed three Fibonaccis. No, it doesn’t; 5 and 8 are Fibonaccis!
40=5*8
km[40]==8*13=104
mi[40]=3*5=15
Hey, wait a minute. 104 and 15 don’t much resemble 65 and 25 ! What have I actually estimated, here? SPOILER: Transforming both the 8 and the 5 effected the conversion twice! This converts between square miles and square kilometers!
In[]:=
UnitConvert[Quantity[40,"Miles"^2],"Kilometers"^2]//N
Out[]=
In[]:=
UnitConvert[Quantity[40,"Kilometers"^2],"Miles"^2]//N
Out[]=
Utility functions
Utility functions
In[]:=
Clear[longer];longer[cf_,0]:=cflonger[x_?NumericQ,n_:1]:=longer[HoldForm@@{x},n]longer[cf_,n_:1]:=longer[cf/.HoldForm[r:Except[_Integer]]:>Floor[r]+1/HoldForm@@{Simplify@Together[1/Mod[r,1]]},n-1]