Complex

A complex number.

Example

    -- Create a complex number

c1 = pf.Complex(3,4)

    -- Determine magnitude and phase of the complex number

mag = c1:Magnitude()
phase = c1:Phase()

    -- Some of the valid operators for 'Complex'

c2 = 2 + j*1
c3 = c1 * 2
c4 = c1 / 2
c5 = c1 - c2
c6 = c1 + c2
c7 = c1 * c2
c8 = c1.re * c2.re

Usage locations

The Complex object can be accessed from the following locations:

Property List

Type
The object type string. (Read only string)
im
The imaginary value of the complex number. (Read/Write number)
re
The real value of the complex number. (Read/Write number)

Method List

Abs ()
Returns the absolute value of the complex value. Same as the magnitude. (Returns a number object.)
Angle ()
Returns the angle of the complex value in radians. Same as the phase. (Returns a number object.)
Conj ()
Returns the complex conjugate of the complex value. (Returns a Complex object.)
Conjugate ()
Returns the complex conjugate of the complex value. (Returns a Complex object.)
Imag ()
Returns the imaginary component of the complex value. (Returns a number object.)
IsInfinite ()
Returns true if either the real or imaginary part is infinite, returns false if both parts are finite. (Returns a boolean object.)
IsNotANumber ()
Returns true if either the real or imaginary part is not a number, returns false if both parts are valid. (Returns a boolean object.)
Magnitude ()
Returns the magnitude of the complex value. (Returns a number object.)
Phase ()
Returns the phase of the complex value in radians. (Returns a number object.)
Real ()
Returns the real component of the complex value. (Returns a number object.)

Constructor Function List

New (real number, imag number)
Creates a new complex. (Returns a Complex object.)
New (real number)
Creates a new complex. (Returns a Complex object.)
New ()
Creates a new complex. (Returns a Complex object.)

Static Function List

Abs (real number)
Calculates the absolute value of the complex value. (Returns a number object.)
Abs (complex Complex)
Calculates the absolute value of the complex value. (Returns a number object.)
Acos (complex Complex)
Calculates arc cosine of a complex value. (Returns a Complex object.)
Angle (real number)
Returns the angle of the complex value in radians. (Returns a number object.)
Angle (complex Complex)
Returns the angle of the complex value in radians. (Returns a number object.)
Asin (complex Complex)
Calculates arc sine of a complex value. (Returns a Complex object.)
Atan (complex Complex)
Calculates arc tan of a complex value. (Returns a Complex object.)
Ceil (complex Complex)
Calculates the ceiling of each component of a complex value. (Returns a Complex object.)
Conj (real number)
Returns the complex conjugate of the complex value. (Returns a Complex object.)
Conj (complex Complex)
Returns the complex conjugate of the complex value. (Returns a Complex object.)
Conjugate (real number)
Calculates the complex conjugate of the complex value. (Returns a Complex object.)
Conjugate (complex Complex)
Calculates the complex conjugate of the complex value. (Returns a Complex object.)
Cos (complex Complex)
Calculates cosine of a complex value. (Returns a Complex object.)
Exponent (complex Complex)
Calculates exponent of a complex value. (Returns a Complex object.)
Floor (complex Complex)
Calculates the floor of each component a complex value. (Returns a Complex object.)
Imag (complex number)
Returns the imaginary component of the complex value. (Returns a number object.)
Imag (complex Complex)
Returns the imaginary component of the complex value. (Returns a number object.)
IsEqual (param complex1 Complex, param complex2 Complex)
Compares two complex numbers. (Returns a boolean object.)
IsEqual (param complex Complex, param value number)
Compares a complex number with a real number. (Returns a boolean object.)
IsInfinite (complex Complex)
Returns true if either the real or imaginary part is infinite, returns false if both parts are finite. (Returns a boolean object.)
IsNotANumber (complex Complex)
Returns true if either the real or imaginary part is not a number, returns false if both parts are valid. (Returns a boolean object.)
Log (complex Complex)
Calculates the log of a complex value. (Returns a Complex object.)
Log10 (complex Complex)
Calculates the log10 of a the complex value. (Returns a Complex object.)
Magnitude (real number)
Calculates the magnitude of the complex value. (Returns a number object.)
Magnitude (complex Complex)
Calculates the magnitude of the complex value. (Returns a number object.)
Phase (real number)
Calculates the phase of the complex value in radians. (Returns a number object.)
Phase (complex Complex)
Calculates the phase of the complex value in radians. (Returns a number object.)
Power (complex Complex, complex Complex)
Calculates the power of a the complex value with a complex exponent. (Returns a Complex object.)
Power (complex Complex, value number)
Calculates the power of a complex value with a real exponent. (Returns a Complex object.)
Real (real number)
Returns the real component of the complex value. (Returns a number object.)
Real (complex Complex)
Returns the real component of the complex value. (Returns a number object.)
Sin (complex Complex)
Calculates the sine value of the complex value. (Returns a Complex object.)
Sqrt (complex Complex)
Calculates the square root value of the complex value. (Returns a Complex object.)
Tan (complex Complex)
Calculates the tan value of the complex value. (Returns a Complex object.)

