const
{$IFDEF PAIDVERS}
SDLVersionInfo = 'complex_r1210_full';
IsLightEd = false;
{$ELSE}
SDLVersionInfo = 'complex_r1210_lighted';
IsLightEd = true;
{$ENDIF}
Release = 1210;
type
ESDLComplexError = class(ESDLError); { exception type to indicate errors }
TComplex = record // z = re + i * im
re : extended;
im : extended;
end;
TComplexPolar = record // z = r*(cos(phi)+i*sin(phi))
r : extended; // phi = -Pi .... +Pi
phi : extended;
end;
const
COMPLEX_0 : TComplex = (re:0; im:0);
COMPLEX_1 : TComplex = (re:1; im:0);
var
CpxNearZero : extended; { smallest non-zero positive number }
function ConvertRectToPolar
(const z : TComplex) { rectangular form of complex number }
: TComplexPolar; { polar form }
function ConvertPolarToRect
(const z : TComplexPolar) { polar form of complex number }
: TComplex; { rectangular form }
function Cpx
(const real, imag : extended) { real and imag. part of complex number }
: TComplex; { complex number }
function CpxAbs
(const z: TComplex) { complex number }
: extended; { absolute value of z }
function CpxAbsSqr
(const z: TComplex) { complex number }
: extended; { square of absolute value of z }
function CpxAdd
(const z1, z2 : TComplex) { complex numbers to add z1+z2 }
: TComplex; { complex sum }
function CpxConj
(const z: TComplex) { complex number }
: TComplex; { complex conjugate value z* }
function CpxDiv
(const z1, z2 : TComplex) { complex numbers to divide z1/z2 }
: TComplex; { complex quotient }
function CpxIsEqual
(z1, z2 : TComplex) { complex numbers to compare }
: boolean; { TRUE if equal }
function CpxIsNearEqual
(z1, z2 : TComplex) { complex numbers to compare }
: boolean; { TRUE if nearly equal }
function CpxIsZero
(z : TComplex) { complex number test for 0 }
: boolean; { TRUE if zero }
function CpxMult
(const z1, z2 : TComplex) { complex numbers to multiply z1*z2 }
: TComplex; { complex product }
function CpxNeg
(const z: TComplex) { complex number }
: TComplex; { negative complex number -z }
function CpxSub
(const z1, z2 : TComplex) { complex numbers to subtract z1-z2 }
: TComplex; { complex difference }
|