Andromeda blog

Top of blog

Complex numbers - 2 Jan 2020

Binary signals can be used to represent complex numbers as well as integers. Some caveats:

• We will work with complex numbers in magnitude-phase form rather than real-imaginary form. This is more natural for engineering applications, and is used extensively.

• All the complex numbers we use will be on or within the unit circle (have a magnitude ≤ 1.0). In general, collections of complex numbers are normalized so that the sum of their squared magnitudes is equal to 1. The phase of the complex number 0 is undefined. The phases of complex numbers > 0 go from 0 to 2 * pi = 6.283, clockwise around the origin, starting at the positive x axis.

• A complex number is represented as a repeated binary on/off pulse signal, where the on-time + off-time = period. The magnitude of the number is represented by the width of the on pulse, and the phase is represented by the offset (delay) of the up-stroke with respect to a reference timing signal (in this case, a short hardware trigger pulse repeated with the same period as the input). An all-on signal is out-of-range. The maximum signal (magnitude = 1.0) has an on pulse slightly shorter than the period, so that the off segment can be used to determine the phase. See the plots below for examples.

Complex numbers can also be represented by continuous signals as well.

Here is a composite plot of the inputs and outputs of the 2-threshold inverter to a range of complex numbers having magnitudes from 0 to 1 (down the plot) and phases from 0 to 0.9 * 2 * pi (across the plot). The hardware trigger is not shown, but occurs just before the left edge of each trace. Approximate values of the two thresholds are also shown in blue on the output traces:

(Click for larger image)

Note that:

1. All input values in the first row are = 0. Although the phase is undefined for these (or can be defined to be 0), 10 plots are shown just to fill out the composite image.

2. The output down each column shows the characteristic band-pass filter behavior of the 2-threshold inverter. Switching output is obtained only when the capacitor value spans the two thresholds (shown in blue). Pulses that are too short or too long produce no output (actually, as defined above, the output goes from out-of-range in the top three rows to 0 in the bottom two rows).

3. The greatest input magnitude, in the bottom row, is defined to be 1, and the others are scaled accordingly. However, these signals on the unit circle must have a short off segment so that their phase can be represented.

Below is a plot, in the complex plane, of the inputs (yellow) and outputs (green) shown above, for 10 repeats of each combination. At right is a 3d version showing one example of each input/output pair, in which the "pinwheel" structure of the outputs is clearer:

Here is a composite plot of the inputs and outputs for magnitudes by 0.02 (down and across the plot) and only two phases (0 and pi, every other plot):

(Click for larger image)

Note that for input magnitudes less than 0.24, the output is undefined (always 5 V), and for magnitudes greater than 0.86 it is zero. As the input magnitude increases, the output magnitude decreases.

Below is a plot of the inputs and outputs for these magnitudes along the two phases. Other phases are similar to these, but rotated accordingly:

If the 100 K resistor is replaced with 55 K, and the period is increased to 0.127 sec, the range of input numbers can be better used. In the plots below, for a radius along theta = 0.0, the output becomes defined at input magnitude = 0.11, and drops from 1.0 to 0.0 as the input increases to 1.0:

(Click for larger image)

Two other radii are plotted below for comparison, at theta = 1.0 and 2.0 radians:

Here are plots of the output magnitude and phase for 10 samples at each of the three radii shown above. The last plot shows the change in phase at each radius (output minus input). Presumably these values are the same for every radius around the origin:

The radial magnitude and delta phase can be used to construct surfaces representing this complex function. Here is the overall magnitude and phase within the unit circle:

Note that the magnitude goes to zero as the function approaches the unit circle. In these cases, the phase also becomes undefined, whereas it has a well-defined value just inside the circle. The unit circle is therefore a "circular singularity" in this function. The function is also undefined near the origin, although the phase remains well-defined. A continuation of the function toward the origin (by changing the resistor-capacitor values of the circuit) would be bounded, but there would continue to be a "hole" at the origin, since the device response to zero input is out-of-range (always +5 V).

Just for completeness, here are the real and imaginary parts of this function. Red is positive (max = 1.0), blue is negative (min = -1.0). Note that the imaginary part is a +pi/2 rotated version of the real part. This must be true near the "hole", since the magnitude there is always ≥1, and on every circle around the origin, since the magnitude is constant at a given radius, whereas the real and imaginry parts vary with phase:

This is a "valid" complex function only if it satisfies the Cauchy-Riemann equations. Here are plots of the x and y derivatives of the real and imaginary parts of this function (clipped at +/-4.0):

(Click for larger image)

In the right column, the difference du/dx - dv/dy and the sum dv/dx + du/dy should be zero for a holomorphic function. As they are not, this function does not satisfy the Cauchy-Riemann equations. This can also be immediately determined because the function has a nodal loop: it is zero everywhere on the unit circle. Therefore, by Cauchy's integral formula, the value of every point within the unit circle should also be zero. Note however, that if the derivatives dv/dy and du/dy are first rotated by +pi/2 or -pi/2 (multiplied or divided by i), then the difference and sum terms do become zero. As it is now, each of these terms have zeros where the other has extrema, and the sum of their absolute values never goes to zero (minimum of 1.429). Nevertheless, it is interesting to note that this function most approaches being holomorphic along discrete spiral contours:

Next: Sparse signals.

29 January 2020