The ComplexArithmetic.lng Model

Complex arithmetic in LINGO

View the model
Download the model

LINGO uses only real numbers.
Thus, if you wish to work with complex numbers, you must represent each complex number by a pair of real numbers. If we denote the square root of -1 by i,
we write a complex number Z = XR + i*XI.
For some applications, e.g., electrical, it is useful to use polar coordinates,
(XR + i*XI) = R*( COS( THETA) + i*SIN( THETA))
= R*EXP(i*THETA), (using Euler's Formula),
where R = (XR*XR + XI*XI)^0.5, and THETA = ATAN(XI/XR) =
angle in radians whose tangent is XI/XR.
Below are code fragments for how to compute the real and imaginary parts resulting from various math operators;

Keywords:

Complex Number | Imaginary Number |