How to convert continued fractions into normal fractions

continued-fractionsfractionssequences-and-series

I couldn't find anything on Google, so I just tried opening it normally and recording each step. So I got:

$[d,c,b,a] = \frac{d(c(ab + 1) + a) + b}{c},$ and

$[e;d,c,b,a]= \frac{e(d(c(ab + 1) + a) + b) + c}{d}$

etc..

(Where $x$ is the value of the whole 'shell' that $x$ is a part of)

Is this the standard way to do it? Are there a better ways to notate what I did in the example? Are there other methods?

Edit:

I also tried factorizing, so that's another method, there is a pattern here but I can't see it completely yet:

$$\begin{align*}
[a;b] &= \frac{ab+b}b\\
[a;b,c] &= \frac{abc+a+c}{bc+1}\\
[a;b,c,d] &= \frac{abcd+ab+ad+cd+1}{bcd+b+d}
\end{align*}$$

Also, I'm not sure what branch of math this is, so sorry if I tagged it wrong)

Best Answer

Set

$$h_{-2} = 0, \quad h_{-1} = 1\\ k_{-2} = 1, \quad k_{-1} = 0\\$$

and recursively define

$$h_n = a_nh_{n-1} + h_{n-2}\\ k_n = a_nk_{n-1} + k_{n-2}$$

Then your number is

$$[a_0; a_1, \ldots, a_n] = \frac{h_n}{k_n}$$

The Wikipedia article on continued fractions is a good reference.

Example: let's turn [1; 2, 2, 2] into a normal fraction. Start with a table like this:

$$ \left[ \begin{array}{c|cc} n&-2&-1&0&1&2&3\\ \hline a_n& & &1&2&2&2\\ h_n&0&1\\ k_n&1&0 \end{array} \right]$$

Then fill out $h_n$ and $k_n$ from left to right using the formulas above:

$$ \left[ \begin{array}{c|cc} n&-2&-1&0&1&2&3\\ \hline a_n& & &1&2&2&2\\ h_n&0&1&1&3&7&17\\ k_n&1&0&1&2&5&12 \end{array} \right]$$

So $[1;2,2,2] = \frac{17}{12}$, which incidentally is close to $\sqrt2$.

Related Question