phi2cfrac {contFracR} | R Documentation |
Function to Calculate Phi And Powers of Phi In Continued Fraction Form.
Description
This function generates the continued fraction form of the "golden ratio", phi^N
for integer powers N.
Usage
phi2cfrac( nterms = 10, exponent = 1, ...)
Arguments
nterms |
How many denominators to calculate. |
exponent |
An positive integer indicating the power of |
... |
Reserved for future use. |
Details
The 'golden ratio' , equal to (1 + sqrt(5))/2
, is the ratio of two sides x < y of a rectangle such that, by removing a square of side x, the remaining rectangle has the same ratio.
It turns out, in one of those mathematical curiosities, the denominators of the continued fraction form of phi
are all equal to one. Some people use this to state, humorously, that this makes phi
"the most irrational irrational number." It also happens that the continued fraction form for powers of phi
consist of Lucas Numbers (see References).
Value
The continued fraction denominators are provided in denom
. The inputs nterms
and exponent
are echoed back for reference.
Author(s)
Carl Witthoft, carl@witthoft.com
References
https://en.wikipedia.org/wiki/Lucas_number https://en.wikipedia.org/wiki/Golden_ratio
See Also
Examples
phi2cfrac(nterms = 10)
phi2cfrac(exponent = 3)
foop <- phi2cfrac(nterms = 20)
cfrac2num(denom = foop$denom)
# compare with:
library(Rmpfr)
(1 + sqrt(mpfr(5,1000)))/2