Introduction to Python: An Example of trigonometric function tan (), pythontan

Source: Internet
Author: User
Tags function examples

Introduction to Python: An Example of trigonometric function tan (), pythontan

Description

Tan () returns the sine of x radians.

Syntax

The syntax of the tan () method is as follows:

import mathmath.tan(x)

Note: tan () cannot be accessed directly. You need to import the math module and call this method through the math static object.

Parameters

X -- a value.

Return Value

Returns the sine of x radians. The value ranges from-1 to 1.

Instance

The following example shows how to use the tan () method:

#!/usr/bin/pythonimport mathprint "tan(3) : ", math.tan(3)print "tan(-3) : ", math.tan(-3)print "tan(0) : ", math.tan(0)print "tan(math.pi) : ", math.tan(math.pi)print "tan(math.pi/2) : ", math.tan(math.pi/2)print "tan(math.pi/4) : ", math.tan(math.pi/4)

The output result is as follows:

tan(3) : -0.142546543074tan(-3) : 0.142546543074tan(0) : 0.0tan(math.pi) : -1.22460635382e-16tan(math.pi/2) : 1.63317787284e+16tan(math.pi/4) : 1.0

Summary

The above is all the details about the introduction to the Python trigonometric function tan () function instance. I hope to help you. If you are interested, you can continue to refer to this site: Python introduction to trigonometric function sin () function examples, Python introduction to trigonometric function atan2 () function details, a simple understanding of several functions in Python, etc, if you have any questions, you can leave a message at any time. The editor will reply to you in a timely manner. Thank you for your support!

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.