| contfrac-package {contfrac} | R Documentation |
Various utilities for manipulating continued fractions
| Package: | contfrac |
| Type: | Package |
| Version: | 1.0 |
| Date: | 2008-04-04 |
| License: | GPL |
Robin K. S. Hankin
Maintainer: <r.hankin@noc.soton.ac.uk>
# Some convergents of pi:
jj <- convergents(c(3,7,15,1,292))
jj$A / jj$B - pi
# An identity of Euler's:
jj <- GCF(a=seq(from=2,by=2,len=30), b=seq(from=3,by=2,len=30), b0=1)
jj - 1/(exp(0.5)-1) # should be small
# Now a continued fraction representation of tan(z):
tan_cf <- function(z,n=14){ GCF(c(z,rep(-z^2,n-1)), seq(from=1,by=2,len=n)) }
tan_cf(1+1i) - tan(1+1i) # should be small