Index List

[number]
Index a component of the complex value.The real component has index 1 and the complex component index 2. (Read number)
[number]
Index a component of the complex value.The real component has index 1 and the complex component index 2. (Write number)

Property Details

Type
The object type string.
Type
string
Access
Read only
im
The imaginary value of the complex number.
Type
number
Access
Read/Write
re
The real value of the complex number.
Type
number
Access
Read/Write

Method Details

Abs ()
Returns the absolute value of the complex value. Same as the magnitude.
Return
number
The absolute value of the complex value.
Angle ()
Returns the angle of the complex value in radians. Same as the phase.
Return
number
The angle of the complex value.
Conj ()
Returns the complex conjugate of the complex value.
Return
Complex
The complex conjugate of the complex value.
Conjugate ()
Returns the complex conjugate of the complex value.
Return
Complex
The complex conjugate of the complex value.
Imag ()
Returns the imaginary component of the complex value.
Return
number
The imaginary component of the complex value.
IsInfinite ()
Returns true if either the real or imaginary part is infinite, returns false if both parts are finite.
Return
boolean
True if either part is Inf.
IsNotANumber ()
Returns true if either the real or imaginary part is not a number, returns false if both parts are valid.
Return
boolean
True if either part is NaN.
Magnitude ()
Returns the magnitude of the complex value.
Return
number
The magnitude of the complex value.
Phase ()
Returns the phase of the complex value in radians.
Return
number
The phase of the complex value.
Real ()
Returns the real component of the complex value.
Return
number
The real component of the complex value.

Static Function Details

