immutable class CPXD < $CPX_NUMBER{FLTD,CPXD},$FMT


Ancestors
$FMT $CPX_NUMBER{_,_} $NFE{_} $IS_EQ
$STR $NIL $IS_NIL CPX{_}



Public


Readable Attributes
attr re,im:T; .. Included as im
**** Real and imaginary parts.
attr re,im:T; .. Included as re
**** Real and imaginary parts.

Writable Attributes
attr re,im:T; .. Included as im
**** Real and imaginary parts.
attr re,im:T; .. Included as re
**** Real and imaginary parts.

Features
abs: SAME .. Included as abs
**** For conformance with $NFE
abs_squared:T .. Included as abs_squared
**** The square of the absolute magnitude of self.
absolute:T .. Included as absolute
**** The absolute magnitude of self. Cannot overload abs From Numerical Recipes in C, 2nd ed. p. 949.
acos:SAME .. Included as acos
**** -i log(z + sqrt(1-z^2)) better to use: (pi/2)-asin(z) Steele p. 305.***
acosh:SAME .. Included as acosh
**** log(z+(z+1)sqrt((z-1)/(z+1))) Steele p. 308***
asin:SAME .. Included as asin
**** -i log(iz + sqrt(1-z^2)) Steele p. 305.***
asinh:SAME .. Included as asinh
**** log(z+sqrt(1+z^2)) Steele p. 308***
atan:SAME .. Included as atan
**** (log(1+i*y)-log(1-i*y))/(2*i) Steele p. 307.***
atanh:SAME .. Included as atanh
**** log((1+z)sqrt(1/(1-z^2))) Steele p. 308***
cis(f:T):SAME .. Included as cis
**** Ignores self, e^i*f=cos f + i sin f . Steele p. 304.
conjugate:SAME .. Included as conjugate
**** The complex conjugate of self.
cos:SAME .. Included as cos
cosh:SAME .. Included as cosh
**** (e^z+e^(-z))/2 Steele p. 308***
create(f: FLT): SAME .. Included as create
create(f: FLTD): SAME .. Included as create
create(re,im:T):SAME .. Included as create
**** A complex number with real part `re' and imaginary part `im'.
create(i: INT): SAME .. Included as create
create_from_polar(mag,phase:T):SAME .. Included as create_from_polar
**** A complex number with magnitude `mag' and phase `phase'.
create_real(x:T):SAME .. Included as create_real
cube:SAME .. Included as cube
**** Self cubed
cube_root:SAME .. Included as cube_root
**** The cube root of self. preliminary, but working.
div(c:SAME):SAME .. Included as div
**** The ratio of self and `c'. From Numerical Recipes in C, 2nd ed. p. 949.
div(f:T):SAME .. Included as div
**** Self div the floating point f.
exp:SAME .. Included as exp
**** The complex exponential `e^self'.
fmt( fmt: STR ): STR
is_eq(c: SAME): BOOL .. Included as is_eq
**** Return true if the two numbers are equal
is_eq(arg: $OB): BOOL .. Included as is_eq
**** Overloaded version of the is_eq routine that works with an argument of any type. If the type of the 'arg' is not the same as they type of 'self' then return false. Otherwise, deletegate to the 'real' is_eq(SAME):BOOL routine
is_nil:BOOL .. Included as is_nil
**** Return true if self is nil
is_within(r:T,c:SAME):BOOL .. Included as is_within
**** self is within a circle around c with radius r
log:SAME .. Included as log
**** The complex logarithm. The chosen branch is `log |z| + i phase(z)'. Same convention as Steele, p. 302.
magnitude:T .. Included as magnitude
**** The absolute magnitude of self.
magnitude_squared:T .. Included as magnitude_squared
**** The square of the absolute magnitude of self.
maxval: SAME .. Included as maxval
**** Maximum values of real and imaginary part
minus(c:SAME):SAME .. Included as minus
**** The difference of self and `c'.
negate:SAME .. Included as negate
**** The additive inverse of self.
nil:SAME .. Included as nil
**** Return a nil valued complex number with real and imaginary parts both nil
one: SAME .. Included as one
**** A unit value (real part=1, imaginary part=0)
phase:T .. Included as phase
**** The angle part of the polar represenation of self. `-pi < res <= pi'. Also get "-pi" from a negative real part and a "-0.0" imaginary part. They say 0+0i should be +0, 0-0i should be -0, -0+0i should be +pi, and -0-0i should be -pi. Same convention as Steele, p. 303.
plus(c:SAME):SAME .. Included as plus
**** The sum of self and `c'.
pow(c:SAME):SAME .. Included as pow
**** self^c = exp(c*log(self))
reciprocal:SAME .. Included as reciprocal
**** The multiplicative inverse of self.
sign:SAME .. Included as sign
**** If not zero, a number with same phase as self but unit magnitude. If it is, then returns self. Steele, p. 304***
sin:SAME .. Included as sin
sinh:SAME .. Included as sinh
**** (e^z-e^(-z))/2 Steele p. 308***
sqrt:SAME .. Included as sqrt
**** The square root of self. From Numerical Recipes in C, 2nd ed. p. 949. Steele, p. 302 chooses the branch cut by `e^((log z)/2)'
square:SAME .. Included as square
**** Self squared
str:STR .. Included as str
**** A string representation of self of the form "1.02+3.23i".
tan:SAME .. Included as tan
tanh:SAME .. Included as tanh
**** (e^z-e^(-z))/(e^z+e^(-z)) Steele p. 308***
times(c:SAME):SAME .. Included as times
**** The product of self and `c'.
times(f:T):SAME .. Included as times
**** Self times the floating point c.
zero: SAME .. Included as zero
**** A zero valued complex number

The Sather Home Page