Python math.atan2() Method

❮ Math Methods


Example

Return the arc tangent of y/x in radians:

# Import math Library
import math

# Return the arc tangent of y/x in radians
print(math.atan2(8, 5))
print(math.atan2(20, 10))
print(math.atan2(34, -7))
Try it Yourself »

Definition and Usage

The math.atan2() method returns the arc tangent of y/x, in radians. Where x and y are the coordinates of a point (x,y).

The returned value is between PI and -PI.


Syntax

math.atan2(y, x)

Parameter Values

Parameter Description
y Required. Specifies a positive or negative number
x Required. Specifies a positive or negative number

Technical Details

Return Value: A float value, representing arc tangent of y/x in radians, which is between PI and -PI
Python Version: 1.4

❮ Math Methods

Copyright 1999-2023 by Refsnes Data. All Rights Reserved.