\Complex

Classes

Autoloader Autoloader for Complex classes
Complex Complex Number object.
Exception

Functions

abs()

abs(\Complex\Complex|mixed  $complex) : float

Returns the absolute value (modulus) of a complex number.

Also known as the rho of the complex number, i.e. the distance/radius from the centrepoint to the representation of the number in polar coordinates.

This function is a synonym for rho()

Parameters

\Complex\Complex|mixed $complex

Complex number or a numeric value.

Throws

\Complex\Exception

If argument isn't a valid real or complex number.

Returns

float —

The absolute (or rho) value of the complex argument.

acos()

acos(\Complex\Complex|mixed  $complex) : \Complex\Complex

Returns the inverse cosine of a complex number.

Parameters

\Complex\Complex|mixed $complex

Complex number or a numeric value.

Throws

\Complex\Exception

If argument isn't a valid real or complex number.

Returns

\Complex\Complex —

The inverse cosine of the complex argument.

acosh()

acosh(\Complex\Complex|mixed  $complex) : \Complex\Complex

Returns the inverse hyperbolic cosine of a complex number.

Parameters

\Complex\Complex|mixed $complex

Complex number or a numeric value.

Throws

\Complex\Exception

If argument isn't a valid real or complex number.

Returns

\Complex\Complex —

The inverse hyperbolic cosine of the complex argument.

acot()

acot(\Complex\Complex|mixed  $complex) : \Complex\Complex

Returns the inverse cotangent of a complex number.

Parameters

\Complex\Complex|mixed $complex

Complex number or a numeric value.

Throws

\Complex\Exception

If argument isn't a valid real or complex number.

\InvalidArgumentException

If function would result in a division by zero

Returns

\Complex\Complex —

The inverse cotangent of the complex argument.

acoth()

acoth(\Complex\Complex|mixed  $complex) : \Complex\Complex

Returns the inverse hyperbolic cotangent of a complex number.

Parameters

\Complex\Complex|mixed $complex

Complex number or a numeric value.

Throws

\Complex\Exception

If argument isn't a valid real or complex number.

\InvalidArgumentException

If function would result in a division by zero

Returns

\Complex\Complex —

The inverse hyperbolic cotangent of the complex argument.

acsc()

acsc(\Complex\Complex|mixed  $complex) : \Complex\Complex

Returns the inverse cosecant of a complex number.

Parameters

\Complex\Complex|mixed $complex

Complex number or a numeric value.

Throws

\Complex\Exception

If argument isn't a valid real or complex number.

\InvalidArgumentException

If function would result in a division by zero

Returns

\Complex\Complex —

The inverse cosecant of the complex argument.

acsch()

acsch(\Complex\Complex|mixed  $complex) : \Complex\Complex

Returns the inverse hyperbolic cosecant of a complex number.

Parameters

\Complex\Complex|mixed $complex

Complex number or a numeric value.

Throws

\Complex\Exception

If argument isn't a valid real or complex number.

\InvalidArgumentException

If function would result in a division by zero

Returns

\Complex\Complex —

The inverse hyperbolic cosecant of the complex argument.

add()

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

Adds two or more complex numbers

Parameters

mixed $complexValues variadic

Returns

\Complex\Complex —

argument()

argument(\Complex\Complex|mixed  $complex) : float

Returns the argument of a complex number.

Also known as the theta of the complex number, i.e. the angle in radians from the real axis to the representation of the number in polar coordinates.

This function is a synonym for theta()

Parameters

\Complex\Complex|mixed $complex

Complex number or a numeric value.

Throws

\Complex\Exception

If argument isn't a valid real or complex number.

Returns

float —

The argument (or theta) value of the complex argument.

asec()

asec(\Complex\Complex|mixed  $complex) : \Complex\Complex

Returns the inverse secant of a complex number.

Parameters

\Complex\Complex|mixed $complex

Complex number or a numeric value.

Throws

\Complex\Exception

If argument isn't a valid real or complex number.

\InvalidArgumentException

If function would result in a division by zero

Returns

\Complex\Complex —

The inverse secant of the complex argument.

asech()

asech(\Complex\Complex|mixed  $complex) : \Complex\Complex

Returns the inverse hyperbolic secant of a complex number.

Parameters

\Complex\Complex|mixed $complex

Complex number or a numeric value.

Throws

\Complex\Exception

If argument isn't a valid real or complex number.

\InvalidArgumentException

If function would result in a division by zero

Returns

\Complex\Complex —

The inverse hyperbolic secant of the complex argument.

asin()

asin(\Complex\Complex|mixed  $complex) : \Complex\Complex

Returns the inverse sine of a complex number.

Parameters

\Complex\Complex|mixed $complex

Complex number or a numeric value.

Throws

\Complex\Exception

If argument isn't a valid real or complex number.

Returns

\Complex\Complex —

The inverse sine of the complex argument.

asinh()

asinh(\Complex\Complex|mixed  $complex) : \Complex\Complex

Returns the inverse hyperbolic sine of a complex number.

Parameters

\Complex\Complex|mixed $complex

Complex number or a numeric value.

Throws

\Complex\Exception

If argument isn't a valid real or complex number.

Returns

\Complex\Complex —

The inverse hyperbolic sine of the complex argument.

atan()

atan(\Complex\Complex|mixed  $complex) : \Complex\Complex

Returns the inverse tangent of a complex number.

Parameters

\Complex\Complex|mixed $complex

Complex number or a numeric value.

Throws

\Complex\Exception

If argument isn't a valid real or complex number.

\InvalidArgumentException

If function would result in a division by zero

Returns

\Complex\Complex —

The inverse tangent of the complex argument.

atanh()

atanh(\Complex\Complex|mixed  $complex) : \Complex\Complex

Returns the inverse hyperbolic tangent of a complex number.

Parameters

\Complex\Complex|mixed $complex

Complex number or a numeric value.

Throws

\Complex\Exception

If argument isn't a valid real or complex number.

Returns

\Complex\Complex —

The inverse hyperbolic tangent of the complex argument.

conjugate()

conjugate(\Complex\Complex|mixed  $complex) : \Complex\Complex

Returns the complex conjugate of a complex number

Parameters

\Complex\Complex|mixed $complex

Complex number or a numeric value.

Throws

\Complex\Exception

If argument isn't a valid real or complex number.

Returns

\Complex\Complex —

The conjugate of the complex argument.

cos()

cos(\Complex\Complex|mixed  $complex) : \Complex\Complex

Returns the cosine of a complex number.

Parameters

\Complex\Complex|mixed $complex

Complex number or a numeric value.

Throws

\Complex\Exception

If argument isn't a valid real or complex number.

Returns

\Complex\Complex —

The cosine of the complex argument.

cosh()

cosh(\Complex\Complex|mixed  $complex) : \Complex\Complex

Returns the hyperbolic cosine of a complex number.

Parameters

\Complex\Complex|mixed $complex

Complex number or a numeric value.

Throws

\Complex\Exception

If argument isn't a valid real or complex number.

Returns

\Complex\Complex —

The hyperbolic cosine of the complex argument.

cot()

cot(\Complex\Complex|mixed  $complex) : \Complex\Complex

Returns the cotangent of a complex number.

Parameters

\Complex\Complex|mixed $complex

Complex number or a numeric value.

Throws

\Complex\Exception

If argument isn't a valid real or complex number.

\InvalidArgumentException

If function would result in a division by zero

Returns

\Complex\Complex —

The cotangent of the complex argument.

coth()

coth(\Complex\Complex|mixed  $complex) : \Complex\Complex

Returns the hyperbolic cotangent of a complex number.

Parameters

\Complex\Complex|mixed $complex

Complex number or a numeric value.

Throws

\Complex\Exception

If argument isn't a valid real or complex number.

\InvalidArgumentException

If function would result in a division by zero

Returns

\Complex\Complex —

The hyperbolic cotangent of the complex argument.

csc()

csc(\Complex\Complex|mixed  $complex) : \Complex\Complex

Returns the cosecant of a complex number.

Parameters

\Complex\Complex|mixed $complex

Complex number or a numeric value.

Throws

\Complex\Exception

If argument isn't a valid real or complex number.

\InvalidArgumentException

If function would result in a division by zero

Returns

\Complex\Complex —

The cosecant of the complex argument.

csch()

csch(\Complex\Complex|mixed  $complex) : \Complex\Complex

Returns the hyperbolic cosecant of a complex number.

Parameters

\Complex\Complex|mixed $complex

Complex number or a numeric value.

Throws

\Complex\Exception

If argument isn't a valid real or complex number.

\InvalidArgumentException

If function would result in a division by zero

Returns

\Complex\Complex —

The hyperbolic cosecant of the complex argument.

divideby()

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

Divides two or more complex numbers

Parameters

mixed $complexValues variadic

Returns

\Complex\Complex —

divideinto()

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

Divides two or more complex numbers

Parameters

mixed $complexValues variadic

Returns

\Complex\Complex —

exp()

exp(\Complex\Complex|mixed  $complex) : \Complex\Complex

Returns the exponential of a complex number.

Parameters

\Complex\Complex|mixed $complex

Complex number or a numeric value.

Throws

\Complex\Exception

If argument isn't a valid real or complex number.

Returns

\Complex\Complex —

The exponential of the complex argument.

inverse()

inverse(\Complex\Complex|mixed  $complex) : \Complex\Complex

Returns the inverse of a complex number.

Parameters

\Complex\Complex|mixed $complex

Complex number or a numeric value.

Throws

\Complex\Exception

If argument isn't a valid real or complex number.

\InvalidArgumentException

If function would result in a division by zero

Returns

\Complex\Complex —

The inverse of the complex argument.

ln()

ln(\Complex\Complex|mixed  $complex) : \Complex\Complex

Returns the natural logarithm of a complex number.

Parameters

\Complex\Complex|mixed $complex

Complex number or a numeric value.

Throws

\Complex\Exception

If argument isn't a valid real or complex number.

\InvalidArgumentException

If the real and the imaginary parts are both zero

Returns

\Complex\Complex —

The natural logarithm of the complex argument.

log10()

log10(\Complex\Complex|mixed  $complex) : \Complex\Complex

Returns the common logarithm (base 10) of a complex number.

Parameters

\Complex\Complex|mixed $complex

Complex number or a numeric value.

Throws

\Complex\Exception

If argument isn't a valid real or complex number.

\InvalidArgumentException

If the real and the imaginary parts are both zero

Returns

\Complex\Complex —

The common logarithm (base 10) of the complex argument.

log2()

log2(\Complex\Complex|mixed  $complex) : \Complex\Complex

Returns the base-2 logarithm of a complex number.

Parameters

\Complex\Complex|mixed $complex

Complex number or a numeric value.

Throws

\Complex\Exception

If argument isn't a valid real or complex number.

\InvalidArgumentException

If the real and the imaginary parts are both zero

Returns

\Complex\Complex —

The base-2 logarithm of the complex argument.

multiply()

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

Multiplies two or more complex numbers

Parameters

mixed $complexValues variadic

Returns

\Complex\Complex —

negative()

negative(\Complex\Complex|mixed  $complex) : \Complex\Complex

Returns the negative of a complex number.

Parameters

\Complex\Complex|mixed $complex

Complex number or a numeric value.

Throws

\Complex\Exception

If argument isn't a valid real or complex number.

Returns

\Complex\Complex —

The negative value of the complex argument.

pow()

pow(\Complex\Complex|mixed  $complex, float|int  $power) : \Complex\Complex

Returns a complex number raised to a power.

Parameters

\Complex\Complex|mixed $complex

Complex number or a numeric value.

float|int $power

The power to raise this value to

Throws

\Complex\Exception

If the power argument isn't a valid real

Returns

\Complex\Complex —

The complex argument raised to the real power.

rho()

rho(\Complex\Complex|mixed  $complex) : float

Returns the rho of a complex number.

This is the distance/radius from the centrepoint to the representation of the number in polar coordinates.

Parameters

\Complex\Complex|mixed $complex

Complex number or a numeric value.

Throws

\Complex\Exception

If argument isn't a valid real or complex number.

Returns

float —

The rho value of the complex argument.

sec()

sec(\Complex\Complex|mixed  $complex) : \Complex\Complex

Returns the secant of a complex number.

Parameters

\Complex\Complex|mixed $complex

Complex number or a numeric value.

Throws

\Complex\Exception

If argument isn't a valid real or complex number.

\InvalidArgumentException

If function would result in a division by zero

Returns

\Complex\Complex —

The secant of the complex argument.

sech()

sech(\Complex\Complex|mixed  $complex) : \Complex\Complex

Returns the hyperbolic secant of a complex number.

Parameters

\Complex\Complex|mixed $complex

Complex number or a numeric value.

Throws

\Complex\Exception

If argument isn't a valid real or complex number.

\InvalidArgumentException

If function would result in a division by zero

Returns

\Complex\Complex —

The hyperbolic secant of the complex argument.

sin()

sin(\Complex\Complex|mixed  $complex) : \Complex\Complex

Returns the sine of a complex number.

Parameters

\Complex\Complex|mixed $complex

Complex number or a numeric value.

Throws

\Complex\Exception

If argument isn't a valid real or complex number.

Returns

\Complex\Complex —

The sine of the complex argument.

sinh()

sinh(\Complex\Complex|mixed  $complex) : \Complex\Complex

Returns the hyperbolic sine of a complex number.

Parameters

\Complex\Complex|mixed $complex

Complex number or a numeric value.

Throws

\Complex\Exception

If argument isn't a valid real or complex number.

Returns

\Complex\Complex —

The hyperbolic sine of the complex argument.

sqrt()

sqrt(\Complex\Complex|mixed  $complex) : \Complex\Complex

Returns the square root of a complex number.

Parameters

\Complex\Complex|mixed $complex

Complex number or a numeric value.

Throws

\Complex\Exception

If argument isn't a valid real or complex number.

Returns

\Complex\Complex —

The Square root of the complex argument.

subtract()

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

Subtracts two or more complex numbers

Parameters

mixed $complexValues variadic

Returns

\Complex\Complex —

tan()

tan(\Complex\Complex|mixed  $complex) : \Complex\Complex

Returns the tangent of a complex number.

Parameters

\Complex\Complex|mixed $complex

Complex number or a numeric value.

Throws

\Complex\Exception

If argument isn't a valid real or complex number.

\InvalidArgumentException

If function would result in a division by zero

Returns

\Complex\Complex —

The tangent of the complex argument.

tanh()

tanh(\Complex\Complex|mixed  $complex) : \Complex\Complex

Returns the hyperbolic tangent of a complex number.

Parameters

\Complex\Complex|mixed $complex

Complex number or a numeric value.

Throws

\Complex\Exception

If argument isn't a valid real or complex number.

\InvalidArgumentException

If function would result in a division by zero

Returns

\Complex\Complex —

The hyperbolic tangent of the complex argument.

theta()

theta(\Complex\Complex|mixed  $complex) : float

Returns the theta of a complex number.

This is the angle in radians from the real axis to the representation of the number in polar coordinates.

Parameters

\Complex\Complex|mixed $complex

Complex number or a numeric value.

Throws

\Complex\Exception

If argument isn't a valid real or complex number.

Returns

float —

The theta value of the complex argument.