Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

instance method

Complex#polar

() -> [ ::Numeric, ::Float ]
polar → array

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]
See also .polar #phase #quo #numerator also in 4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0