Complex Numbers
new to Analytica 4.5
Typing complex literals
A complex number has a real part and an imaginary part and is written as, e.g., 3.4 + 2.3j, where 3.4 is the real part and 2.3 is the imaginary part. If there is no imaginary part, then it is a real number.
To type the imaginary part, append a lower case i or lower case j to the number. For example, 1i
or 1j
is the square root of -1. You must have a digit before the i or j, so you can't type just i -- that would refer to a variable named i. You also cannot put a space between the numbers and the i or j. Numeric suffixes come before the i or j, so you would write 3.4Kj
, 1.2mj
or 1.2e-3j
.
If you have a variable, x, that holds a complex number, and you want to use its value for the imaginary part, it does not work to type xj
-- that would refer to a variable named xj. You need to type x * 1j
.
Complex numbers display in result tables as the real part plus or minus the complex part, and using a small j after the complex part, e.g., -5 - 3j, 7.2 + 0.1j. The real and complex parts each use the prevailing number format.
When complex numbers appear on graphs, the real part is graphed. See #Graphing below.
Precision and range
The real and imaginary parts of a complex number each have approximately 7 decimal digits of precision and can range from -3.4e+38 to 3.4e+38 and as small as 3.4e-38. This is less precision than is used for a real number in Analytica, which has roughly 15 decimal digits of precision and a range from -1.7e+308 to 1.7e+308, and down to 1.7e-308. One complex number takes up the same amount of memory as one real number (the complex number stores two 32-bit floats, whereas the a real number stores one 64-bit float).
Accessing the parts of a complex number
Arithmetic operations
Enabling complex numbers
Graphing
See Also
Accessing the parts of a complex number:
Non-matrix functions that compute or return complex numbers:
Matrix functions that handle complex matrices:
Enable comment auto-refresher