Libraries
Complex Source Code
 previous   up   next 

Types
complex
Complex numbers represented with float real part and imaginary part.

complex

const type: complex

Complex numbers represented with float real part and imaginary part. Complex literals do not exist.


Operator Summary
complex
(attr complex) conv (in integer: re)
Convert an integer to a complex.
complex
(attr complex) conv (in float: re)
Conversion a float to a complex.
boolean
(ref complex: number1) = (ref complex: number2)
Check if two complex numbers are equal.
boolean
(ref complex: number1) <> (ref complex: number2)
Check if two complex numbers are not equal.
complex
+ (in complex: number)
Plus sign for complex numbers.
complex
- (in complex: number)
Minus sign, negate a complex number.
complex
conj (in complex: number)
Compute the conjugated value of a complex number.
complex
(in complex: summand1) + (in complex: summand2)
Add two complex numbers.
complex
(in complex: minuend) - (in complex: subtrahend)
Compute the subtraction of two complex numbers.
complex
(in complex: factor1) * (in complex: factor2)
Multiply two complex numbers.
complex
(in complex: dividend) / (in complex: divisor)
Copmpute the division of two complex numbers.
void
(inout complex: number) +:= (in complex: delta)
Increment a complex number by a delta.
void
(inout complex: number) -:= (in complex: delta)
Decrement a complex number by a delta.
void
(inout complex: number) *:= (in complex: factor)
Multiply a complex number by a factor and assign the result back to number.
void
(inout complex: number) /:= (in complex: divisor)
Divide a complex number by a divisor and assign the result back to number.
complex
(in complex: base) ** (in integer: exponent)
Compute the exponentiation of a complex base with an integer exponent.
complex
(attr complex) parse (in string: stri)
Convert a string to a complex number.
string
(in complex: number) digits (in integer: precision)
Convert a complex to a string in decimal fixed point notation.
string
(in complex: number) sci (in integer: precision)
Convert a complex to a string in scientific notation.

Function Summary
complex
complex (in float: re, in float: im)
Create a complex number from its real and imaginary part.
complex
complex (in float: re)
Create a complex number from its real part.
complex
polar (in float: magnitude, in float: angle)
Create a complex number from polar coordinates.
complex
complex (in integer: re)
Convert an integer to a complex.
float
abs (in complex: number)
Compute the absolute value of a complex number.
float
sqrAbs (in complex: number)
Compute the square of the absolute value of a complex number.
float
arg (in complex: number)
Compute the argument of a complex number.
integer
compare (in complex: number1, in complex: number2)
Compare two complex numbers in lexicographic order.
integer
hashCode (in complex: num)
Compute the hash value of a complex number.
string
str (in complex: number)
Convert a complex number to a string.
complex
complex (in string: stri)
Convert a string to a complex number.

Operator Detail

conv

const func complex: (attr complex) conv (in integer: re)

Convert an integer to a complex.

Returns:
the result of the conversion.

conv

const func complex: (attr complex) conv (in float: re)

Conversion a float to a complex.

Returns:
the result of the conversion.

=

const func boolean: (ref complex: number1) = (ref complex: number2)

Check if two complex numbers are equal.

Returns:
TRUE if both numbers are equal, FALSE otherwise.

<>

const func boolean: (ref complex: number1) <> (ref complex: number2)

Check if two complex numbers are not equal.

Returns:
FALSE if both numbers are equal, TRUE otherwise.

+

const func complex: + (in complex: number)

Plus sign for complex numbers.

Returns:
its operand unchanged.

-

const func complex: - (in complex: number)

Minus sign, negate a complex number.

Returns:
the negated value of the number.

conj

const func complex: conj (in complex: number)

Compute the conjugated value of a complex number.

Returns:
the complex conjugate of the number.

+

const func complex: (in complex: summand1) + (in complex: summand2)

Add two complex numbers.

Returns:
the sum of the two numbers.

-

const func complex: (in complex: minuend) - (in complex: subtrahend)

Compute the subtraction of two complex numbers.

Returns:
the difference of the two numbers.

*

const func complex: (in complex: factor1) * (in complex: factor2)

Multiply two complex numbers.

Returns:
the product of the two numbers.

/

