Calculate a Continued Fraction
Calculator for continued fractions up to a certain number of calculation steps. A continued fraction has the form
The calculation is done backwards:
kn = an + bn
kn-1 = an-1 + bn-1 / kn
kn-2 = an-2 + bn-2 / kn-1
...
k1 = a1 + b1 / k2
Examples:
- 1+1/(1+1/(1+1/(...))), where a=1 and b=1, is the continued fraction expansion of the golden ratio.
- a=6 and b=pow(2*i-1#2) approaches the value of π+3. After 100 steps, the result is 6.1415923985336, the exact value with 13 decimal places is 6.1415926535898. This is reached after about 20000 steps.
A continued fraction is theoretically a fraction that repeats itself ad infinitum. In practice, of course, it cannot be calculated infinitely often, but only up to a certain calculation depth. The deeper the calculation, the more the calculated result should approximate the true value of the continued fraction.
Continued fractions can be used to generate real numbers, i.e., those with an infinite number of irregular decimal places. This is also possible with square roots; for example, the golden ratio mentioned above can also be written as (1 +√5)/2. However, there are also real numbers that cannot be represented by square roots, i.e., they are not solutions of polynomials. These numbers are called non-algebraic or transcendental. An example of this is the number pi. Such numbers can also be represented using a continued fraction expansion; one for pi is given above. Euler's number e, another transcendental number, can also be generated using a continued fraction expansion, but this is more complicated and not feasible with the calculator above.