<<<<<<<<<<<<<<<<<

complex(lymb) Math complex(lymb)

NAME

complex

SUPERCLASS

object

DESCRIPTION

Complex is used to perform arithmetic operations as well as mathematical functions on complex numbers in LYMB. Complex messages are parsed from left to right without precedence rules. Many operations change the number stored in the object. Any numeric arguments can be a floating point numbers or a strings. If a strings are given, they must parse as floating point numbers using C floating point syntax.

INSTANCE VARIABLES

complex is the array of two double precision elements representing real and imaginary parts of complex number.

MESSAGES

- argument Subtract argument from complex value. Argument list may have one or to elements. In the first case only real part is changed.

+ argument Add argument to complex value. Argument list may have one or to elements. In the first case only real part is changed.

* argument Multiply complex value by the argument. Argument list may have one or to elements. In the first case argument is extended by setting imaginary part to 0.

/ argument Divide complex value by the argument. Argument list may have one or to elements. In the first case argument is extended by setting imaginary part to 0.

= argument Set complex value. Argument list may have one or to elements. In the first case argument is extended by setting imaginary part to 0.

? Return complex value. Returns a pointer to complex data and number 2 as the size of array.

abs? Calculate and return absolute value of complex

number. The complex object's value is not changed.

arg? Calculate and return argument value of complex number, an angle between 0 and two pi. The complex object's value is not changed.

conj! Change the complex number to conjugate by reversing sign of imaginary part.

conj? Calculate and return conjugate of an instance complex number. The complex object's value is not changed.

i=,imag= argument Sets the imaginary part of complex number.

i?,imag? Returns the imaginary part of complex number.

r=,real= argument Sets the real part of complex number.

r?,real? Returns the real part of complex number.

EXAMPLE

complex new:c1 = (1,2); complex new:c2 = (2,3); complex new:c3 = (3,4); c3 * c2 / c1 + 10 * 123 print!;

SEE ALSO

vector, ivector, dvector, fvector, scalar


Please send comments and suggestions to
consult@rpi.edu