const func complex: (in complex: dividend) / (in complex: divisor)

Copmpute the division of two complex numbers.

Returns:
the quotient of the division.

+:=

const proc: (inout complex: number) +:= (in complex: delta)

Increment a complex number by a delta.


-:=

const proc: (inout complex: number) -:= (in complex: delta)

Decrement a complex number by a delta.


*:=

const proc: (inout complex: number) *:= (in complex: factor)

Multiply a complex number by a factor and assign the result back to number.


/:=

const proc: (inout complex: number) /:= (in complex: divisor)

Divide a complex number by a divisor and assign the result back to number.


**

const func complex: (in complex: base) ** (in integer: exponent)

Compute the exponentiation of a complex base with an integer exponent.

Returns:
the result of the exponentiation.

parse

const func complex: (attr complex) parse (in string: stri)

Convert a string to a complex number. The string must contain real and imaginary part (e.g.: "1.5-2.8i"). Real and imaginary part must be separated with a + or - sign.

Returns:
the complex result of the conversion.
Raises:
RANGE_ERROR - If stri contains not a valid complex value.

digits

const func string: (in complex: number) digits (in integer: precision)

Convert a complex to a string in decimal fixed point notation. The number is converted to a string with real and imaginary part (e.g.: "1.5-2.8i"). Real and imaginary part are separated with a + or - sign. The precision parameter specifies the number of digits after the decimal point of the real and imaginary part. If the precision is zero the decimal point is omitted.

complex(3.1415) digits 2   returns "3.14+0.00i"
Returns:
the string result of the conversion.
Raises:
RANGE_ERROR - If the precision is negative.
MEMORY_ERROR - Not enough memory to represent the result.

sci

const func string: (in complex: number) sci (in integer: precision)

Convert a complex to a string in scientific notation. The number is converted to a string with real and imaginary part (e.g.: "1.5e+2-2.8e+0i"). Real and imaginary part are separated with a + or - sign. The precision parameter specifies the number of digits after the decimal point of the real and imaginary part. If the precision is zero the decimal point is omitted.

complex(31415.9, 27182.8) sci 4   returns "3.1416e+4+2.7183e+4i"
Returns:
the string result of the conversion.
Raises:
RANGE_ERROR - If the precision is negative.
MEMORY_ERROR - Not enough memory to represent the result.

Function Detail

complex

const func complex: complex (in float: re, in float: im)

Create a complex number from its real and imaginary part.

Returns:
the created complex number.

complex

const func complex: complex (in float: re)

Create a complex number from its real part.

Returns:
the created complex number.

polar

const func complex: polar (in float: magnitude, in float: angle)

Create a complex number from polar coordinates.

Returns:
the created complex number.

complex

const func complex: complex (in integer: re)

Convert an integer to a complex.

Returns:
the result of the conversion.

abs

const func float: abs (in complex: number)

Compute the absolute value of a complex number.

Returns:
the absolute value.

sqrAbs

const func float: sqrAbs (in complex: number)

Compute the square of the absolute value of a complex number.

Returns:
the square of the absolute value.

arg

const func float: arg (in complex: number)

Compute the argument of a complex number. This is the angle of the polar form of the complex number.

Returns:
the argument of the complex number.

compare

const func integer: compare (in complex: number1, in complex: number2)

Compare two complex numbers in lexicographic order.

Returns:
-1, 0 or 1 if the first argument is considered to be respectively less than, equal to, or greater than the second.

hashCode

const func integer: hashCode (in complex: num)

Compute the hash value of a complex number.

Returns:
the hash value.

str

const func string: str (in complex: number)

Convert a complex number to a string. The number is converted to a string with real and imaginary part (e.g.: "1.5-2.8i"). Real and imaginary part are separated with a + or - sign.

Returns:
the string result of the conversion.
Raises:
MEMORY_ERROR - Not enough memory to represent the result.

complex

const func complex: complex (in string: stri)

Convert a string to a complex number. The string must contain real and imaginary part (e.g.: "1.5-2.8i"). Real and imaginary part must be separated with a + or - sign.

Returns:
the complex result of the conversion.
Raises:
RANGE_ERROR - If stri contains not a valid complex value.


 previous   up   next