Continued fractions are calculated by creating a table of convergents, as follows:
$k$ | $a_k$ | $p_k$ | $q_k$ | $C_k$ |
$-1$ | $0$ | |||
$0$ | $1$ | $0$ | ||
$1$ | $a_1$ | $a_1 \cdot p_0 + p_{-1}$ | $1$ | $\frac{p_1}{q_1}$ |
$k$ | $a_k$ | $a_k \cdot p_{k-1} + p_{k-2}$ | $a_k \cdot q_{k-1} + q_{k-2}$ | $\frac{p_k}{q_k}$ |
The table consists of $m+2$ rows. The value of the FCF is $\frac{p_m}{q_m}$.
To be continued.
See also: Continued fractions (1)
Tidak ada komentar:
Posting Komentar