Skip to content

Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →

instance method

Complex#polar

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.1 · 4.0 · 3.4 · 3.2 · 3.1 · 3.0