Overview

Namespaces

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

Classes

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

Class GMPComplexType

A complex number - algabraic form - GMP version

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

Constructor

Constructor

Parameters

$real
$imaginary

Overrides

chippyash\Type\AbstractMultiValueType::__construct()
public chippyash\Type\Number\Rational\GMPRationalType
# 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\GMPRationalType
\chippyash\Type\Number\Rational\GMPRationalType
public chippyash\Type\Number\Rational\GMPRationalType
# 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\GMPRationalType
\chippyash\Type\Number\Rational\GMPRationalType
public GMP|resource
# gmp( )

Return the value of number array of gmp resources|objects

Return the value of number array of gmp resources|objects

Returns

GMP|resource
array [[num,den],[num,den]]

Implementation of

chippyash\Type\Interfaces\GMPInterface::gmp()
public chippyash\Type\Number\GMPIntType
# asGMPIntType( )

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

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

Returns

chippyash\Type\Number\GMPIntType
\chippyash\Type\Number\GMPIntType

Throws

chippyash\Type\Exceptions\NotRealComplexException
NotRealComplexException

Implementation of

chippyash\Type\Interfaces\GMPInterface::asGMPIntType()
public chippyash\Type\Number\Complex\GMPComplexType
# asGMPComplex( )

Return the number as a GMPComplex number i.e. a+bi Clones self

Return the number as a GMPComplex number i.e. a+bi Clones self

Returns

chippyash\Type\Number\Complex\GMPComplexType
\chippyash\Type\Number\Complex\GMPComplexType

Implementation of

chippyash\Type\Interfaces\GMPInterface::asGMPComplex()
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\GMPRationalType
# asGMPRational( )

Return number as GMPRational number. If number isReal() will return GMPRationalType NB, numerator and denominator will be caste as GMPIntTypes

Return number as GMPRational number. If number isReal() will return GMPRationalType NB, numerator and denominator will be caste as GMPIntTypes

Returns

chippyash\Type\Number\Rational\GMPRationalType
\chippyash\Type\Number\Rational\GMPRationalType

Throws

chippyash\Type\Exceptions\NotRealComplexException
NotRealComplexException

Implementation of

chippyash\Type\Interfaces\GMPInterface::asGMPRational()
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\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

Overrides

chippyash\Type\Number\Complex\AbstractComplexType::asFloatType()
Methods inherited from chippyash\Type\Number\Complex\AbstractComplexType
__clone(), __invoke(), __toString(), abs(), 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