Overview

Namespaces

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

Classes

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

Class ComplexType

A complex number - algabraic form

A complex number is a number that can be expressed in the form a + bi, where a and b are real numbers and i is the imaginary unit, which satisfies the equation i² = −1

Complex numbers use real numbers expressed as a RationalType. This allows for greater arithmetic stability

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
Extended by chippyash\Type\Number\Complex\ComplexType
Namespace: chippyash\Type\Number\Complex
Link: http://en.wikipedia.org/wiki/Complex_number
Located at Number/Complex/ComplexType.php
Methods summary
public
# __construct( chippyash\Type\Number\Rational\RationalType $real, chippyash\Type\Number\Rational\RationalType $imaginary )

Constructor

Constructor

Parameters

$real
$imaginary

Overrides

chippyash\Type\AbstractMultiValueType::__construct()
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
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
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
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
Methods inherited from chippyash\Type\Number\Complex\AbstractComplexType
__clone(), __invoke(), __toString(), abs(), asFloatType(), asIntType(), asPolar(), conjugate(), i(), isGaussian(), isReal(), isZero(), negate(), polarQuadrant(), polarString(), r(), radius(), toFloat()
Methods inherited from chippyash\Type\AbstractMultiValueType
get(), set()
Chippyash Strong Types API documentation generated by ApiGen 2.8.0