Constants

EULER

EULER = 2.718281828459045

NUMBER_SPLIT_REGEXP

NUMBER_SPLIT_REGEXP = '` ^
            (                                   # Real part
                [-+]?(\d+\.?\d*|\d*\.?\d+)          # Real value (integer or float)
                ([Ee][-+]?[0-2]?\d{1,3})?           # Optional real exponent for scientific format
            )
            (                                   # Imaginary part
                [-+]?(\d+\.?\d*|\d*\.?\d+)          # Imaginary value (integer or float)
                ([Ee][-+]?[0-2]?\d{1,3})?           # Optional imaginary exponent for scientific format
            )?
            (                                   # Imaginary part is optional
                ([-+]?)                             # Imaginary (implicit 1 or -1) only
                ([ij]?)                             # Imaginary i or j - depending on whether mathematical or engineering
            )
        $`uix'

Properties

$realPart

$realPart : float

Type

float — The value of of this complex number on the real plane.

$imaginaryPart

$imaginaryPart : float

Type

float — The value of of this complex number on the imaginary plane.

$suffix

$suffix : string

Type

string — The suffix for this complex number (i or j).

$functions

$functions : 

Type

$operations

$operations : 

Type

Methods

__construct()

__construct(  $realPart = 0.0,   $imaginaryPart = null,   $suffix = 'i') 

Parameters

$realPart
$imaginaryPart
$suffix

getReal()

getReal() : Float

Gets the real part of this complex number

Returns

Float

getImaginary()

getImaginary() : Float

Gets the imaginary part of this complex number

Returns

Float

getSuffix()

getSuffix() : String

Gets the suffix of this complex number

Returns

String

isReal()

isReal() : Bool

Returns true if this is a real value, false if a complex value

Returns

Bool

isComplex()

isComplex() : Bool

Returns true if this is a complex value, false if a real value

Returns

Bool

format()

format() 

__toString()

__toString() 

validateComplexArgument()

validateComplexArgument(mixed  $complex) : \Complex\Complex

Validates whether the argument is a valid complex number, converting scalar or array values if possible

Parameters

mixed $complex

The value to validate

Throws

\Complex\Exception

If the argument isn't a Complex number or cannot be converted to one

Returns

\Complex\Complex

reverse()

reverse() : \Complex\Complex

Returns the reverse of this complex number

Returns

\Complex\Complex

invertImaginary()

invertImaginary() 

invertReal()

invertReal() 

__call()

__call(  $functionName,   $arguments) : \Complex\Complex|float

Returns the result of the function call or operation

Parameters

$functionName
$arguments

Throws

\Complex\Exception|\InvalidArgumentException

Returns

\Complex\Complex|float

abs()

abs() : float

Returns

float

acos()

acos() : \Complex\Complex

Returns

\Complex\Complex

acosh()

acosh() : \Complex\Complex

Returns

\Complex\Complex

acot()

acot() : \Complex\Complex

Returns

\Complex\Complex

acoth()

acoth() : \Complex\Complex

Returns

\Complex\Complex

acsc()

acsc() : \Complex\Complex

Returns

\Complex\Complex

acsch()

acsch() : \Complex\Complex

Returns

\Complex\Complex

argument()

argument() : float

Returns

float

asec()

asec() : \Complex\Complex

Returns

\Complex\Complex

asech()

asech() : \Complex\Complex

Returns

\Complex\Complex

asin()

asin() : \Complex\Complex

Returns

\Complex\Complex

asinh()

asinh() : \Complex\Complex

Returns

\Complex\Complex

atan()

atan() : \Complex\Complex

Returns

\Complex\Complex

atanh()

atanh() : \Complex\Complex

Returns

\Complex\Complex

conjugate()

conjugate() : \Complex\Complex

Returns

\Complex\Complex

cos()

cos() : \Complex\Complex

Returns

\Complex\Complex

cosh()

cosh() : \Complex\Complex

Returns

\Complex\Complex

cot()

cot() : \Complex\Complex

Returns

\Complex\Complex

coth()

coth() : \Complex\Complex

Returns

\Complex\Complex

csc()

csc() : \Complex\Complex

Returns

\Complex\Complex

csch()

csch() : \Complex\Complex

Returns

\Complex\Complex

exp()

exp() : \Complex\Complex

Returns

\Complex\Complex

inverse()

inverse() : \Complex\Complex

Returns

\Complex\Complex

ln()

ln() : \Complex\Complex

Returns

\Complex\Complex

log2()

log2() : \Complex\Complex

Returns

\Complex\Complex

log10()

log10() : \Complex\Complex

Returns

\Complex\Complex

negative()

negative() : \Complex\Complex

Returns

\Complex\Complex

pow()

pow(integer|float  $power) : \Complex\Complex

Parameters

integer|float $power

Returns

\Complex\Complex

rho()

rho() : float

Returns

float

sec()

sec() : \Complex\Complex

Returns

\Complex\Complex

sech()

sech() : \Complex\Complex

Returns

\Complex\Complex

sin()

sin() : \Complex\Complex

Returns

\Complex\Complex

sinh()

sinh() : \Complex\Complex

Returns

\Complex\Complex

sqrt()

sqrt() : \Complex\Complex

Returns

\Complex\Complex

tan()

tan() : \Complex\Complex

Returns

\Complex\Complex

tanh()

tanh() : \Complex\Complex

Returns

\Complex\Complex

theta()

theta() : float

Returns

float

add()

add(mixed  $...$complexValues) : \Complex\Complex

Parameters

mixed $...$complexValues

Returns

\Complex\Complex

subtract()

subtract(mixed  $...$complexValues) : \Complex\Complex

Parameters

mixed $...$complexValues

Returns

\Complex\Complex

multiply()

multiply(mixed  $...$complexValues) : \Complex\Complex

Parameters

mixed $...$complexValues

Returns

\Complex\Complex

divideby()

divideby(mixed  $...$complexValues) : \Complex\Complex

Parameters

mixed $...$complexValues

Returns

\Complex\Complex

divideinto()

divideinto(mixed  $...$complexValues) : \Complex\Complex

Parameters

mixed $...$complexValues

Returns

\Complex\Complex

parseComplex()

parseComplex(mixed  $complexNumber) : array

Validates whether the argument is a valid complex number, converting scalar or array values if possible

Parameters

mixed $complexNumber

The value to parse

Throws

\Complex\Exception

If the argument isn't a Complex number or cannot be converted to one

Returns

array