Skip to content
class method

Complex.polar

(::Numeric, ?::Numeric) -> ::Complex
Complex.polar(abs, arg = 0) → complex

Returns a new Complex object formed from the arguments, each of which must be an instance of Numeric, or an instance of one of its subclasses: Complex, Float, Integer, Rational. Argument arg is given in radians; see Polar Coordinates:

Example
Complex.polar(3)        # => (3+0i)
Complex.polar(3, 2.0)   # => (-1.2484405096414273+2.727892280477045i)
Complex.polar(-3, -2.0) # => (1.2484405096414273+2.727892280477045i)
See also #polar .json_create .rect .rectangular also in 4.1 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0