pi2cfrac {contFracR} | R Documentation |
Function to Calculate Pi In Continued Fraction Form
Description
This function generates the continued fraction coefficients for pi, with three different algorithms to choose from.
Usage
pi2cfrac(nterms, method = c('brouncker','stern','coleman'),...)
Arguments
nterms |
The number of terms (basically depth of denominators) to generate. |
method |
The method to use, entered as a string. The choice can be abbreviated so long as it's unambiguous. See the Details section for discussion of the methods and their discoverers. |
... |
Reserved for future use. |
Details
The three methods are named for their discoverers: Brouncker in 1655, Stern in 1833, and Coleman & Pickett in 2008. There are others which can be found in various papers; these may be added in a future release.
Value
A list containing:
The numerators and denominators of the continued fraction in nums
and denoms
, as bigz
integers,
nterms
and method
echoed back for reference
Author(s)
Carl Witthoft, carl@witthoft.com
References
http://scihi.org/william-brouncker-approximation-pi/ https://divisbyzero.com/2008/12/09/a-new-continued-fraction-for-pi/ https://mathworld.wolfram.com/PiContinuedFraction.html
See Also
Examples
pi2cfrac(nterms = 100, method='stern')
pi2cfrac(nterms = 100, method = 'coleman')