What this calculator does
This tool evaluates a generalized continued fraction of the form \(f(x) = b_0 + \cfrac{a_1}{b_1 + \cfrac{a_2}{b_2 + \cfrac{a_3}{b_3 + \cdots}}}\). The distinguishing feature is that the leading term \(b_0\), the n-th numerator \(a_n\), and the n-th denominator \(b_n\) are supplied as mathematical expressions that may depend on the variable \(x\) and on the running term index \(n\). The calculator substitutes your \(x\), generates the terms for \(n = 1, 2, 3, \ldots\), and reports the converged value \(f(x)\) together with a table of the partial convergents \(f_n(x)\). It is a pure numerical-analysis utility and applies universally — there are no regional rules or units involved.
How to use it
Enter three expressions and a value of \(x\). Each expression may use the symbols \(x\) and \(n\), the operators + - * / ^ (power), and the functions sqrt, exp, ln, log, sin, cos, tan, plus the constants pi and e. Pick the number of significant digits to control how the answer is displayed (this changes only the convergence tolerance and display, not the underlying mathematics). The result box shows \(f(x)\) and the index \(n\) at which convergence was reached; the table lists the first convergents so you can watch the value settle.
The formula explained
The convergents are produced by the forward fundamental recurrence. Starting from \(A_{-1} = 1\), \(A_0 = b_0\), \(B_{-1} = 0\), \(B_0 = 1\), each new level sets \(A_n = b_n A_{n-1} + a_n A_{n-2}\) and \(B_n = b_n B_{n-1} + a_n B_{n-2}\), and the n-th convergent is \(f_n = A_n / B_n\). Iteration stops once two successive convergents agree to the requested precision, or after a hard cap of 1000 terms.
Worked example
Use the defaults \(b_0 = 1\), \(a_n = x - 1\), \(b_n = 2\), with \(x = 5\). This is the classic continued fraction for \(\sqrt{x}\): $$\sqrt{x} = 1 + \cfrac{x-1}{2 + \cfrac{x-1}{2 + \cdots}}.$$ With \(x = 5\) every numerator is 4 and every denominator is 2. The first convergents are \(f_1 = 3\), \(f_2 = 2\), \(f_3 = 2.3333\ldots\), \(f_4 = 2.2\), all converging to \(\sqrt{5} = 2.2360679774997896\). The fixed point \(t = 2 + \frac{4}{t}\) solves \(t = 1 + \sqrt{5}\), giving \(f = 1 + \frac{4}{1+\sqrt{5}} = \sqrt{5}\).
FAQ
Can \(a_n\) and \(b_n\) depend on the index \(n\)? Yes. For example the function \(\frac{x}{e^x - 1}\) uses \(b_0 = 1 - \frac{x}{2}\), \(a_n = \frac{x^2}{4}\), \(b_n = 2n + 1\), where \(b_n\) grows with \(n\).
What if a denominator becomes zero? The evaluator substitutes a tiny epsilon to keep going, mirroring the modified Lentz method; persistent non-convergence is flagged.
Why does it stop at 1000 terms? That is the safety cap. If the fraction has not converged by then, the last convergent is returned with a warning.