instance method
Complex#polar
() -> [ ::Numeric, ::Float ]
polar → array
complex.c
View on GitHub ↗
static VALUE
nucomp_polar(VALUE self)
{
return rb_assoc_new(f_abs(self), f_arg(self));
}
Returns the array [self.abs, self.arg]:
Example
Complex.polar(1, 2).polar # => [1.0, 2.0]
See Polar Coordinates.
If self was created with rectangular coordinates, the returned value is computed, and may be inexact:
Example
Complex.rect(1, 1).polar # => [1.4142135623730951, 0.7853981633974483]