Continued Fraction Convergents
Build all exact rational convergents of a finite simple continued fraction with an integral first coefficient and positive remaining coefficients.
Description
A finite simple continued fraction has rational convergents obtained by successively adding its coefficients.
A finite simple continued fraction has rational convergents obtained by successively adding its coefficients. These fractions can approximate a target represented by the supplied coefficient list.1
The tool returns convergents. The indexing and output conventions below determine how to read these values.
When to use Continued Fraction Convergents
Use this for the following task: Build all exact rational convergents of a finite simple continued fraction with an integral first coefficient and positive remaining coefficients. Use the input and output conventions below to reproduce the intended mathematical quantity.
How to use Continued Fraction Convergents and understand its results
- Choose the required indexes, integers or sequence entries. Preserve decimal-string encodings where the field table specifies strings.
- Enter coefficients according to the field table, then run the tool.
- Read convergents. Use the stated units, indexing and interpretation of the numerical result.
- Keep exact decimal strings for subsequent integer arithmetic; distinguish them from any explicitly approximate numeric result.
| Input field | Meaning | Value type and bounds | Requirement |
|---|---|---|---|
| coefficients | Simple continued fraction coefficients | list of integer; minimum entries 1; maximum entries 256; each entry: minimum -9007199254740991; maximum 9007199254740991 | Required |
Accept 1–256 safe-integer coefficients, allowing any integer first coefficient and requiring every later coefficient to be positive. Update BigInt numerator and denominator pairs and return every convergent.
pⱼ=aⱼpⱼ₋₁+pⱼ₋₂; qⱼ=aⱼqⱼ₋₁+qⱼ₋₂ The symbols and boundary conditions refer to the supplied fields and the implementation described above.
| Output field | Meaning | Value type |
|---|---|---|
| convergents | Rational convergents in prefix order | list of object |
{
"input": {
"coefficients": [
3,
7,
16
]
},
"output": {
"convergents": [
{
"numerator": "3",
"denominator": "1"
},
{
"numerator": "22",
"denominator": "7"
},
{
"numerator": "355",
"denominator": "113"
}
]
}
} Limitations and assumptions
The caller supplies the continued fraction; no decimal-to-continued-fraction conversion is performed. Output numerator and denominator values are exact decimal strings.
Use the declared integer bounds and string formats. Large exact outputs remain decimal strings; numerical approximations use ordinary floating-point arithmetic. A rejected input is different from a valid zero count or false membership flag.
Alternative or Complementary methods
Choose Stern–Brocot Neighbor Mediant when you need its operation: Insert the reduced mediant between ordered nonnegative Stern–Brocot neighbors satisfying b·c−a·d=1, including the boundary pair 0/1 and 1/0. Choose Farey Sequence of Order n for the complementary operation: List the reduced fractions from zero to one in increasing order with denominators at most n; order is capped at 300 to bound the output size.
Background reference: Digital Library of Mathematical Functions, §1.12.
References
-
Digital Library of Mathematical Functions, §1.12 — National Institute of Standards and Technology
Similar or alternative tools
- Stern–Brocot Neighbor Mediant
Insert the reduced mediant between ordered nonnegative Stern–Brocot neighbors satisfying b·c−a·d=1, including the boundary pair 0/1 and 1/0.
- Farey Sequence of Order n
List the reduced fractions from zero to one in increasing order with denominators at most n; order is capped at 300 to bound the output size.