HumHub Documentation (unofficial)

Complex
in package

Complex Number object.

Table of Contents

Constants

EULER  = 2.718281828459045
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

$functions  : mixed
$imaginaryPart  : float
$operations  : mixed
$realPart  : float
$suffix  : string

Methods

__call()  : Complex|float
Returns the result of the function call or operation
__construct()  : mixed
__toString()  : string
abs()  : float
acos()  : Complex
acosh()  : Complex
acot()  : Complex
acoth()  : Complex
acsc()  : Complex
acsch()  : Complex
add()  : Complex
argument()  : float
asec()  : Complex
asech()  : Complex
asin()  : Complex
asinh()  : Complex
atan()  : Complex
atanh()  : Complex
conjugate()  : Complex
cos()  : Complex
cosh()  : Complex
cot()  : Complex
coth()  : Complex
csc()  : Complex
csch()  : Complex
divideby()  : Complex
divideinto()  : Complex
exp()  : Complex
format()  : string
getImaginary()  : float
Gets the imaginary part of this complex number
getReal()  : float
Gets the real part of this complex number
getSuffix()  : string
Gets the suffix of this complex number
inverse()  : Complex
invertImaginary()  : Complex
invertReal()  : Complex
isComplex()  : bool
Returns true if this is a complex value, false if a real value
isReal()  : bool
Returns true if this is a real value, false if a complex value
ln()  : Complex
log10()  : Complex
log2()  : Complex
multiply()  : Complex
negative()  : Complex
pow()  : Complex
reverse()  : Complex
Returns the reverse of this complex number
rho()  : float
sec()  : Complex
sech()  : Complex
sin()  : Complex
sinh()  : Complex
sqrt()  : Complex
subtract()  : Complex
tan()  : Complex
tanh()  : Complex
theta()  : float
validateComplexArgument()  : Complex
Validates whether the argument is a valid complex number, converting scalar or array values if possible
parseComplex()  : array<string|int, mixed>
Validates whether the argument is a valid complex number, converting scalar or array values if possible

Constants

EULER

public mixed EULER = 2.718281828459045
Tags
constant

Euler's Number.

NUMBER_SPLIT_REGEXP

public mixed 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'
Tags
constant

Regexp to split an input string into real and imaginary components and suffix

Properties

$functions

protected static mixed $functions = ['abs', 'acos', 'acosh', 'acot', 'acoth', 'acsc', 'acsch', 'argument', 'asec', 'asech', 'asin', 'asinh', 'atan', 'atanh', 'conjugate', 'cos', 'cosh', 'cot', 'coth', 'csc', 'csch', 'exp', 'inverse', 'ln', 'log2', 'log10', 'negative', 'pow', 'rho', 'sec', 'sech', 'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'theta']

$imaginaryPart

protected float $imaginaryPart = 0.0

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

$operations

protected static mixed $operations = ['add', 'subtract', 'multiply', 'divideby', 'divideinto']

$realPart

protected float $realPart = 0.0

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

$suffix

protected string $suffix

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

Methods

__call()

Returns the result of the function call or operation

public __call(mixed $functionName, mixed $arguments) : Complex|float
Parameters
$functionName : mixed
$arguments : mixed
Tags
throws
Exception|InvalidArgumentException
Return values
Complex|float

__construct()

public __construct([mixed $realPart = 0.0 ][, mixed $imaginaryPart = null ][, mixed $suffix = 'i' ]) : mixed
Parameters
$realPart : mixed = 0.0
$imaginaryPart : mixed = null
$suffix : mixed = 'i'

__toString()

public __toString() : string
Return values
string

abs()

public abs() : float
Return values
float

add()

public add([mixed ...$complexValues = ]) : Complex
Parameters
$complexValues : mixed =
Return values
Complex

argument()

public argument() : float
Return values
float

divideby()

public divideby([mixed ...$complexValues = ]) : Complex
Parameters
$complexValues : mixed =
Return values
Complex

divideinto()

public divideinto([mixed ...$complexValues = ]) : Complex
Parameters
$complexValues : mixed =
Return values
Complex

format()

public format() : string
Return values
string

getImaginary()

Gets the imaginary part of this complex number

public getImaginary() : float
Return values
float

getReal()

Gets the real part of this complex number

public getReal() : float
Return values
float

getSuffix()

Gets the suffix of this complex number

public getSuffix() : string
Return values
string

isComplex()

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

public isComplex() : bool
Return values
bool

isReal()

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

public isReal() : bool
Return values
bool

multiply()

public multiply([mixed ...$complexValues = ]) : Complex
Parameters
$complexValues : mixed =
Return values
Complex

rho()

public rho() : float
Return values
float

subtract()

public subtract([mixed ...$complexValues = ]) : Complex
Parameters
$complexValues : mixed =
Return values
Complex

theta()

public theta() : float
Return values
float

validateComplexArgument()

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

public static validateComplexArgument(mixed $complex) : Complex
Parameters
$complex : mixed

The value to validate

Tags
throws
Exception

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

Return values
Complex

parseComplex()

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

private static parseComplex(mixed $complexNumber) : array<string|int, mixed>
Parameters
$complexNumber : mixed

The value to parse

Tags
throws
Exception

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

Return values
array<string|int, mixed>

        
On this page

Search results