Continued fraction convergent (source code)

= Continued fraction convergent
{wiki}

= Convergent
{synonym}

The $k$th <continued fraction convergent> of $[a_0;a_1,a_2,\ldots]$ is its truncation $p_k/q_k=[a_0;\ldots,a_k]$, written in lowest terms with positive denominator. The recurrences are $p_k=a_kp_{k-1}+p_{k-2}$ and $q_k=a_kq_{k-1}+q_{k-2}$, initialized by $(p_{-2},p_{-1})=(0,1)$ and $(q_{-2},q_{-1})=(1,0)$.

For $\sqrt2=[1;2,2,\ldots]$, the convergents begin $1,3/2,7/5,17/12$. For an infinite simple <continued fraction>, $|\alpha-p_k/q_k|<1/(q_kq_{k+1})$. Thus the successive <convergent denominators> quantify the improving accuracy rather than merely recording a symbolic truncation.