octave: Exponents and Logarithms
17.1 Exponents and Logarithms
=============================
-- : exp (X)
Compute ‘e^x’ for each element of X.
To compute the matrix exponential, see Linear Algebra.
See also: log XREFlog.
-- : expm1 (X)
Compute ‘exp (X) - 1’ accurately in the neighborhood of zero.
See also: exp XREFexp.
-- : log (X)
Compute the natural logarithm, ‘ln (X)’, for each element of X.
To compute the matrix logarithm, see Linear Algebra.
DONTPRINTYET See also: exp XREFexp, log1p XREFlog1p, *notelog2:
DONTPRINTYET See also: exp XREFexp, log1p XREFlog1p, log2
XREFlog2, log10 XREFlog10, logspace XREFlogspace.
-- : reallog (X)
Return the real-valued natural logarithm of each element of X.
If any element results in a complex return value ‘reallog’ aborts
and issues an error.
DONTPRINTYET See also: log XREFlog, realpow XREFrealpow, *noteDONTPRINTYET See also: log XREFlog, realpow XREFrealpow,
realsqrt XREFrealsqrt.
-- : log1p (X)
Compute ‘log (1 + X)’ accurately in the neighborhood of zero.
DONTPRINTYET See also: log XREFlog, exp XREFexp, *noteexpm1:
DONTPRINTYET See also: log XREFlog, exp XREFexp, expm1
XREFexpm1.
-- : log10 (X)
Compute the base-10 logarithm of each element of X.
DONTPRINTYET See also: log XREFlog, log2 XREFlog2, *notelogspace:
DONTPRINTYET See also: log XREFlog, log2 XREFlog2, logspace
XREFlogspace, exp XREFexp.
-- : log2 (X)
-- : [F, E] = log2 (X)
Compute the base-2 logarithm of each element of X.
If called with two output arguments, split X into binary mantissa
and exponent so that ‘1/2 <= abs(f) < 1’ and E is an integer. If
‘x = 0’, ‘f = e = 0’.
DONTPRINTYET See also: pow2 XREFpow2, log XREFlog, *notelog10:
DONTPRINTYET See also: pow2 XREFpow2, log XREFlog, log10
XREFlog10, exp XREFexp.
-- : pow2 (X)
-- : pow2 (F, E)
With one input argument, compute 2 .^ x for each element of X.
With two input arguments, return f .* (2 .^ e).
DONTPRINTYET See also: log2 XREFlog2, nextpow2 XREFnextpow2, *noteDONTPRINTYET See also: log2 XREFlog2, nextpow2 XREFnextpow2,
power XREFpower.
-- : nextpow2 (X)
Compute the exponent for the smallest power of two larger than the
input.
For each element in the input array X, return the first integer N
such that 2^n ≥ abs (x).
See also: pow2 XREFpow2, log2 XREFlog2.
-- : realpow (X, Y)
Compute the real-valued, element-by-element power operator.
This is equivalent to ‘X .^ Y’, except that ‘realpow’ reports an
error if any return value is complex.
DONTPRINTYET See also: power XREFpower, reallog XREFreallog, *noteDONTPRINTYET See also: power XREFpower, reallog XREFreallog,
realsqrt XREFrealsqrt.
-- : sqrt (X)
Compute the square root of each element of X.
If X is negative, a complex result is returned.
To compute the matrix square root, see Linear Algebra.
See also: realsqrt XREFrealsqrt, nthroot XREFnthroot.
-- : realsqrt (X)
Return the real-valued square root of each element of X.
If any element results in a complex return value ‘realsqrt’ aborts
and issues an error.
DONTPRINTYET See also: sqrt XREFsqrt, realpow XREFrealpow, *noteDONTPRINTYET See also: sqrt XREFsqrt, realpow XREFrealpow,
reallog XREFreallog.
-- : cbrt (X)
Compute the real cube root of each element of X.
Unlike ‘X^(1/3)’, the result will be negative if X is negative.
See also: nthroot XREFnthroot.
-- : nthroot (X, N)
Compute the real (non-complex) N-th root of X.
X must have all real entries and N must be a scalar. If N is an
even integer and X has negative entries then ‘nthroot’ aborts and
issues an error.
Example:
nthroot (-1, 3)
⇒ -1
(-1) ^ (1 / 3)
⇒ 0.50000 - 0.86603i
DONTPRINTYET See also: realsqrt XREFrealsqrt, sqrt XREFsqrt, *noteDONTPRINTYET See also: realsqrt XREFrealsqrt, sqrt XREFsqrt,
cbrt XREFcbrt.