File: Complex-Arithmetic.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 (160 lines) | stat: -rw-r--r-- 6,444 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
<!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>Complex Arithmetic (GNU Octave (version 6.2.0))</title>

<meta name="description" content="Complex Arithmetic (GNU Octave (version 6.2.0))">
<meta name="keywords" content="Complex Arithmetic (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="Trigonometry.html" rel="next" title="Trigonometry">
<link href="Exponents-and-Logarithms.html" rel="prev" title="Exponents and Logarithms">
<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="Complex-Arithmetic"></span><div class="header">
<p>
Next: <a href="Trigonometry.html" accesskey="n" rel="next">Trigonometry</a>, Previous: <a href="Exponents-and-Logarithms.html" accesskey="p" rel="prev">Exponents and Logarithms</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="Complex-Arithmetic-1"></span><h3 class="section">17.2 Complex Arithmetic</h3>

<p>In the descriptions of the following functions,
<var>z</var> is the complex number <var>x</var> + <var>i</var><var>y</var>, where <var>i</var> is
defined as <code>sqrt (-1)</code>.
</p>
<span id="XREFabs"></span><dl>
<dt id="index-abs">: <em></em> <strong>abs</strong> <em>(<var>z</var>)</em></dt>
<dd><p>Compute the magnitude of <var>z</var>.
</p>
<p>The magnitude is defined as
|<var>z</var>| = <code>sqrt (x^2 + y^2)</code>.
</p>
<p>For example:
</p>
<div class="example">
<pre class="example">abs (3 + 4i)
     &rArr; 5
</pre></div>

<p><strong>See also:</strong> <a href="#XREFarg">arg</a>.
</p></dd></dl>


<span id="XREFarg"></span><dl>
<dt id="index-arg">: <em></em> <strong>arg</strong> <em>(<var>z</var>)</em></dt>
<dt id="index-angle">: <em></em> <strong>angle</strong> <em>(<var>z</var>)</em></dt>
<dd><p>Compute the argument, i.e., angle of <var>z</var>.
</p>
<p>This is defined as,
<var>theta</var> = <code>atan2 (<var>y</var>, <var>x</var>)</code>,
in radians.
</p>
<p>For example:
</p>
<div class="example">
<pre class="example">arg (3 + 4i)
     &rArr; 0.92730
</pre></div>

<p><strong>See also:</strong> <a href="#XREFabs">abs</a>.
</p></dd></dl>


<span id="XREFconj"></span><dl>
<dt id="index-conj">: <em></em> <strong>conj</strong> <em>(<var>z</var>)</em></dt>
<dd><p>Return the complex conjugate of <var>z</var>.
</p>
<p>The complex conjugate is defined as
<code>conj (<var>z</var>)</code> = <var>x</var> - <var>i</var><var>y</var>.
</p>
<p><strong>See also:</strong> <a href="#XREFreal">real</a>, <a href="#XREFimag">imag</a>.
</p></dd></dl>


<span id="XREFcplxpair"></span><dl>
<dt id="index-cplxpair">: <em></em> <strong>cplxpair</strong> <em>(<var>z</var>)</em></dt>
<dt id="index-cplxpair-1">: <em></em> <strong>cplxpair</strong> <em>(<var>z</var>, <var>tol</var>)</em></dt>
<dt id="index-cplxpair-2">: <em></em> <strong>cplxpair</strong> <em>(<var>z</var>, <var>tol</var>, <var>dim</var>)</em></dt>
<dd><p>Sort the numbers <var>z</var> into complex conjugate pairs ordered by increasing
real part.
</p>
<p>The negative imaginary complex numbers are placed first within each pair.
All real numbers (those with
<code>abs (imag (<var>z</var>)) / abs (<var>z</var>) &lt; <var>tol</var></code>) are placed after
the complex pairs.
</p>
<p><var>tol</var> is a weighting factor in the range [0, 1) which determines the
tolerance of the matching.  The default value is <code>100 * eps</code> and the
resulting tolerance for a given complex pair is
<code><var>tol</var> * abs (<var>z</var>(i)))</code>.
</p>
<p>By default the complex pairs are sorted along the first non-singleton
dimension of <var>z</var>.  If <var>dim</var> is specified, then the complex pairs are
sorted along this dimension.
</p>
<p>Signal an error if some complex numbers could not be paired.  Signal an
error if all complex numbers are not exact conjugates (to within <var>tol</var>).
Note that there is no defined order for pairs with identical real parts but
differing imaginary parts.
</p>
<div class="example">
<pre class="example">cplxpair (exp (2i*pi*[0:4]'/5)) == exp (2i*pi*[3; 2; 4; 1; 0]/5)
</pre></div>
</dd></dl>


<span id="XREFimag"></span><dl>
<dt id="index-imag">: <em></em> <strong>imag</strong> <em>(<var>z</var>)</em></dt>
<dd><p>Return the imaginary part of <var>z</var> as a real number.
</p>
<p><strong>See also:</strong> <a href="#XREFreal">real</a>, <a href="#XREFconj">conj</a>.
</p></dd></dl>


<span id="XREFreal"></span><dl>
<dt id="index-real">: <em></em> <strong>real</strong> <em>(<var>z</var>)</em></dt>
<dd><p>Return the real part of <var>z</var>.
</p>
<p><strong>See also:</strong> <a href="#XREFimag">imag</a>, <a href="#XREFconj">conj</a>.
</p></dd></dl>


<hr>
<div class="header">
<p>
Next: <a href="Trigonometry.html" accesskey="n" rel="next">Trigonometry</a>, Previous: <a href="Exponents-and-Logarithms.html" accesskey="p" rel="prev">Exponents and Logarithms</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>