Abs (real number)
Calculates the absolute value of the complex value.
Input Parameters
real(number)
The real part of a complex number.
Return
number
The result complex value.
Abs (complex Complex)
Calculates the absolute value of the complex value.
Input Parameters
complex(Complex)
A complex number.
Return
number
The result complex value.
Acos (complex Complex)
Calculates arc cosine of a complex value.
Input Parameters
complex(Complex)
A complex number.
Return
Complex
The result complex value.
Angle (real number)
Returns the angle of the complex value in radians.
Input Parameters
real(number)
The real part of a complex number.
Return
number
The result complex value.
Angle (complex Complex)
Returns the angle of the complex value in radians.
Input Parameters
complex(Complex)
A complex number.
Return
number
The result complex value.
Asin (complex Complex)
Calculates arc sine of a complex value.
Input Parameters
complex(Complex)
A complex number.
Return
Complex
The result complex value.
Atan (complex Complex)
Calculates arc tan of a complex value.
Input Parameters
complex(Complex)
Complex number.
Return
Complex
The result complex value.
Ceil (complex Complex)
Calculates the ceiling of each component of a complex value.
Input Parameters
complex(Complex)
A complex number.
Return
Complex
The result complex value.
Conj (real number)
Returns the complex conjugate of the complex value.
Input Parameters
real(number)
The real part of a complex number.
Return
Complex
The complex conjugate of the complex value.
Conj (complex Complex)
Returns the complex conjugate of the complex value.
Input Parameters
complex(Complex)
A complex number.
Return
Complex
The complex conjugate of the complex value.
Conjugate (real number)
Calculates the complex conjugate of the complex value.
Input Parameters
real(number)
The real part of a complex number.
Return
Complex
The result complex value.
Conjugate (complex Complex)
Calculates the complex conjugate of the complex value.
Input Parameters
complex(Complex)
A complex number.
Return
Complex
The result complex value.
Cos (complex Complex)
Calculates cosine of a complex value.
Input Parameters
complex(Complex)
A complex number.
Return
Complex
The result complex value.
Exponent (complex Complex)
Calculates exponent of a complex value.
Input Parameters
complex(Complex)
A complex number.
Return
Complex
The result complex value.
Floor (complex Complex)
Calculates the floor of each component a complex value.
Input Parameters
complex(Complex)
A complex number.
Return
Complex
The result complex value.
Imag (complex number)
Returns the imaginary component of the complex value.
Input Parameters
complex(number)
The real part of a complex number.
Return
number
The result complex value.
Imag (complex Complex)
Returns the imaginary component of the complex value.
Input Parameters
complex(Complex)
A complex number.
Return
number
The result complex value.
IsEqual (param complex1 Complex, param complex2 Complex)
Compares two complex numbers.
Input Parameters
param complex1(Complex)
The first complex number.
param complex2(Complex)
The second complex number.
Return
boolean
True if the two complex numbers are equal, else false.
IsEqual (param complex Complex, param value number)
Compares a complex number with a real number.
Input Parameters
param complex(Complex)
A complex number.
param value(number)
A value to compare to.
Return
boolean
True if the complex number only has a real component which is equal to the parameter, else false.
IsInfinite (complex Complex)
Returns true if either the real or imaginary part is infinite, returns false if both parts are finite.
Input Parameters
complex(Complex)
A complex number.
Return
boolean
True if either part is Inf.
IsNotANumber (complex Complex)
Returns true if either the real or imaginary part is not a number, returns false if both parts are valid.
Input Parameters
complex(Complex)
A complex number.
Return
boolean
True if either part is NaN.
Log (complex Complex)
Calculates the log of a complex value.
Input Parameters
complex(Complex)
A complex number.
Return
Complex
The result complex value.
Log10 (complex Complex)
Calculates the log10 of a the complex value.
Input Parameters
complex(Complex)
A complex number.
Return
Complex
The result complex value.
Magnitude (real number)
Calculates the magnitude of the complex value.
Input Parameters
real(number)
The real part of a complex number.
Return
number
The result complex value.
Magnitude (complex Complex)
Calculates the magnitude of the complex value.
Input Parameters
complex(Complex)
A complex number.
Return
number
The result complex value.
New (real number, imag number)
Creates a new complex.
Input Parameters
real(number)
The real component.
imag(number)
The imaginary component.
Return
Complex
The new complex.
New (real number)
Creates a new complex.
Input Parameters
real(number)
The real component.
Return
Complex
The new complex.
New ()
Creates a new complex.
Return
Complex
The new complex.
Phase (real number)
Calculates the phase of the complex value in radians.
Input Parameters
real(number)
The real part of a complex number.
Return
number
The result complex value.
Phase (complex Complex)
Calculates the phase of the complex value in radians.
Input Parameters
complex(Complex)
A complex number.
Return
number
The result complex value.
Power (complex Complex, complex Complex)
Calculates the power of a the complex value with a complex exponent.
Input Parameters
complex(Complex)
A complex number.
complex(Complex)
A complex exponent.
Return
Complex
The result complex value.
Power (complex Complex, value number)
Calculates the power of a complex value with a real exponent.
Input Parameters
complex(Complex)
A complex number.
value(number)
A real exponent number.
Return
Complex
The result complex value.
Real (real number)
Returns the real component of the complex value.
Input Parameters
real(number)
The real part of a complex number.
Return
number
The result complex value.
Real (complex Complex)
Returns the real component of the complex value.
Input Parameters
complex(Complex)
A complex number.
Return
number
The result complex value.
Sin (complex Complex)
Calculates the sine value of the complex value.
Input Parameters
complex(Complex)
A complex number.
Return
Complex
The result complex value.
Sqrt (complex Complex)
Calculates the square root value of the complex value.
Input Parameters
complex(Complex)
A complex number.
Return
Complex
The result complex value.
Tan (complex Complex)
Calculates the tan value of the complex value.
Input Parameters
complex(Complex)
A complex number.
Return
Complex
The result complex value.