A continued fraction expresses a real number as . Each is an integer, and truncating the expansion yields excellent rational approximations. Famous constants like and have intriguing patterns in their continued fractions.
Provide a decimal number and a maximum number of terms. The algorithm repeatedly takes the integer part, subtracts it, and then inverts the fractional remainder until the desired depth or an exact value is reached. The resulting sequence describes the continued fraction in standard bracket notation.
Continued fractions reveal number-theoretic properties and often converge faster than simple decimals. They are central in Diophantine approximation, where we seek fractions close to real numbers. Try exploring irrational numbers to see long, non-repeating patterns versus short expansions for rationals.
Consider . The continued fraction for this famous constant is [1; 2, 2, 2, âŠ]. Truncating after one term yields 1, while after two terms you get 1 + 1/2 = 1.5. After three terms the approximation is 1 + 1/(2 + 1/2) = 1.4. Each additional term brings you closer to 1.41421âŠ, demonstrating how quickly the sequence converges.
Each time you stop the expansion, you obtain a rational approximation called a convergent. These convergents alternately overestimate and underestimate the true value, and they are the best possible approximations using denominators of that size. Mathematicians analyze how rapidly the error decreases to understand the quality of the approximation.
Continued fractions were studied extensively by mathematicians such as Euclid, Euler, and Lagrange. They provide insight into Pellâs equation, quadratic irrationals, and even modern algorithms like the Euclidean algorithm for computing greatest common divisors. Today they appear in computer algebra systems and numerical methods where compact rational forms are desirable.
To see the mechanics in action, expand the decimal 3.245 with a depth of four terms. First, take the integer part 3. The remaining fractional part 0.245 is inverted, giving roughly 4.0816. The integer part of that value is 4. Subtract to get 0.0816, invert to 12.25, and continue. The resulting sequence [3; 4, 12, 4] shows how a few simple operations produce a compact rational representation.
Convergents illustrate the accuracy of each truncation. The table below shows approximations for .
Terms | Convergent |
---|---|
[3] | 3 |
[3; 7] | 22/7 |
[3; 7, 15] | 333/106 |
[3; 7, 15, 1] | 355/113 |
Each successive fraction approximates more closely, and someâlike 355/113âare remarkably accurate for their size.
Beyond pure mathematics, continued fractions aid in circuit design, control theory, and even in generating musical scales. Their ability to produce best-fit rationals makes them invaluable when hardware or notation limits precision.
When you expand a number with this tool, the table beneath the result lists the convergentsâsuccessive rational approximations derived from the continued fraction. The columns labeled h/k show the numerator and denominator of each fraction. The decimal column converts that fraction into a floatingâpoint approximation, while the error column reports how far the fraction is from the original number. These values are computed using the recurrence formulas and , which build each fraction from the previous two. Watching the error shrink as you move down the table provides an intuitive sense of convergence.
Suppose you want a fraction with a small denominator that comes very close to a given decimal. Rounding the decimal to a fixed number of places might produce a passable estimate, but a continued fraction often reveals a far better one. Convergents generated from the expansion are guaranteed to be the best rational approximations with denominators up to a certain size. This is formalized in the theory of Diophantine approximation and underpins algorithms for solving Pellâs equation, where we search for integer solutions to . By examining the convergents of , one can systematically uncover solutions that would be difficult to guess otherwise.
Digital systems that must represent irrational constants with finite precision frequently turn to continued fractions. For example, implementing a squareâroot or trigonometric function in a microcontroller might require a rational approximation with a tiny denominator to keep computation cheap. The convergents from a continued fraction provide exactly that. In signal processing, continued fractions can generate impedances that approximate desired filter characteristics. Even in computer graphics, ratios derived from these expansions help reduce aliasing by approximating slopes with simple fractions, making lineâdrawing algorithms more efficient.
The calculator is an invitation to explore the hidden structure inside familiar numbers. Enter or and examine the repeating or irregular patterns in their coefficients. The golden ratio yields the remarkably simple expansion [1; 1, 1, 1, âŠ], reflecting its selfâsimilar nature. Square roots of nonâsquare integers produce periodic continued fractions; for instance, expands to [4; 1, 3, 1, 8, âŠ] with a repeating block of four terms. Spotting these patterns can lead to deeper insights about the algebraic properties of the numbers themselves.
Rational numbers eventually terminate; an input of 5.75, for example, expands to [5; 1, 3]. Once the fractional part reaches zero, the algorithm stops. Irrational numbers never terminate, so the depth field limits how many coefficients are computed. Increasing the depth exposes more of the numberâs infinite structure, though the practical usefulness of later terms may diminish as errors from floatingâpoint arithmetic creep in. For highâprecision work, mathematicians rely on arbitraryâprecision libraries to avoid rounding issues. This calculator aims for educational clarity rather than extreme numeric rigor, but it nonetheless conveys the spirit of continued fraction expansion.
While the concept dates back to ancient mathematics, modern treatment of continued fractions blossomed in the 18th century with the work of Leonhard Euler. JosephâLouis Lagrange later proved that quadratic irrationals produce periodic continued fractions, a result that still fascinates number theorists today. Contemporary applications span cryptographyâwhere continued fractions help analyze the security of RSA keysâto chaos theory and dynamical systems. For those eager to dive deeper, classic texts such as Khinchinâs Continued Fractions or Hardy and Wrightâs Introduction to the Theory of Numbers provide rigorous yet accessible explorations.
Numbers are more than strings of digits; they hold patterns and symmetries waiting to be discovered. Continued fractions offer a lens to view these patterns in a fresh light. By experimenting with this calculatorâentering random decimals, wellâknown constants, or values from puzzlesâyou build intuition about how numbers behave. The exercise also sharpens mental arithmetic and an appreciation for how infinite processes can yield practical approximations. Whether you are a student encountering number theory for the first time or a hobbyist revisiting it after years away, taking the time to explore continued fractions can be both enlightening and enjoyable.
Simplify fractions or calculate addition, subtraction, multiplication, and division with this browser-based fraction calculator. Perfect for students, teachers, and anyone working with ratios.
Determine fiber volume fraction in a composite laminate by entering masses and densities.
Convert numbers between fraction, decimal, and percent formats with a single tool.