Complex Math Script
Webb - all rights reserved - ©2004
Author - Charles Perry

Summary: Math functions for complex numbers (including conjugate and inverse).

Instructions: Includes math functions for complex numbers (x+jy). Assumes x is in stack position 1 and y is in stack position 2.  For two complex numbers, x1 in position 3, y1 in position 4, x2 in position 1 and y2 in position 2.

Includes inverse of complex number (inv z = 1/z), conjugate ( conj (x+jy) = (x-jy)) swap for swapping x2 y2 with x1 y1.

Also includes polar and rectangular conversion.  Assumes angle is in position 2 and magnitude in position 1.  The polar/rectangular conversion correctly handles cases where angles are 0, 90, 180, 270, and 360.  Polar conversion gives all positive angles (300 instead of -60 for example). CLRx clears both position 1 and 2 (x and y). All functions, with the exception of polar/rectangular conversion, assume number is in rectangular form.


"+" r4r3+r3r3+;
"-" r4r3-r3r3-;
"x" g4g2*g4g4*+r4r3*r4r4*-;


"CLRx" d1d1;