TransWikia.com

Deriving formulas for continued fraction expansions

Mathematica Asked by Marc Kegel on December 4, 2020

A version of a continued fraction expansion of a rational number $rin mathbb Q$ is defined as
begin{align}
r =[a_0,a_1,a_2,ldots,a_k]= a_0 – frac{1}{a_1 – frac{1}{a_2 – dots – tfrac{1}{a_k}}}
end{align}

for integers $a_ileq-2$.

For some given rational number $r$ there is an easy algorithm based on a variation of the Euclidean algorithm to determine the continued fraction expansion $[a_0,ldots,a_k]$ of $r$. An implementation is for example described here.

However, there are such beautiful formulas as

begin{equation}
-frac{qt-1}{q(t-1)-1}=[underbrace{-2,ldots,-2}_{(t-2)-text{times}},-3,underbrace{-2,ldots,-2}_{(q-2)-text{times}}]
end{equation}

for integers $t,qgeq2$. Such formulas can be derived via the above mentioned algorithm.

My question is if there exist a way to derive such formulas via Mathematica, i.e. given for example the expression $-frac{qt-1}{q(t-1)-1}$ is there a way to derive its expression as $[underbrace{-2,ldots,-2}_{(t-2)-text{times}},-3,underbrace{-2,ldots,-2}_{(q-2)-text{times}}]$ via Mathematica?

I know the function ContinuedFractionK which is inverse (for a slightly different version of continued fraction expansions: with plus instead of minus) to what I am looking for.

One Answer

Try FromContinuedFraction

f[t_, q_] := { FromContinuedFraction[Join[ConstantArray[-2, t - 2], {-3},ConstantArray[-2, q - 2] ]], -((q t - 1)/(q (t - 1) - 1))}

but there seems to be somthing wrong with your formula:

f[4, 5]
(*{-(229/94), -(19/14)}*)

Answered by Ulrich Neumann on December 4, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP