atan2()
function is used to find the atan(y / x) in Python for the given input(x – parameter).
Syntax of atan2()
Function
The syntax of
atan2()
function in Python is:
math.atan2(y, x)
Parameters of atan2()
Function in Python
x
– Where x
is any valid python number (positive or negative). This parameter is required.Note: If the
x
parameter is not a number, atan2()
function will return an Error.
Compatibility
atan2()
function is available and compatible with both Python 2.x
and 3.x
. This function is a part of python standard math library.
Return Value of atan2()
Function in Python
atan2()
function returns atan(y / x) for the given input.
Python atan2()
Function Example
# import math library import math print(math.atan2(-0.2)) print(math.atan2(0)) print(math.atan2(0.2)) print(math.atan2(77)) print(math.atan2(-3677))
Output: