Learn and Learn

Learn And Learn - great place for tutorials, references and how-to

Ruby – Find Arc Tangent using atan2() Method for Complex Number – Examples & Explanation

In Ruby, atan2() is a method in CMath class which is used to find the arc tangent of specified given complex numbers in Ruby language to determine the quadrant. To get the arc tangent of given complex numbers we use CMath.atan2(x, y) method.

atan2() method in Ruby

atan2() method exists in Standard atan2() Library of Ruby. The purpose of this method is to provide perfect arc tangent of specified given complex numbers to determine the quadrant.

Syntax of the atan2() method in Ruby

Syntax of atan2() method is:

Parameters of atan2() method in Ruby

Parameter Description
xAny valid complex numbers. These parameter are required.

Note: if the x parameter is not a complex number, atan2() method will return an error.

Return Value of atan2()

atan2() method will return the arc tangent of given complex numbers.

Ruby atan2() Example 1


Ruby atan2() Example 2


Ruby atan2() Example 3


Ruby atan2() Example 4


LearnAndLearn.com © 2018 - All rights reserved