Anzeige
Calculate a Continued Fraction
Calculator for continued fractions up to a certain number of calculation steps. A continued fraction has the form a1+b1/(a2+b2/(...)). This calculation can be infinite, here is can be performed up to a lot of steps n, if ai and bi can be represented as formulas. n must be a positive integer, it is started with the value of n and then calculated to 1. As running variable in the formulas, i is used. The basic arithmetic operations + - * / are allowed, as well as the power function pow(), like pow(2#i) for 2i. Further allowed functions are sin(), cos(), tan(), asin(), acos(), atan(), log() for the natural logarithm and fac() for the factorial. Also, the constants e and pi can be used.
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.
Anzeige