For example, how would I go about entering the value e^2 in R?
3 Answers
The R expression
exp(1)
represents e, and
exp(2)
represents e^2.
This works because exp
is the exponentiation function with base e.
-digamma(1)
is the Euler's Constant in R.
e
, (exp(1)
in R), which is the natural base of the natural logarithm
-
7Please do not edit the question to change its terminology. The fact that 25000 people have visited this page without complaint until now suggests to me that many people read "Euler's constant" to mean
e
, and if you change the title, future searchers will fail to find this page. Also, glancing at wikipedia, it seems this reading of "Euler's constant" is quite widespread (since there's even a note at the top of the page you linked to the page fore
).– FrankCommented Jan 20, 2016 at 21:31 -
8@Frank Hey Frank. Thank you for reply, but I don't agree with you. I don't agree the logic that "most people called "e" as Euler's constant and thus we should called it the same way on stackoverflow". Math is a subtle subject and the terminology really matters. I have right and responsibility to tell people here the truth instead of letting them called it whatever they want. The note above wiki's page doesn't indicate that these two terms are identical, instead, the note is there because many people don't know the difference between those two constants.– OldyoungCommented Jan 20, 2016 at 21:45
-
2@Frank I believe many people search for the answer for euler's constant but find this one, disappointing search somewhere else just like me. I feel we should did the same thing, put a comment says that if you are looking for e (natural base of the natural logarithm), click here. Actually by looking the detail of question, it is the person who ask this question don't know the difference between e and euler's constant. I feel uncomfortable that we have a question with title doesn't agree with content..– OldyoungCommented Jan 20, 2016 at 21:48
-
7OK, I've changed the title to Euler's Number as it seems like what the OP meant judging by the accepted answer. I guess there is no need for this answer anymore? Or at least you could rephrase it in some manner. Commented Jan 20, 2016 at 22:22
-
10@DavidArenburg I edited. I am just so surprised that I am blamed (downvote) for telling someone my knowledge, here, in stack overflow. Think about this: OP might still call "e" Euler's constant right now, just because nobody here want to tell him the difference of terms or everybody here just don't care. Sorry I was math major in college so maybe that's why I am little more sensitive to the so called "terminology". I know stack overflow is a place for solving practical issues, but I am still surprised that how different people value things due to their major or background. not to judge– OldyoungCommented Jan 21, 2016 at 17:39
if you want to have a little number e
to play with, you can also make one 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))
fun stuff
-
4Courtesy of user gla: "Last line must be
e<- sum(1/factorial(0:100))
(and not1:100
)" - your last line is off by 1, yielding1.718...
Commented May 2, 2015 at 14:47 -
8thanks! edited! took 3 years, alas, open peer review always comes around! Commented May 2, 2015 at 14:59