1.math Introduction
>>> Import Math
>>>dir (Math) #这句可查看所有函数名列表
[' __doc__ ', ' __name__ ', ' __package__ ', ' ACOs ', ' acosh ', ' asin ', ' Asinh ', ' atan ', ' atan2 ', ' Atanh ', ' ceil ', ' copysign ', ' Co S ', ' cosh ', ' degrees ', ' e ', ' Erf ', ' erfc ', ' exp ', ' expm1 ', ' fabs ', ' factorial ', ' floor ', ' fmod ', ' frexp ', ' fsum ', ' Gamma ', ' Hypot ', ' isinf ', ' isNaN ', ' ldexp ', ' lgamma ', ' Log ', ' log10 ', ' log1p ', ' modf ', ' pi ', ' pow ', ' radians ', ' sin ', ' sinh ', ' sq ' RT ', ' tan ', ' tanh ', ' trunc '
>>>help (Math) #查看具体定义及函数0原型
>>>help (math.function) # View functions under the Math Module
2. Common functions
Ceil (x) Fetch top
Return the ceiling of x as a float.
This is the smallest integral value >= x.
Floor (x) Bottom
Return the floor of X as a float.
This is the largest integral value <= x.
Fabs (x) Take absolute value
Return the absolute value of the float x.
Factorial (x) factorial
Find x!. Raise a valueerror if x is negative or non-integral.
Hypot (x, y) Right triangle bevel length
Return the Euclidean distance, sqrt (x*x + y*y)
The Y-square of the POW (x, y) x
Return x**y (x to the power of Y).
sqrt (x) Open Square
Return the square root of X.
Log (X[,base])
Return the logarithm of x to the given base.
If the base is not specified, returns the natural logarithm (base e) of X.
LOG10 (x)
Return the base ten logarithm of X.
Trunc (x) truncation of rounding parts
Truncates x to the nearest Integral toward 0. Uses the __trunc__ Magic method.
isNaN (x) determines whether Nan (not a number)
Check if float x is not a number (NaN)
Degrees (x) radian Turn angle
Convert angle x from radians to degrees.
radians (x) angle to radians
Convert angle x from degrees to radians.
In addition, the module defines two constants:
E = 2.718281828459045
PI = 3.141592653589793
Python Math Module