The Wayback Machine - https://web.archive.org/web/20220418103650/https://www.geeksforgeeks.org/calculate-exponential-of-a-number-in-r-programming-exp-function/
Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Calculate exponential of a number in R Programming – exp() Function

  • Last Updated : 01 Jun, 2020

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
My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!