So, I was just playing around with manually calculating the value of e
in R and I noticed something that was a bit disturbing to me.
The value of
You might also try the Taylor series approximation to exp(1)
, namely
e^x = \sum_{k = 0}{\infty} x^k / k!
Thus we can approximate e = e^1
by truncating this sum; in R:
sprintf('%.20f', exp(1))
# [1] "2.71828182845904509080"
sprintf('%.20f', sum(1/factorial(0:10)))
# [1] "2.71828180114638451315"
sprintf('%.20f', sum(1/factorial(0:100)))
# [1] "2.71828182845904509080"