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() and log() for the natural logarithm. Also, the constants e and pi can be used.

a =
b =
Calculations steps n:

Show each step Only show end result

Round to decimal places.

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