GoldenRatio.R

From Organic Design wiki

Code snipits and programs written in R, S or S-PLUS options(digits=22) phi <- (1+sqrt(5))/2 phi

phi2 <- (7 * pi)/(5 * exp(1)) phi2

phiCalc <- c()

x <- 1 e <- top <- bottom <- 1 for(i in 1:20) { top <- top*x bottom <- bottom*i e <- e + top/bottom phiCalc[i] <- (7 * pi)/(5 * e) }


print(phi-phi2) print(pi) print(exp(1)) print(phiCalc - phi)