exp()
exp(x) Returns:
numeric · Updated March 13, 2026 · Base Functions math exp exponential base
The exp() function computes the exponential of a number, raising Euler’s number e (approximately 2.71828) to the power of the input.
Syntax
exp(x)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
x | numeric | — | A numeric vector or scalar |
Examples
Basic usage
# Exponential of 1 is Euler's number
exp(1)
# [1] 2.718282
# Exponential of 0 is 1
exp(0)
# [1] 1
# Exponential of positive numbers
exp(1:5)
# [1] 1.00000 2.71828 7.38906 20.08554 54.59815
Working with negative numbers
# Exponential of negative numbers approaches 0
exp(-1)
# [1] 0.3678794
exp(-10)
# [1] 4.539993e-05
Combining with other functions
# exp() is the inverse of log()
exp(log(5))
# [1] 5
# Natural exponential
exp(1)
# [1] 2.718282
Common Patterns
Probability calculations
# Logistic function
log_odds <- 0.5
1 / (1 + exp(-log_odds))
# [1] 0.6224593
# Poisson probabilities
lambda <- 3
exp(-lambda) * lambda^2 / factorial(2)
# [1] 0.2240418
Financial calculations
# Continuous compounding
principal <- 1000
rate <- 0.05
time <- 10
principal * exp(rate * time)
# [1] 1648.721