The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

A continued fraction is an expression of the form
Such expressions are interesting and useful in a number of mathematical applications. A generalized continued fraction is an expression of the form
The contfrac package provides functionality to deal with both these.
To install the most recent stable version on CRAN, use
install.packages() at the R prompt:
R> install.packages("contfrac")
And then to load the package use library():
library("contfrac")The package provides functionality for dealing with continued fractions.
as_cf(pi,n=7) # convert pi to continued fraction form
#> [1] 3 7 15 1 292 1 1We can evaluate convergents of any sequence using
convergents() or nconv():
convergents(1:8)
#> $A
#> [1] 1 3 10 43 225 1393 9976 81201
#>
#> $B
#> [1] 1 2 7 30 157 972 6961 56660
nconv(1:8)
#> [1] 1.433127The package uses standard IEEE arithmetic so is not reliable past a certain point, shown here by expanding the golden ratio:
as_cf((1+sqrt(5))/2,n=50)
#> [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
#> [39] 2 2 1 8 2 2 2 3 2 1 2 3For more details, and some discussion of the mathematics of continued fractions, see the package vignette.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.