CONTINUED_FRACTION is a MATLAB library which implements some simple algorithms for dealing with simple and generalized continued fractions.
Mathematically, continued fractions are infinite sums. In general, they are treated computationally as finite sums. Here we will assume that all such sums terminate at index N.
A simple continued fraction (SCF) is a representation of a number R as:
R = A0 + 1 / ( A1 + 1 / ( A2 + 1 / ( A3 + ... + 1 / AN )...)))
A generalized continued fraction (GCF) is a representation of a number R as:
R = A0 + B1 / ( A1 + B2 / ( A2 + B3 / ( A3 + ... + BN / AN )...)))
For either form of continued fraction, there are two tasks:
I don't care what you do with this code.
CONTINUED_FRACTION is available in a C version and a C++ version and a FORTRAN90 version and a MATLAB version..
SUBSET, a MATLAB library which enumerates, generates, randomizes, ranks and unranks combinatorial objects including combinations, compositions, Gray codes, index sets, partitions, permutations, polynomials, subsets, and Young tables. Backtracking routines are included to solve some combinatorial problems. Some routines for continued fractions are included.
You can go up one level to the MATLAB source codes.