Calculate exponential of a number in R Programming – exp() Function
exp() function in R Language is used to calculate the power of e i.e. e^y or we can say exponential of y. The value of e is approximately equal to 2.71828…..
Syntax: exp(y)
Parameters:
y: It is any valid R number either positive or negative.Returns: Floating point number by calculating e^y.
Example 1:
# R program to calculate exp value # Using exp() method answer1 <- exp(4) answer2 <- exp(-3) answer3 <- exp(0.0) print(answer1) print(answer2) print(answer3) |
Output:
54.59815 0.04978707 1
Example 2:
# R program to calculate exp value # Using exp() method answer1 <- exp(c(pi, exp(1))) print(answer1) |
Output:
23.14069 15.15426

