File: Exponents-and-Logarithms.html

package info (click to toggle)
octave 6.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 124,192 kB
  • sloc: cpp: 322,665; ansic: 68,088; fortran: 20,980; objc: 8,121; sh: 7,719; yacc: 4,266; lex: 4,123; perl: 1,530; java: 1,366; awk: 1,257; makefile: 424; xml: 147
file content (231 lines) | stat: -rw-r--r-- 9,332 bytes parent folder | download
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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Exponents and Logarithms (GNU Octave (version 6.2.0))</title>

<meta name="description" content="Exponents and Logarithms (GNU Octave (version 6.2.0))">
<meta name="keywords" content="Exponents and Logarithms (GNU Octave (version 6.2.0))">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<link href="index.html" rel="start" title="Top">
<link href="Concept-Index.html" rel="index" title="Concept Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Arithmetic.html" rel="up" title="Arithmetic">
<link href="Complex-Arithmetic.html" rel="next" title="Complex Arithmetic">
<link href="Arithmetic.html" rel="prev" title="Arithmetic">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
<link rel="stylesheet" type="text/css" href="octave.css">


</head>

<body lang="en">
<span id="Exponents-and-Logarithms"></span><div class="header">
<p>
Next: <a href="Complex-Arithmetic.html" accesskey="n" rel="next">Complex Arithmetic</a>, Up: <a href="Arithmetic.html" accesskey="u" rel="up">Arithmetic</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<span id="Exponents-and-Logarithms-1"></span><h3 class="section">17.1 Exponents and Logarithms</h3>

<span id="XREFexp"></span><dl>
<dt id="index-exp">: <em></em> <strong>exp</strong> <em>(<var>x</var>)</em></dt>
<dd><p>Compute
<code>e^x</code>
for each element of <var>x</var>.
</p>
<p>To compute the matrix exponential, see <a href="Linear-Algebra.html">Linear Algebra</a>.
</p>
<p><strong>See also:</strong> <a href="#XREFlog">log</a>.
</p></dd></dl>


<span id="XREFexpm1"></span><dl>
<dt id="index-expm1">: <em></em> <strong>expm1</strong> <em>(<var>x</var>)</em></dt>
<dd><p>Compute
<code>exp (<var>x</var>) - 1</code>
accurately in the neighborhood of zero.
</p>
<p><strong>See also:</strong> <a href="#XREFexp">exp</a>.
</p></dd></dl>


<span id="XREFlog"></span><dl>
<dt id="index-log">: <em></em> <strong>log</strong> <em>(<var>x</var>)</em></dt>
<dd><p>Compute the natural logarithm,
<code>ln (<var>x</var>)</code>,
for each element of <var>x</var>.
</p>
<p>To compute the matrix logarithm, see <a href="Linear-Algebra.html">Linear Algebra</a>.
</p>
<p><strong>See also:</strong> <a href="#XREFexp">exp</a>, <a href="#XREFlog1p">log1p</a>, <a href="#XREFlog2">log2</a>, <a href="#XREFlog10">log10</a>, <a href="Special-Utility-Matrices.html#XREFlogspace">logspace</a>.
</p></dd></dl>


<span id="XREFreallog"></span><dl>
<dt id="index-reallog">: <em></em> <strong>reallog</strong> <em>(<var>x</var>)</em></dt>
<dd><p>Return the real-valued natural logarithm of each element of <var>x</var>.
</p>
<p>If any element results in a complex return value <code>reallog</code> aborts and
issues an error.
</p>
<p><strong>See also:</strong> <a href="#XREFlog">log</a>, <a href="#XREFrealpow">realpow</a>, <a href="#XREFrealsqrt">realsqrt</a>.
</p></dd></dl>


<span id="XREFlog1p"></span><dl>
<dt id="index-log1p">: <em></em> <strong>log1p</strong> <em>(<var>x</var>)</em></dt>
<dd><p>Compute
<code>log (1 + <var>x</var>)</code>
accurately in the neighborhood of zero.
</p>
<p><strong>See also:</strong> <a href="#XREFlog">log</a>, <a href="#XREFexp">exp</a>, <a href="#XREFexpm1">expm1</a>.
</p></dd></dl>


<span id="XREFlog10"></span><dl>
<dt id="index-log10">: <em></em> <strong>log10</strong> <em>(<var>x</var>)</em></dt>
<dd><p>Compute the base-10 logarithm of each element of <var>x</var>.
</p>
<p><strong>See also:</strong> <a href="#XREFlog">log</a>, <a href="#XREFlog2">log2</a>, <a href="Special-Utility-Matrices.html#XREFlogspace">logspace</a>, <a href="#XREFexp">exp</a>.
</p></dd></dl>


<span id="XREFlog2"></span><dl>
<dt id="index-log2">: <em></em> <strong>log2</strong> <em>(<var>x</var>)</em></dt>
<dt id="index-log2-1">: <em>[<var>f</var>, <var>e</var>] =</em> <strong>log2</strong> <em>(<var>x</var>)</em></dt>
<dd><p>Compute the base-2 logarithm of each element of <var>x</var>.
</p>
<p>If called with two output arguments, split <var>x</var> into
binary mantissa and exponent so that
<code>1/2&nbsp;&lt;=&nbsp;abs(f)&nbsp;&lt;&nbsp;1</code><!-- /@w -->
and <var>e</var> is an integer.  If
<code>x&nbsp;=&nbsp;0</code><!-- /@w -->, <code>f&nbsp;=&nbsp;e&nbsp;=&nbsp;0</code><!-- /@w -->.
</p>
<p><strong>See also:</strong> <a href="#XREFpow2">pow2</a>, <a href="#XREFlog">log</a>, <a href="#XREFlog10">log10</a>, <a href="#XREFexp">exp</a>.
</p></dd></dl>


