Ruby | Complex angle function Last Updated : 07 Jan, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 value a = Complex(200) # declaring Complex value b = Complex(-1, 4) # declaring Complex value c = Complex('i') # use of angle() puts "Complex angle form : #{a.angle}\n\n" puts "Complex angle form : #{b.angle}\n\n" puts "Complex angle form : #{c.angle}\n\n" Output : Complex angle form : 0.0 Complex angle form : 1.8157749899217608 Complex angle form : 1.5707963267948966 Example #2 : Ruby # Ruby code for Complex.angle() method # declaring Complex value a = Complex(20, 90) # declaring Complex value b = Complex('i') # declaring Complex value c = Complex(100, -500) # use of angle() puts "Complex angle form : #{a.angle}\n\n" puts "Complex angle form : #{b.angle}\n\n" puts "Complex angle form : #{c.angle}\n\n" Output : Complex angle form : 1.3521273809209546 Complex angle form : 1.5707963267948966 Complex angle form : -1.373400766945016 Comment More infoAdvertise with us Next Article Ruby | Complex / function K Kirti_Mangal Follow Improve Article Tags : Ruby Ruby-Methods Ruby Complex-class Similar Reads Ruby | Complex abs function Complex#abs() is a Complex class method which returns the absolute value of the polar form of complex value. Syntax: Complex.abs() Parameter: Complex values Return: absolute value of the polar form of complex value. Example #1 : Ruby # Ruby code for Complex.abs() method # declaring Complex value a = 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 Ruby | Complex ** function Complex#**() is a Complex class method which returns the exponentiation value of a complex value. Syntax: Complex.**()Parameter: Complex valuesReturn: exponentiation value of a complex value. Example #1 :  Ruby # Ruby code for Complex.**() method # declaring Complex value a = Complex(200) # declar 1 min read Ruby | Complex + function Complex#+@() : +@() is a Complex class method which returns the positive value for a complex value i.e. a = +(a) Syntax: Complex.+() Parameter: Complex values Return: positive value for a complex value. Example #1 : Ruby # Ruby code for Complex.+() method # declaring Complex value a = Complex(200) # 1 min read Ruby | Complex - function Complex#-() is a Complex class method which performs the subtraction operation on complex numbers. Syntax: Complex.-() Parameter: Complex values Return: subtraction operation on complex numbers. Example #1 : Ruby # Ruby code for Complex.-() method # declaring Complex value a = Complex(200) # declari 1 min read Ruby | Complex == function Complex#==() is a Complex class method which checks whether two complex values are equal. Syntax: Complex.==() Parameter: Complex values Return: true - if a == b else false Example #1 : Ruby # Ruby code for Complex.==() method # declaring Complex value a = Complex(200) # declaring Complex value b = 1 min read Like