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 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" |
chevron_right
filter_none
Output :
Complex angle form : 0.0 Complex angle form : 1.8157749899217608 Complex angle form : 1.5707963267948966
Example #2 :
# 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" |
chevron_right
filter_none
Output :
Complex angle form : 1.3521273809209546 Complex angle form : 1.5707963267948966 Complex angle form : -1.373400766945016
Recommended Posts:
- Ruby | Complex abs function
- Ruby | Complex == function
- Ruby | Complex / function
- Ruby | Complex + function
- Ruby | Complex ** function
- Ruby | Complex -@ function
- Ruby | Complex - function
- Ruby | Complex conjugate() function
- Ruby | Complex conj function
- Ruby | Complex abs2 function
- Ruby | Complex denominator function
- Ruby | Numeric angle() function
- Ruby | Complex + method
- Ruby | Complex * method
- Ruby | Complex arg() method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



