Class representing a complex number.

Methods:

toString()

Generates a string representation of the complex number contained in the object.

Return value

string String representation of the complex number.

equals(teComplex/float num)

Checks whether the complex number equals to the passed argument.

Arguments

teComplex/float num : Number that the original complex number tested against.

Return value

bool Returns true if the original and the passed number are equal, false if they aren't equal.

abs()

Returns the absolute value (modulus, magnitude) of the complex number, or in other words the length of the vector representing the complex number on the complex plane. Thus the returned value is one of the components of the polar form.

Return value

teComplex The absolute value of the complex number.

arg()

Returns the argument (phase) of the complex number, or in other words the angle of the vector - representing the complex number - with the positive real axis on the complex plane. Thus the returned value is one of the components of the polar form.

Return value

teComplex The argument of the complex number.

neg()

Returns the negative (additive inverse, opposite) of the complex number by negating both the real and the imaginary component.

Return value

teComplex The negative of the complex number.

conj()

Returns the conjugate of the complex number by negating only the imaginary component.

Return value

teComplex The conjugate of the complex number.

inverse()

Returns the inverse (multiplicative inverse, resciprocal) of the complex number by raising it to minus first power.

Return value

teComplex The inverse of the complex number.

Notes

The complex number should be nonzero, or a 'Division by zero while inverting zero' exception is thrown.

add(teComplex/float num)

Calculates the sum of the original complex number and the passed argument.

Arguments

teComplex/float num : Second term of addition, which can be both complex and real number.

Return value

teComplex The sum of the original number and the num argument.

sub(teComplex/float num)

Subtracts the passed argument from the original complex number.

Arguments

teComplex/float num : The subtrahend, which can be both complex and real number.

Return value

teComplex The difference between the original number and the num argument.

mul(teComplex/float num)

Multiplies the original complex number by the passed argument.

Arguments

teComplex/float num : The multiplier, which can be both complex and real number.

Return value

teComplex The product of the original number and the num argument.

div(teComplex/float num)

Divides the original complex number with the passed argument.

Arguments

teComplex/float num : The divisor (denominator), which can be both complex and real number.

Return value

teComplex The quotient of the original number and the num argument.

Notes

The passed number should be nonzero, or a 'Division by zero' exception is thrown.

pow(teComplex/float num)

Exponentiation. Raises the original complex number to the specified power.

Arguments

teComplex/float num : The exponent, which can be both complex and real number.

Return value

teComplex The original number as base raised to the power of the num argument.

Notes

If the exponent is a fraction the principal root is returned.

sqrt()

Calculates the square root of the original complex number.

Return value

teComplex The square root of the original number.