e2cfrac {contFracR}R Documentation

Function to Calculate e, Euler's Number With Continued Fractions

Description

Select a particular formula to get an approximate value for Euler's number or any power e^(x/y) .

Usage

e2cfrac(nterms, pownum = 1, powdenom = 1,  method = c('euler','wall','gauss'), ...)

Arguments

nterms

How many terms of the continued fraction formula to use.

pownum

An integer identifying the numerator of the (possibly fractional) power to raise e to. See Details.

powdenom

An integer identifying the denominator of the (possibly fractional) power to raise e to. See Details.

method

Select the method, i.e. the continued fraction formula, for the calculation. If pownum/powdenom != 1, the method 'gauss' is automatically chosen. See Details.

...

Reserved for future use

Details

The two methods which calculate e but not to any power, use the following formulas: "euler" denominators = 2; 1,2,1,1,4,1,1,6,1,1,8,... "wall" denominators = 2; 1,2,3,4,... and numerators = 1,1,2,3,4,... The third method, which can calculate powers of e is variously listed as derived by Euler or proved by Gauss based on hypergeometric functions, is automatically invoked if pownum/powdenom != 1 . "gauss" denominators = 1; 2y-x,6y,10y,14y, 18y, 22y,.. and numerators = 2x,x^2,x^2,x^2,... where the exponent is x/y .

Due to the cyclic formula for the "euler" case, the exact number of terms used in the calculation may differ from the input nterms by 1 or 2 counts.

Value

edec contains the mpfr extended decimal representation. egmp contains the fraction representation. nterms, pownum, powdenom echo back the input arguments used. method, nums, denoms report the actual values used in the calculation.

Author(s)

Carl Witthoft, carl@witthoft.com

References

https://mathworld.wolfram.com/eContinuedFraction.html https://en.wikipedia.org/wiki/Euler's_continued_fraction_formula https://en.wikipedia.org/wiki/Gauss's_continued_fraction

Examples

e2cfrac(nterms = 10)
e2cfrac(nterms = 10, method = 'wall')
e2cfrac(nterms = 10, pownum = 2)
e2cfrac(nterms  = 10, powdenom = 2)


[Package contFracR version 1.2.1 Index]