Continued Fraction and Convergent Approximations
Expand a real number into a regular continued fraction and list every fraction approximation (convergent p/q) until a target accuracy or maximum denominator is met. Expressions such as pi or the golden ratio are supported.
Input
Example values (tap to fill in)
Stopping condition
Operators: + - * / ^ (power). Functions: sin cos tan exp log (natural log) ln log10 sqrt cbrt abs. Constants: pi (π), e. You may also enter plain integers or decimals.
Result
Best fraction approximation of pi ≒ 3.141592654
355 / 113
= 3.14159292 (Reached target accuracy)
Absolute error
2.668e-7
Denominator q
113
Terms (number of coefficients)
4
Continued fraction notation
List of fraction approximations (convergents)
| Term k | Coefficient a_k | Fraction p/q | Value | Absolute error |
|---|---|---|---|---|
| 0 | 3 | 3 / 1 | 3 | 0.141592654 |
| 1 | 7 | 22 / 7 | 3.14285714 | 0.001264489 |
| 2 | 15 | 333 / 106 | 3.14150943 | 8.322e-5 |
| 3 | 1 | 355 / 113 | 3.14159292 | 2.668e-7 |
How it works
- Enter a real value and the tool repeatedly extracts the integer part and the reciprocal to find each coefficient of the regular continued fraction, computing the fraction approximations p/q one by one.
- Choose the stopping condition as either a target accuracy (absolute error) or a maximum denominator. With accuracy, it stops once the error falls to that value or below; with a denominator limit, it shows the best fraction that does not exceed the given upper bound.
- The value can also be an expression. Use pi for the circle constant, e for the base of the natural logarithm, and forms such as sqrt(2) or (1+sqrt(5))/2 are evaluated directly. Plain integers and decimals are fine too.
- The result table lists, for each term, the coefficient a_k, the fraction approximation p/q, its value, and the absolute error from the target. Lower rows have smaller errors, and the row of the chosen best fraction is highlighted.
- For pi you can watch the accuracy jump as the denominator grows slightly, through 22/7, 333/106, and 355/113. For the golden ratio the numerator and denominator are consecutive Fibonacci numbers.
- If you enter a rational number, the expansion terminates when it divides evenly, and that fraction is shown as the exact value.
Related calculators
Function Graph Plotter f(x)
NumericalType an expression such as sin(x) or x^2-2 and instantly plot its graph over a chosen x range. Maximum, minimum, zeros, and sample point values are shown alongside.
Open calculator →Graph Two Functions f(x) and g(x)
NumericalPlot two expressions f(x) and g(x) on the same axes in distinct colors, and automatically find their max, min, and intersection points.
Open calculator →Data Point f(x) Graph Plotter
NumericalJust paste your (x, y) data points to instantly draw a line-and-point chart. See the point count plus the minimum, maximum, and average of y at the same time.
Open calculator →Plot Data Points f(x), g(x)
NumericalPaste two sets of (x, y) data points and get f(x) and g(x) drawn as color-coded overlaid line graphs, with each series' point count and min/max.
Open calculator →