Introduction to the trigonometric function atan2 () function in Python, pythonatan2
Description
Atan2 () returns the arc tangent of the given X and Y coordinate values.
Syntax
The syntax of the atan2 () method is as follows:
import mathmath.atan2(y, x)
Note: atan2 () cannot be accessed directly. You need to import the math module and call this method through the math static object.
Parameters
X -- a value.
Y -- a value.
Return Value
Returns the arc tangent of the given X and Y coordinate values.
Instance
The following example shows how to use the atan2 () method:
#!/usr/bin/pythonimport mathprint "atan2(-0.50,-0.50) : ", math.atan2(-0.50,-0.50)print "atan2(0.50,0.50) : ", math.atan2(0.50,0.50)print "atan2(5,5) : ", math.atan2(5,5)print "atan2(-10,10) : ", math.atan2(-10,10)print "atan2(10,20) : ", math.atan2(10,20)
The output result is as follows:
atan2(-0.50,-0.50) : -2.35619449019atan2(0.50,0.50) : 0.785398163397atan2(5,5) : 0.785398163397atan2(-10,10) : -0.785398163397atan2(10,20) : 0.463647609001
Summary
The above is all the details about the trigonometric function atan2 () function of getting started with Python. I hope it will be helpful to you. If you are interested, you can continue to refer to this site: learn more about the value transfer or reference transfer of function parameters in python, several functions in Python, and enumerate function code parsing in Python, if you have any questions, please leave a message. The editor will reply to you in a timely manner. Thank you for your support!