Commits

Antonio Alvarado Hernández committed 77a7284

created a folder for my R snippets

for now this only includes:

* a simple function to calculate the number `e`

Comments (0)

Files changed (1)

+#!/usr/bin/env Rscript
+
+##
+# calculate the number `e` after `n` iterations
+#
+e <- function (n) {
+	e <- p <- 1;
+	for (i in 2:n) {
+		e <- e + 1/p
+		p <- p * i
+	}
+	return(e)
+}
+
+print(e(10))
+
+# EOF