keisoku

Generalized Continued Fraction Evaluator

Enter the a and b sequences to numerically evaluate the generalized continued fraction b0 + a1/(b1 + a2/(b2 + …)) with backward recurrence. See each level's partial approximation and its convergence in a table and graph.

Input

Numerically evaluate the generalized continued fraction b0 + a1/(b1 + a2/(b2 + a3/(b3 + …))) from the sequences you enter. Separate each term with a line break or comma.

Examples (tap to fill in)

Golden ratio φ
√2
Pi π
Formula input (using n)

Each term can be a formula (variable n is the term index: b uses n=0,1,2…, a uses n=1,2,3…). Operators: + - * / ^ (power) / functions: sin cos tan exp log ln log10 sqrt abs pow(a,b) and more / constants: pi (π), e. Evaluation runs up to where a has one fewer term than b.

Result

Continued fraction value

1.6181818182

Evaluated levels (depth)

9 levels

Term count (a / b)

9 / 10

a terms / b terms

Final convergence gap

0.000535

Absolute difference of the last two levels

11.520123456789Level (continued fraction depth)

Partial approximations at each level (convergence)

Level (depth)baPartial approximationChange from previous level
011
11121
2111.50.5
3111.66666666670.16666667
4111.60.06666667
5111.6250.025
6111.61538461540.00961538
7111.6190476190.003663
8111.61764705880.00140056
9111.61818181820.00053476

How it works

  • Numerically evaluates the generalized continued fraction b0 + a1/(b1 + a2/(b2 + a3/…)) from the sequences you provide. Enter the b sequence (b0, b1, b2, …) and the a sequence (a1, a2, a3, …), separating terms with line breaks or commas.
  • The calculation uses backward recurrence, dividing back from the innermost term outward. Evaluation runs up to where a has one fewer term than b, and the table lists the partial approximation at each level (depth).
  • The change at each level (absolute difference from the previous level) shows how many levels it takes for the value to stabilize, i.e. the speed of convergence. The graph plots the partial approximations approaching the final value as a line.
  • Each term can also be a formula. The term index is referenced by the variable n, with b using n=0,1,2,… and a using n=1,2,3,…. For example, you can write n^2 for a and 2*n for b.
  • The presets let you instantly watch the golden ratio φ, √2, and pi π converge as continued fractions. Adding more terms improves the approximation accuracy.
  • Supported functions include sin, cos, tan, exp, log, ln, log10, sqrt, abs, pow(a,b), and the constants pi (π) and e. If a division becomes zero mid-calculation, the value is undefined, so review the coefficients in that case.