<span id="XREFpow2"></span><dl>
<dt id="index-pow2">: <em></em> <strong>pow2</strong> <em>(<var>x</var>)</em></dt>
<dt id="index-pow2-1">: <em></em> <strong>pow2</strong> <em>(<var>f</var>, <var>e</var>)</em></dt>
<dd><p>With one input argument, compute
2 .^ x
for each element of <var>x</var>.
</p>
<p>With two input arguments, return
f .* (2 .^ e).
</p>
<p><strong>See also:</strong> <a href="#XREFlog2">log2</a>, <a href="#XREFnextpow2">nextpow2</a>, <a href="Arithmetic-Ops.html#XREFpower">power</a>.
</p></dd></dl>


<span id="XREFnextpow2"></span><dl>
<dt id="index-nextpow2">: <em><var>n</var> =</em> <strong>nextpow2</strong> <em>(<var>x</var>)</em></dt>
<dd><p>Compute the exponent for the smallest power of two larger than the input.
</p>
<p>For each element in the input array <var>x</var>, return the first integer
<var>n</var> such that
2^n &ge; abs (x).
</p>

<p><strong>See also:</strong> <a href="#XREFpow2">pow2</a>, <a href="#XREFlog2">log2</a>.
</p></dd></dl>


<span id="XREFrealpow"></span><dl>
<dt id="index-realpow">: <em></em> <strong>realpow</strong> <em>(<var>x</var>, <var>y</var>)</em></dt>
<dd><p>Compute the real-valued, element-by-element power operator.
</p>
<p>This is equivalent to <code><var>x</var>&nbsp;.^&nbsp;<var>y</var></code><!-- /@w -->, except that
<code>realpow</code> reports an error if any return value is complex.
</p>
<p><strong>See also:</strong> <a href="Arithmetic-Ops.html#XREFpower">power</a>, <a href="#XREFreallog">reallog</a>, <a href="#XREFrealsqrt">realsqrt</a>.
</p></dd></dl>


<span id="XREFsqrt"></span><dl>
<dt id="index-sqrt">: <em></em> <strong>sqrt</strong> <em>(<var>x</var>)</em></dt>
<dd><p>Compute the square root of each element of <var>x</var>.
</p>
<p>If <var>x</var> is negative, a complex result is returned.
</p>
<p>To compute the matrix square root, see <a href="Linear-Algebra.html">Linear Algebra</a>.
</p>
<p><strong>See also:</strong> <a href="#XREFrealsqrt">realsqrt</a>, <a href="#XREFnthroot">nthroot</a>.
</p></dd></dl>


<span id="XREFrealsqrt"></span><dl>
<dt id="index-realsqrt">: <em></em> <strong>realsqrt</strong> <em>(<var>x</var>)</em></dt>
<dd><p>Return the real-valued square root of each element of <var>x</var>.
</p>
<p>If any element results in a complex return value <code>realsqrt</code> aborts and
issues an error.
</p>
<p><strong>See also:</strong> <a href="#XREFsqrt">sqrt</a>, <a href="#XREFrealpow">realpow</a>, <a href="#XREFreallog">reallog</a>.
</p></dd></dl>


<span id="XREFcbrt"></span><dl>
<dt id="index-cbrt">: <em></em> <strong>cbrt</strong> <em>(<var>x</var>)</em></dt>
<dd><p>Compute the real cube root of each element of <var>x</var>.
</p>
<p>Unlike <code><var>x</var>^(1/3)</code>, the result will be negative if <var>x</var> is
negative.
</p>
<p><strong>See also:</strong> <a href="#XREFnthroot">nthroot</a>.
</p></dd></dl>


<span id="XREFnthroot"></span><dl>
<dt id="index-nthroot">: <em></em> <strong>nthroot</strong> <em>(<var>x</var>, <var>n</var>)</em></dt>
<dd>
<p>Compute the real (non-complex) <var>n</var>-th root of <var>x</var>.
</p>
<p><var>x</var> must have all real entries and <var>n</var> must be a scalar.
If <var>n</var> is an even integer and <var>x</var> has negative entries then
<code>nthroot</code> aborts and issues an error.
</p>
<p>Example:
</p>
<div class="example">
<pre class="example">nthroot (-1, 3)
&rArr; -1
(-1) ^ (1 / 3)
&rArr; 0.50000 - 0.86603i
</pre></div>

<p><strong>See also:</strong> <a href="#XREFrealsqrt">realsqrt</a>, <a href="#XREFsqrt">sqrt</a>, <a href="#XREFcbrt">cbrt</a>.
</p></dd></dl>


<hr>
<div class="header">
<p>
Next: <a href="Complex-Arithmetic.html" accesskey="n" rel="next">Complex Arithmetic</a>, Up: <a href="Arithmetic.html" accesskey="u" rel="up">Arithmetic</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>