Complex numbers in MoI and nodeeditor.
Complex number "w" = "C" = a + b*i, where a and b are real numbers.
Here, i = the square root of -1. So b*i is an imaginary number. Math.pow(i,2) = -1.
There are specific mathematical rules for complex number arithmetic.
Addition and Subtraction.
Multiplication.
Reciprocal for negative exponents.
Conjugation.
Rotation.
The complex numbers have similarities to vectors, and some differences...
A complex number may be represented in several ways, in nodeeditor and MoI.
For display purposes:
The complex number "w" may be treated as a point "C" in the MoI TopView, with the TopView plane considered to be an Argand plane.
The x_coordinate represents the real component, and the y_coordinate represents the imaginary component without showing i = sqrt(-1).
(The z value of C is absent or ignored.) In this case, C is a point object, a one member objectlist, gold color pip in nodeeditor.
For calculation purposes:
A complex number point ptC may be represented as an Element in a nodeeditor pointarray, a pink color pip in nodeeditor.
PointarrayC = [ptC, ptC1, ...]. The pointarray may have one or more points. Let the zero-ith point be ptC.
ptC = PointarrayC.getElement(0);
ptC = (x, y) = (ptC.data[0], ptC.data[1];
For math purposes, x and y elements may be extracted with the Extract node, or Javascript code from the Extract node.
For calculation purposes, the rules of complex number math must be followed.
For easier calculation purposes, a "duo_numarray", a numarray with only two entries, the x and y values, may be extracted from one point in a pointarray.
For more calculation purposes:
A complex number may also be represented in polar coordinates, as modulus (origin distance = hypotenuse(x,y)) and argument (angle in radians).
Pointarray C = [ mod_C * cos(arg_C), mod_C * sin(arg_C) ]
The modulus of C may be calculated from coordinates (x,y). mod_C = math.sqrt(x*x + y*y).
For Doyle spirals, the circles or spheres are calculated from master complex numbers "A" and "B", and masterRadius = "r".
The complex number centerpoints of circles = Math.pow( A, j ) * Math.pow( B, k ), for ranges of j's and k's.
The radius of a circle "D" = modulus_D * masterRadius.
mod_A and arg_A must be solved for, for given integers "p" and "q". The rest of the complex number centerpoints and radii are obtained by calculation.
It all sounds easy, but has been confusing. And confusing to implement. A node is getting close:-)
|