R-programming: how to get the Euler number?

For example, how would I like to enter the value e ^ 2 in R?

+56
r eulers-number
Feb 27 2018-12-12T00:
source share
3 answers

Expression R

exp(1) 

represents e, and

 exp(2) 

represents e ^ 2.

This works because exp is an exponential function with base e.

+87
Feb 27 2018-12-12T00:
source share

if you want to have a small e to play, you can also do it yourself:

  emake <- function(){ options("warn"=-1) e <- 0 for (n in 0:2000){ e <- e+ 1/(factorial(n)) } return(e) } e <- emake() e^10 exp(10) # or even: e <- sum(1/factorial(0:100)) 

funny stuff

+12
Feb 27 2018-12-12T00:
source share

-digamma(1) is the Euler constant in R.

e , ( exp(1) in R), which is the natural base of the natural logarithm

Euler Constant . Euler number

+9
Jan 20 '16 at 20:58
source share



All Articles