Python's Math module

Source: Internet
Author: User

1.math Introduction

>>>import Math      #导入math模块 >>>dir (math)        #这句可查看所有函数名列表 >>>help (math)       # View specific definitions and function prototypes

2. Common functions

ACOs (x) # Return the arc cosine (measured in radians) of X.asin (x) # Return the arc sine (measured in radians) of X.atan (x) # Return the arc tangent (measured in radians) of x.atan2 (y, x) # Return the arc tangent (measured I              n radians) of y/x.              # unlike Atan (y/x), the signs of both X and Y are Considered.ceil (x) # Return The ceiling of x as a float.       # This is the smallest integral value >= X.cos (x) # Return the cosine of x (measured in radians). cosh (x) # Return the hyperbolic (hyperbolic) cosine of x.degrees (x) # converts angle x from radians (radians) to Degreesexp (x) # Return e raised to the power of X.fabs (x) # Return the absolute value of the float X.floor (x) # return the Floo              R of X as a float.  # This is the largest integral value <= x.fmod (x, y) # Return Fmod-according to platform C.            X% y May differ.frexp (x) # Return the mantissa and exponent of X, as pair (M, e).  # m is a float and e are an int, such that x = M * 2.**e.  # If x is 0, M and e are both 0. Else 0.5 <= ABS (M) < 1.0.hypot (x, y) # Return The Euclidean distance, sqrt (x*x + y*y). Ldexp (x, i) # x * (2**i) Lo                 G (x[, Base]) # The logarithm of x to the given base. # If The base not specified, returns the natural logarithm (base e) of X.log10 (x) # The base of logarithm of X.MODF (x  ) # Return the fractional and integer parts of x.  Both results carry the sign # of X. The integer part is returned as a real.pow (x, y) # Return X**y (× to the power of Y). radians (x) # converts angle X From degrees to Radianssin (x) # return the sine of x (measured in radians). Sinh (x) # return the hyperbolic si       NE of X.sqrt (x) # return the square root of X.tan (x) # Return the tangent of x (measured in radians). Tanh (x) # Return the hyperbolic tangent of X.

In addition, the module defines two constants:

E  = 2.7182818284590451pi = 3.1415926535897931

Python's Math module

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.