Ruby | Complex arg() method Last Updated : 07 Jan, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report Complex#arg() is a Complex class method which returns the angle part of the polar form of complex value. Syntax: Complex.arg() Parameter: Complex values Return: angle part of the polar form of complex value. Example #1 : Ruby # Ruby code for Complex.arg() method # declaring Complex value a = Complex(200) # declaring Complex value b = Complex(-1, 4) # declaring Complex value c = Complex('i') # use of arg() puts "Complex arg form : #{a.arg}\n\n" puts "Complex arg form : #{b.arg}\n\n" puts "Complex arg form : #{c.arg}\n\n" Output : Complex arg form : 0.0 Complex arg form : 1.8157749899217608 Complex arg form : 1.5707963267948966 Example #2 : Ruby # Ruby code for Complex.arg() method # declaring Complex value a = Complex(20, 90) # declaring Complex value b = Complex('i') # declaring Complex value c = Complex(100, -500) # use of arg() puts "Complex arg form : #{a.arg}\n\n" puts "Complex arg form : #{b.arg}\n\n" puts "Complex arg form : #{c.arg}\n\n" Output : Complex arg form : 1.3521273809209546 Complex arg form : 1.5707963267948966 Complex arg form : -1.373400766945016 Comment More infoAdvertise with us Next Article Ruby | Complex angle function K Kirti_Mangal Follow Improve Article Tags : Ruby Ruby-Methods Ruby Complex-class Similar Reads Ruby | Complex * method Complex#*() is a Complex class method which returns the multiplicative product of two complex values. Syntax: Complex.*() Parameter: Complex values Return: multiplicative product of two complex values. Example #1 : Ruby # Ruby code for Complex.*() method # declaring Complex value a = Complex(200) # 1 min read Ruby | Complex + method Complex#+() : +() is a Complex class method which performs the addition operation.  Syntax: Complex.+()Parameter: Complex valuesReturn: Addition Operation on complex values. Example #1 :  Ruby # Ruby code for Complex.+() method # declaring Complex value a = Complex(200) # declaring Complex value b 1 min read Ruby | Complex angle function Complex#angle() : angle() is a Complex class method which returns the angle part of the polar form of complex value. Syntax: Complex.angle() Parameter: Complex values Return: angle part of the polar form of complex value. Example #1 : Ruby # Ruby code for Complex.angle() method # declaring Complex v 1 min read Ruby Float arg() method with example Float arg() is a float class method which works on float values and works differently for both positive and negative values. Syntax: float.arg() Parameter: float value which is to be checked Return: return 0 for positive values. Otherwise pi(3.141592653589793) Example #1: Ruby # Ruby code for arg() 1 min read Ruby | Complex abs2 function Complex#abs2() is a Complex class method which returns the square of absolute value of the polar form of complex value. Syntax: Complex.abs2() Parameter: Complex values Return: square of absolute value of the polar form of complex value. Example #1 : Ruby # Ruby code for Complex.abs2() method # decl 1 min read Ruby | Complex / function Complex#/() is a Complex class method which returns the division value on two complex numbers. Syntax: Complex./() Parameter: Complex values Return: division value on two complex numbers. Example #1 : Ruby # Ruby code for Complex./() method # declaring Complex value a = Complex(200) # declaring Comp 1 min read Like