Content deleted Content added
m Signing comment by 210.212.36.65 - "→Connection with SL(2,Z): new section" |
→Mathematica implementation/hack: new section |
||
Line 122:
If $\begin{pmatrix} r & p \\ s & q\end{pmatrix}$ is a matrix with positive integer entries such that $rq-ps=1$, then we can use the Euclid division algorithm to show that it can be uniquely written in the form $A^{a_1}B^{b_1}A^{a_2}B^{b_2}\dots A^{a_k}B^{b_k}$ where $a_i$ and $b_i$ are non-negative integers and all except possibly $a_1$ and $b_k$ are non-zero as well. This is what gives the connection of such matrices with continued fractions. <span style="font-size: smaller;" class="autosigned">— Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[Special:Contributions/210.212.36.65|210.212.36.65]] ([[User talk:210.212.36.65|talk]]) 09:00, 30 March 2012 (UTC)</span><!-- Template:Unsigned IP --> <!--Autosigned by SineBot-->
== Mathematica implementation/hack ==
In case anyone looks for a short Mathematica one-liner implementing ?(x) for numerical values (I guess that would mean: for rationals) :
qm[x_] := Abs@Fold[#2 - #1 &, Floor@x, 2*2^-Accumulate@Rest@ContinuedFraction@x]
[[User:Summsumm2|Summsumm2]] ([[User talk:Summsumm2|talk]]) 16:08, 4 February 2013 (UTC)
|