Learn R Programming

contFracR (version 1.2.1)

pi2cfrac: 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'),...)

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

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.

Author

Carl Witthoft, carl@witthoft.com

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.

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

cfrac2num

Examples

Run this code
 pi2cfrac(nterms = 100, method='stern')
 pi2cfrac(nterms = 100, method = 'coleman')


Run the code above in your browser using DataLab