Connect via MCP →

Enter Calculation

Expressions may use x, n, + - * / ^ sqrt exp ln log sin cos tan pi e. Example sqrt(x): b0=1, a_n=x-1, b_n=2.

Formula

Advertisement

Results

f(x)
2.23606797749979
converged at n = 40 (14 significant digits requested)
n Partial convergent f_n(x)
1 3
2 2
3 2.3333333333333335
4 2.2
5 2.25
6 2.230769230769231
7 2.238095238095238
8 2.235294117647059
9 2.2363636363636363
10 2.235955056179775
11 2.236111111111111
12 2.236051502145923
13 2.236074270557029
14 2.236065573770492
15 2.236068895643364
16 2.2360676268002506
17 2.236068111455108
18 2.236067926333413
19 2.2360679970436066
20 2.236067970034716
21 2.2360679803511943
22 2.23606797641065
23 2.236067977915804
24 2.2360679773408862
25 2.2360679775604853
26 2.236067977476606
27 2.236067977508645
28 2.236067977496407
29 2.2360679775010817
30 2.2360679774992964

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.

Nested staircase diagram of a generalized continued fraction with terms b0, a1, b1, a2, b2
The nested structure of a generalized continued fraction \(f(x) = b_0 + \cfrac{a_1}{b_1 + \cfrac{a_2}{b_2 + \cdots}}\).

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}\).

Line graph of successive convergents oscillating and converging toward a horizontal limit line
Partial convergents zig-zag above and below the limit, closing in on the converged value.

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.

Last updated: