Overview

Namespaces

  • chippyash
    • Type
      • Exceptions
      • Interfaces
      • Number
        • Complex
        • Rational
      • String

Classes

  • AbstractComplexType
  • ComplexType
  • ComplexTypeFactory
  • GMPComplexType
  • Overview
  • Namespace
  • Class
  • Tree

Class AbstractComplexType

Abstract complex number type

chippyash\Type\AbstractType implements chippyash\Type\Interfaces\TypeInterface
Extended by chippyash\Type\AbstractMultiValueType
Extended by chippyash\Type\Number\Complex\AbstractComplexType implements chippyash\Type\Interfaces\ComplexTypeInterface, chippyash\Type\Interfaces\NumericTypeInterface

Direct known subclasses

chippyash\Type\Number\Complex\ComplexType, chippyash\Type\Number\Complex\GMPComplexType
Abstract
Namespace: chippyash\Type\Number\Complex
Located at Number/Complex/AbstractComplexType.php
Methods summary
abstract public chippyash\Type\Number\Rational\RationalType
# modulus( )

Return the modulus, also known as absolute value or magnitude of this number = sqrt(r2 + i2);

Return the modulus, also known as absolute value or magnitude of this number = sqrt(r2 + i2);

Returns

chippyash\Type\Number\Rational\RationalType
\chippyash\Type\Number\Rational\RationalType

Implementation of

chippyash\Type\Interfaces\ComplexTypeInterface::modulus()
abstract public chippyash\Type\Number\Rational\RationalType
# theta( )

Return the angle (sometimes known as the argument) of the number when expressed in polar notation

Return the angle (sometimes known as the argument) of the number when expressed in polar notation

The return value is a rational expressing theta as radians

Returns

chippyash\Type\Number\Rational\RationalType
\chippyash\Type\Number\Rational\RationalType

Implementation of

chippyash\Type\Interfaces\ComplexTypeInterface::theta()
abstract public chippyash\Type\Number\Complex\ComplexType
# asComplex( )

Return the number as a Complex number i.e. n+0i

Return the number as a Complex number i.e. n+0i

Returns

chippyash\Type\Number\Complex\ComplexType
\chippyash\Type\Number\Complex\ComplexType

Implementation of

chippyash\Type\Interfaces\NumericTypeInterface::asComplex()
abstract public chippyash\Type\Number\Rational\RationalType
# asRational( )

Return number as Rational number. NB, numerator and denominator will be caste as IntTypes

Return number as Rational number. NB, numerator and denominator will be caste as IntTypes

Returns

chippyash\Type\Number\Rational\RationalType
\chippyash\Type\Number\Rational\RationalType

Throws

chippyash\Type\Exceptions\NotRealComplexException
NotRealComplexException

Implementation of

chippyash\Type\Interfaces\NumericTypeInterface::asRational()
public string
# polarString( )

Return complex number expressed as a string in polar form i.e. r(cosθ + i⋅sinθ)

Return complex number expressed as a string in polar form i.e. r(cosθ + i⋅sinθ)

Returns

string
string

Implementation of

chippyash\Type\Interfaces\ComplexTypeInterface::polarString()
public chippyash\Type\Number\IntType
# asIntType( )

Return number as an IntType number. If number isReal() will return floor(r())

Return number as an IntType number. If number isReal() will return floor(r())

Returns

chippyash\Type\Number\IntType
\chippyash\Type\Number\IntType

Throws

chippyash\Type\Exceptions\NotRealComplexException
NotRealComplexException

Implementation of

chippyash\Type\Interfaces\NumericTypeInterface::asIntType()
public chippyash\Type\Number\FloatType
# asFloatType( )

Return number as a FloatType number.

Return number as a FloatType number.

Returns

chippyash\Type\Number\FloatType
\chippyash\Type\Number\FloatType

Throws

chippyash\Type\Exceptions\NotRealComplexException
NotRealComplexException

Implementation of

chippyash\Type\Interfaces\NumericTypeInterface::asFloatType()
public float
# toFloat( )

If this complex number isReal() then return float equivalent else throw an excepton

If this complex number isReal() then return float equivalent else throw an excepton

Returns

float
float

Throws

chippyash\Type\Exceptions\NotRealComplexException
NotRealComplexException
public chippyash\Type\Number\Rational\AbstractRationalType
# abs( )

Return the absolute value of the number

Return the absolute value of the number

Returns

chippyash\Type\Number\Rational\AbstractRationalType
\chippyash\Type\Number\Rational\AbstractRationalType

Implementation of

chippyash\Type\Interfaces\NumericTypeInterface::abs()
public chippyash\Type\Number\Complex\ComplexType
# negate( )

Negates the number

Negates the number

Returns

chippyash\Type\Number\Complex\ComplexType
Fluent Interface

Implementation of

chippyash\Type\Interfaces\NumericTypeInterface::negate()
public chippyash\Type\Number\Rational\RationalType
# r( )

Get the real part

Get the real part

Returns

chippyash\Type\Number\Rational\RationalType
RationalType

Implementation of

chippyash\Type\Interfaces\ComplexTypeInterface::r()
public chippyash\Type\Number\Rational\RationalType
# i( )

Get the imaginary part

Get the imaginary part

Returns

chippyash\Type\Number\Rational\RationalType
RationalType

Implementation of

chippyash\Type\Interfaces\ComplexTypeInterface::i()
public boolean
# isZero( )

Is this number equal to zero?

Is this number equal to zero?

Returns

boolean
boolean

Implementation of

chippyash\Type\Interfaces\ComplexTypeInterface::isZero()
public boolean
# isReal( )

Is this number a real number? i.e. is it in form n+0i

Is this number a real number? i.e. is it in form n+0i

Returns

boolean
boolean

Implementation of

chippyash\Type\Interfaces\ComplexTypeInterface::isReal()
public boolean
# isGaussian( )

Is this number Gaussian, i.e r & i are both equivelent to integers

Is this number Gaussian, i.e r & i are both equivelent to integers

Returns

boolean
boolean

Link

http://en.wikipedia.org/wiki/Gaussian_integer

Implementation of

chippyash\Type\Interfaces\ComplexTypeInterface::isGaussian()
public chippyash\Type\Number\Complex\ComplexType
# conjugate( )

Return conjugate of this number

Return conjugate of this number

Returns

chippyash\Type\Number\Complex\ComplexType
\chippyash\Type\Number\Complex\ComplexType

Implementation of

chippyash\Type\Interfaces\ComplexTypeInterface::conjugate()
public chippyash\Type\Number\Rational\RationalType
# radius( )

Return the radius (sometimes known as Rho) of the number when expressed in polar notation

Return the radius (sometimes known as Rho) of the number when expressed in polar notation

Returns

chippyash\Type\Number\Rational\RationalType
\chippyash\Type\Number\Rational\RationalType

Implementation of

chippyash\Type\Interfaces\ComplexTypeInterface::radius()
public array[radius
# asPolar( )

Returns complex number expressed in polar form

Returns complex number expressed in polar form

radius == this->modulus() theta is angle expressed in radians

Returns

array[radius
=> RationalType, theta => RationalType]

Implementation of

chippyash\Type\Interfaces\ComplexTypeInterface::asPolar()
public integer
# polarQuadrant( )

Returns the polar quadrant for the complex number Returns 1, 2, 3 or 4 dependent on the quadrant

Returns the polar quadrant for the complex number Returns 1, 2, 3 or 4 dependent on the quadrant

Returns

integer
int

Implementation of

chippyash\Type\Interfaces\ComplexTypeInterface::polarQuadrant()
public string
# __toString( )

String representation of complex number If isReal() then string representation of the real part else r(+/-)ii

String representation of complex number If isReal() then string representation of the real part else r(+/-)ii

Returns

string
string

Overrides

chippyash\Type\AbstractMultiValueType::__toString()

Implementation of

chippyash\Type\Interfaces\TypeInterface::__toString()
public
# __clone( )

Magic clone method Ensure value gets cloned when object is cloned

Magic clone method Ensure value gets cloned when object is cloned

Overrides

chippyash\Type\AbstractMultiValueType::__clone()
public string
# __invoke( )

Proxy to get()

Proxy to get()

Returns

string
string

Overrides

chippyash\Type\AbstractMultiValueType::__invoke()

Implementation of

chippyash\Type\Interfaces\TypeInterface::__invoke()
Methods inherited from chippyash\Type\AbstractMultiValueType
__construct(), get(), set()
Chippyash Strong Types API documentation generated by ApiGen 2.8.0