Introduction to the trigonometric function atan2 () function in Python, pythonatan2

Source: Internet
Author: User

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!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.