Main Content
Exponents and Logarithms
Exponential, logarithm, power, and root functions
In addition to common functions like exp
and log
, MATLAB® has several other related functions to allow flexible numerical calculations.
The expm1
and log1p
functions compensate for numerical round-off errors in small arguments,
while the reallog
, realpow
, and realsqrt
functions restrict the range of these
functions to real numbers. nthroot
calculates roots of any order, while the
specialized functions pow2
and nextpow2
calculate powers of two.
Functions
exp | Exponential |
expm1 | Compute exp(X)-1 accurately for small
X |
log | Natural logarithm |
log10 | Common logarithm (base 10) |
log1p | Compute natural logarithm of 1+X accurately for small
X |
log2 | Base 2 logarithm and floating-point number dissection |
nextpow2 | Exponent of next higher power of 2 |
nthroot | Real nth root of real numbers |
pow2 | Base 2 exponentiation and scaling of floating-point numbers |
reallog | Natural logarithm for nonnegative real arrays |
realpow | Array power for real-only output |
realsqrt | Square root for nonnegative real arrays |
sqrt | Square root |
Topics
- Powers and Exponentials
This topic shows how to compute matrix powers and exponentials using a variety of methods.
- Graphical Comparison of Exponential Functions
This example shows an interesting graphical approach for discovering whether e^pi is greater than pi^e.