1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263
|
<html lang="en">
<head>
<title>Exponents and Logarithms - GNU Octave</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="GNU Octave">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Arithmetic.html#Arithmetic" title="Arithmetic">
<link rel="next" href="Complex-Arithmetic.html#Complex-Arithmetic" title="Complex Arithmetic">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<a name="Exponents-and-Logarithms"></a>
<p>
Next: <a rel="next" accesskey="n" href="Complex-Arithmetic.html#Complex-Arithmetic">Complex Arithmetic</a>,
Up: <a rel="up" accesskey="u" href="Arithmetic.html#Arithmetic">Arithmetic</a>
<hr>
</div>
<h3 class="section">17.1 Exponents and Logarithms</h3>
<!-- exp src/mappers.cc -->
<p><a name="doc_002dexp"></a>
<div class="defun">
— Mapping Function: <b>exp</b> (<var>x</var>)<var><a name="index-exp-1775"></a></var><br>
<blockquote><p>Compute
<code>e^x</code>
for each element of <var>x</var>. To compute the matrix
exponential, see <a href="Linear-Algebra.html#Linear-Algebra">Linear Algebra</a>.
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->
<p class="noindent"><strong>See also:</strong> <a href="doc_002dlog.html#doc_002dlog">log</a>.
</p></blockquote></div>
<!-- expm1 src/mappers.cc -->
<p><a name="doc_002dexpm1"></a>
<div class="defun">
— Mapping Function: <b>expm1</b> (<var>x</var>)<var><a name="index-expm1-1776"></a></var><br>
<blockquote><p>Compute
<code>exp (</code><var>x</var><code>) - 1</code>
accurately in the neighborhood of zero.
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->
<p class="noindent"><strong>See also:</strong> <a href="doc_002dexp.html#doc_002dexp">exp</a>.
</p></blockquote></div>
<!-- log src/mappers.cc -->
<p><a name="doc_002dlog"></a>
<div class="defun">
— Mapping Function: <b>log</b> (<var>x</var>)<var><a name="index-log-1777"></a></var><br>
<blockquote><p>Compute the natural logarithm,
<code>ln (</code><var>x</var><code>)</code>,
for each element of <var>x</var>. To compute the
matrix logarithm, see <a href="Linear-Algebra.html#Linear-Algebra">Linear Algebra</a>.
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->
<p class="noindent"><strong>See also:</strong> <a href="doc_002dexp.html#doc_002dexp">exp</a>, <a href="doc_002dlog1p.html#doc_002dlog1p">log1p</a>, <a href="doc_002dlog2.html#doc_002dlog2">log2</a>, <a href="doc_002dlog10.html#doc_002dlog10">log10</a>, <a href="doc_002dlogspace.html#doc_002dlogspace">logspace</a>.
</p></blockquote></div>
<!-- reallog scripts/specfun/reallog.m -->
<p><a name="doc_002dreallog"></a>
<div class="defun">
— Function File: <b>reallog</b> (<var>x</var>)<var><a name="index-reallog-1778"></a></var><br>
<blockquote><p>Return the real-valued natural logarithm of each element of <var>x</var>. Report
an error if any element results in a complex return value.
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->
<p class="noindent"><strong>See also:</strong> <a href="doc_002dlog.html#doc_002dlog">log</a>, <a href="doc_002drealpow.html#doc_002drealpow">realpow</a>, <a href="doc_002drealsqrt.html#doc_002drealsqrt">realsqrt</a>.
</p></blockquote></div>
<!-- log1p src/mappers.cc -->
<p><a name="doc_002dlog1p"></a>
<div class="defun">
— Mapping Function: <b>log1p</b> (<var>x</var>)<var><a name="index-log1p-1779"></a></var><br>
<blockquote><p>Compute
<code>log (1 + </code><var>x</var><code>)</code>
accurately in the neighborhood of zero.
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->
<p class="noindent"><strong>See also:</strong> <a href="doc_002dlog.html#doc_002dlog">log</a>, <a href="doc_002dexp.html#doc_002dexp">exp</a>, <a href="doc_002dexpm1.html#doc_002dexpm1">expm1</a>.
</p></blockquote></div>
<!-- log10 src/mappers.cc -->
<p><a name="doc_002dlog10"></a>
<div class="defun">
— Mapping Function: <b>log10</b> (<var>x</var>)<var><a name="index-log10-1780"></a></var><br>
<blockquote><p>Compute the base-10 logarithm of each element of <var>x</var>.
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->
<p class="noindent"><strong>See also:</strong> <a href="doc_002dlog.html#doc_002dlog">log</a>, <a href="doc_002dlog2.html#doc_002dlog2">log2</a>, <a href="doc_002dlogspace.html#doc_002dlogspace">logspace</a>, <a href="doc_002dexp.html#doc_002dexp">exp</a>.
</p></blockquote></div>
<!-- log2 src/data.cc -->
<p><a name="doc_002dlog2"></a>
<div class="defun">
— Mapping Function: <b>log2</b> (<var>x</var>)<var><a name="index-log2-1781"></a></var><br>
— Mapping Function: [<var>f</var>, <var>e</var>] = <b>log2</b> (<var>x</var>)<var><a name="index-log2-1782"></a></var><br>
<blockquote><p>Compute the base-2 logarithm of each element of <var>x</var>.
<p>If called with two output arguments, split <var>x</var> into
binary mantissa and exponent so that
<code>1/2 <= abs(f) < 1</code>
and <var>e</var> is an integer. If
<code>x = 0</code>, <code>f = e = 0</code>.
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->
<p class="noindent"><strong>See also:</strong> <a href="doc_002dpow2.html#doc_002dpow2">pow2</a>, <a href="doc_002dlog.html#doc_002dlog">log</a>, <a href="doc_002dlog10.html#doc_002dlog10">log10</a>, <a href="doc_002dexp.html#doc_002dexp">exp</a>.
</p></blockquote></div>
<!-- pow2 scripts/specfun/pow2.m -->
<p><a name="doc_002dpow2"></a>
<div class="defun">
— Mapping Function: <b>pow2</b> (<var>x</var>)<var><a name="index-pow2-1783"></a></var><br>
— Mapping Function: <b>pow2</b> (<var>f, e</var>)<var><a name="index-pow2-1784"></a></var><br>
<blockquote><p>With one argument, computes
2 .^ x
for each element of <var>x</var>.
<p>With two arguments, returns
f .* (2 .^ e).
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->
<p class="noindent"><strong>See also:</strong> <a href="doc_002dlog2.html#doc_002dlog2">log2</a>, <a href="doc_002dnextpow2.html#doc_002dnextpow2">nextpow2</a>.
</p></blockquote></div>
<!-- nextpow2 scripts/general/nextpow2.m -->
<p><a name="doc_002dnextpow2"></a>
<div class="defun">
— Function File: <b>nextpow2</b> (<var>x</var>)<var><a name="index-nextpow2-1785"></a></var><br>
<blockquote><p>If <var>x</var> is a scalar, return the first integer <var>n</var> such that
2^n ≥ abs (x).
<p>If <var>x</var> is a vector, return <code>nextpow2 (length (</code><var>x</var><code>))</code>.
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->
<p class="noindent"><strong>See also:</strong> <a href="doc_002dpow2.html#doc_002dpow2">pow2</a>, <a href="doc_002dlog2.html#doc_002dlog2">log2</a>.
</p></blockquote></div>
<!-- realpow scripts/specfun/realpow.m -->
<p><a name="doc_002drealpow"></a>
<div class="defun">
— Function File: <b>realpow</b> (<var>x, y</var>)<var><a name="index-realpow-1786"></a></var><br>
<blockquote><p>Compute the real-valued, element-by-element power operator. This is
equivalent to <var>x</var><code> .^ </code><var>y</var><!-- /@w -->, except that <code>realpow</code>
reports an error if any return value is complex.
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->
<p class="noindent"><strong>See also:</strong> <a href="doc_002dreallog.html#doc_002dreallog">reallog</a>, <a href="doc_002drealsqrt.html#doc_002drealsqrt">realsqrt</a>.
</p></blockquote></div>
<!-- sqrt src/mappers.cc -->
<p><a name="doc_002dsqrt"></a>
<div class="defun">
— Mapping Function: <b>sqrt</b> (<var>x</var>)<var><a name="index-sqrt-1787"></a></var><br>
<blockquote><p>Compute the square root of each element of <var>x</var>. If <var>x</var> is negative,
a complex result is returned. To compute the matrix square root, see
<a href="Linear-Algebra.html#Linear-Algebra">Linear Algebra</a>.
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->
<p class="noindent"><strong>See also:</strong> <a href="doc_002drealsqrt.html#doc_002drealsqrt">realsqrt</a>, <a href="doc_002dnthroot.html#doc_002dnthroot">nthroot</a>.
</p></blockquote></div>
<!-- realsqrt scripts/specfun/realsqrt.m -->
<p><a name="doc_002drealsqrt"></a>
<div class="defun">
— Function File: <b>realsqrt</b> (<var>x</var>)<var><a name="index-realsqrt-1788"></a></var><br>
<blockquote><p>Return the real-valued square root of each element of <var>x</var>. Report an
error if any element results in a complex return value.
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->
<p class="noindent"><strong>See also:</strong> <a href="doc_002dsqrt.html#doc_002dsqrt">sqrt</a>, <a href="doc_002drealpow.html#doc_002drealpow">realpow</a>, <a href="doc_002dreallog.html#doc_002dreallog">reallog</a>.
</p></blockquote></div>
<!-- cbrt src/mappers.cc -->
<p><a name="doc_002dcbrt"></a>
<div class="defun">
— Mapping Function: <b>cbrt</b> (<var>x</var>)<var><a name="index-cbrt-1789"></a></var><br>
<blockquote><p>Compute the real cube root of each element of <var>x</var>.
Unlike <var>x</var><code>^(1/3)</code>, the result will be negative if <var>x</var> is
negative.
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->
<p class="noindent"><strong>See also:</strong> <a href="doc_002dnthroot.html#doc_002dnthroot">nthroot</a>.
</p></blockquote></div>
<!-- nthroot scripts/specfun/nthroot.m -->
<p><a name="doc_002dnthroot"></a>
<div class="defun">
— Function File: <b>nthroot</b> (<var>x, n</var>)<var><a name="index-nthroot-1790"></a></var><br>
<blockquote>
<p>Compute the n-th root of <var>x</var>, returning real results for real
components of <var>x</var>. For example:
<pre class="example"> nthroot (-1, 3)
⇒ -1
(-1) ^ (1 / 3)
⇒ 0.50000 - 0.86603i
</pre>
<p><var>x</var> must have all real entries. <var>n</var> must be a scalar.
If <var>n</var> is an even integer and <var>X</var> has negative entries, an
error is produced.
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->
<p class="noindent"><strong>See also:</strong> <a href="doc_002drealsqrt.html#doc_002drealsqrt">realsqrt</a>, <a href="doc_002dsqrt.html#doc_002dsqrt">sqrt</a>, <a href="doc_002dcbrt.html#doc_002dcbrt">cbrt</a>.
</p></blockquote></div>
</body></html>
|