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
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
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
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
stringabs()
public
abs() : float
Return values
floatacos()
public
acos() : Complex
Return values
Complexacosh()
public
acosh() : Complex
Return values
Complexacot()
public
acot() : Complex
Return values
Complexacoth()
public
acoth() : Complex
Return values
Complexacsc()
public
acsc() : Complex
Return values
Complexacsch()
public
acsch() : Complex
Return values
Complexadd()
public
add([mixed ...$complexValues = ]) : Complex
Parameters
- $complexValues : mixed =
Return values
Complexargument()
public
argument() : float
Return values
floatasec()
public
asec() : Complex
Return values
Complexasech()
public
asech() : Complex
Return values
Complexasin()
public
asin() : Complex
Return values
Complexasinh()
public
asinh() : Complex
Return values
Complexatan()
public
atan() : Complex
Return values
Complexatanh()
public
atanh() : Complex
Return values
Complexconjugate()
public
conjugate() : Complex
Return values
Complexcos()
public
cos() : Complex
Return values
Complexcosh()
public
cosh() : Complex
Return values
Complexcot()
public
cot() : Complex
Return values
Complexcoth()
public
coth() : Complex
Return values
Complexcsc()
public
csc() : Complex
Return values
Complexcsch()
public
csch() : Complex
Return values
Complexdivideby()
public
divideby([mixed ...$complexValues = ]) : Complex
Parameters
- $complexValues : mixed =
Return values
Complexdivideinto()
public
divideinto([mixed ...$complexValues = ]) : Complex
Parameters
- $complexValues : mixed =
Return values
Complexexp()
public
exp() : Complex
Return values
Complexformat()
public
format() : string
Return values
stringgetImaginary()
Gets the imaginary part of this complex number
public
getImaginary() : float
Return values
floatgetReal()
Gets the real part of this complex number
public
getReal() : float
Return values
floatgetSuffix()
Gets the suffix of this complex number
public
getSuffix() : string
Return values
stringinverse()
public
inverse() : Complex
Return values
ComplexinvertImaginary()
public
invertImaginary() : Complex
Return values
ComplexinvertReal()
public
invertReal() : Complex
Return values
ComplexisComplex()
Returns true if this is a complex value, false if a real value
public
isComplex() : bool
Return values
boolisReal()
Returns true if this is a real value, false if a complex value
public
isReal() : bool
Return values
boolln()
public
ln() : Complex
Return values
Complexlog10()
public
log10() : Complex
Return values
Complexlog2()
public
log2() : Complex
Return values
Complexmultiply()
public
multiply([mixed ...$complexValues = ]) : Complex
Parameters
- $complexValues : mixed =
Return values
Complexnegative()
public
negative() : Complex
Return values
Complexpow()
public
pow([int|float $power = ]) : Complex
Parameters
- $power : int|float =
Return values
Complexreverse()
Returns the reverse of this complex number
public
reverse() : Complex
Return values
Complexrho()
public
rho() : float
Return values
floatsec()
public
sec() : Complex
Return values
Complexsech()
public
sech() : Complex
Return values
Complexsin()
public
sin() : Complex
Return values
Complexsinh()
public
sinh() : Complex
Return values
Complexsqrt()
public
sqrt() : Complex
Return values
Complexsubtract()
public
subtract([mixed ...$complexValues = ]) : Complex
Parameters
- $complexValues : mixed =
Return values
Complextan()
public
tan() : Complex
Return values
Complextanh()
public
tanh() : Complex
Return values
Complextheta()
public
theta() : float
Return values
floatvalidateComplexArgument()
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
Return values
ComplexparseComplex()
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