src/Chippyash/Type/Number/Complex/ComplexTypeFactory.php
public static function fromPolar(AbstractRationalType $radius, AbstractRationalType $theta)
    {
        if (self::getRequiredType() == self::TYPE_GMP) {
            /** @noinspection PhpParamsInspection */
            return self::fromGmpPolar($radius, $theta);
        }
        /** @noinspection PhpParamsInspection */
        return self::fromNativePolar($radius, $theta);
    }
public static function fromPolar(AbstractRationalType $radius, AbstractRationalType $theta)
    {
        if (self::getRequiredType() == self::TYPE_GMP) {
            /** @noinspection PhpParamsInspection */
            return self::fromGmpPolar($radius, $theta);
        }
        /** @noinspection PhpParamsInspection */
        return self::fromNativePolar($radius, $theta);
    }
public static function fromPolar ( AbstractRationalType $ radius , AbstractRationalType $ theta ) { if ( self :: getRequiredType ( ) == self :: TYPE_GMP ) { /** @noinspection PhpParamsInspection */ return self :: fromGmpPolar ( $ radius , $ theta ) ; } /** @noinspection PhpParamsInspection */ return self :: fromNativePolar ( $ radius , $ theta ) ; }
Create complex type from polar co-ordinates

Be aware that you may lose a bit of precision e.g.
$c = ComplexTypeFactory::create('2/7+3/4i');
$c2 = ComplexTypeFactory::fromPolar($c->radius(), $c->theta());
returns 132664833738225/464326918083788+3382204885901775/4509606514535696i
which is ~0.2857142857142854066 + ~0.75000000000000066525i
whereas the original is
~0.28571428571428571429 + 0.75i

formula for conversion is z = r(cos(theta) + i.sin(theta))

@param \Chippyash\Type\Number\Rational\AbstractRationalType $radius
@param \Chippyash\Type\Number\Rational\AbstractRationalType $theta angle expressed in radians

@return \Chippyash\Type\Number\Complex\ComplexType
Create complex type from polar co - ordinates