Exponents

Base.expFunction
exp(x)

Compute the natural base exponential of x, in other words $ℯ^x$.

See also exp2, exp10 and cis.

Examples

julia> exp(1.0)
2.718281828459045

julia> exp(im * pi) ≈ cis(pi)
true
source
exp(A::AbstractMatrix)

Compute the matrix exponential of A, defined by

\[e^A = \sum_{n=0}^{\infty} \frac{A^n}{n!}.\]

For symmetric or Hermitian A, an eigendecomposition (eigen) is used, otherwise the scaling and squaring algorithm (see [H05]) is chosen.

Examples

julia> A = Matrix(1.0I, 2, 2)
2×2 Matrix{Float64}:
 1.0  0.0
 0.0  1.0

julia> exp(A)
2×2 Matrix{Float64}:
 2.71828  0.0
 0.0      2.71828
Base.expm1Function
expm1(x)

Accurately compute $e^x-1$. It avoids the loss of precision involved in the direct evaluation of exp(x)-1 for small values of x.

Examples

julia> expm1(1e-16)
1.0e-16

julia> exp(1e-16) - 1
0.0
source
Base.exp2Function
exp2(x)

Compute the base 2 exponential of x, in other words $2^x$.

See also ldexp, <<.

Examples

julia> exp2(5)
32.0

julia> 2^5
32

julia> exp2(63) > typemax(Int)
true
source
Base.exp10Function
exp10(x)

Compute the base 10 exponential of x, in other words $10^x$.

Examples

julia> exp10(2)
100.0

julia> 10^2
100
source
  • H05Nicholas J. Higham, "The squaring and scaling method for the matrix exponential revisited", SIAM Journal on Matrix Analysis and Applications, 26(4), 2005, 1179-1193. doi:10.1137/090768539