码迷,mamicode.com
首页 > 编程语言 > 详细

python标准库《math》

时间:2018-10-13 00:02:19      阅读:877      评论:0      收藏:0      [点我收藏+]

标签:eval   not   公约数   use   log   dexp   similar   iterable   测量   

>>> import math
>>> help(math)
Help on built-in module math:
NAME
math
DESCRIPTION
This module is always available. It provides access to the mathematical functions defined by the C standard.
这个模块总是可用的。它提供了对由C标准定义的数学函数。
FUNCTIONS
acos(x, /)
Return the arc cosine (measured in radians) of x.
返回弧余弦(用弧度测量)。
acosh(x, /)
Return the inverse hyperbolic cosine of x.
返回X的逆双曲余弦。
asin(x, /)
Return the arc sine (measured in radians) of x.
返回弧的正弦(以弧度测量)。
asinh(x, /)
Return the inverse hyperbolic sine of x.
返回x的逆双曲正弦。
atan(x, /)
Return the arc tangent (measured in radians) of x.
返回X的弧切线(以弧度测量)。
atan2(y, x, /)
Return the arc tangent (measured in radians) of y/x.
返回Y/X的弧切线(以弧度测量)。
Unlike atan(y/x), the signs of both x and y are considered.
与atan(Y/X)不同,考虑了X和Y的符号。
atanh(x, /)
Return the inverse hyperbolic tangent of x.
返回x的逆双曲正切。
ceil(x, /)
Return the ceiling of x as an Integral.
将X的上限作为积分返回。
This is the smallest integer >= x.
这是最小的整数>=x。
copysign(x, y, /)
Return a float with the magnitude (absolute value) of x but the sign of y.
返回一个具有X的大小(绝对值)但Y的符号的浮标。
On platforms that support signed zeros, copysign(1.0, -0.0)
在支持符号零点的平台上,复制符号(1,-0)
returns -1.0.
返回- 1。
cos(x, /)
Return the cosine of x (measured in radians).
返回X的余弦(用弧度测量)。
cosh(x, /)
Return the hyperbolic cosine of x.
返回X的双曲余弦。
degrees(x, /)
Convert angle x from radians to degrees.
将角度X从弧度转换成度。
erf(x, /)
Error function at x.
x的误差函数。
erfc(x, /)
Complementary error function at x.
x的互补误差函数
exp(x, /)
Return e raised to the power of x.
返回E提高到X的功率。
expm1(x, /)
Return exp(x)-1.
This function avoids the loss of precision involved in the direct evaluation of exp(x)-1 for small x.
该函数避免了对小X的EXP(X)- 1的直接评价所涉及的精度损失。
fabs(x, /)
Return the absolute value of the float x.
返回浮点X的绝对值。
factorial(x, /)
Find x!.
Raise a ValueError if x is negative or non-integral.
如果x是负的或非整数的,则增加一个值错误。
floor(x, /)
Return the floor of x as an Integral.
返回X的向下取整。
This is the largest integer <= x.
这是最大的整数<x.
fmod(x, y, /)
Return fmod(x, y), according to platform C.
返回FMOD(X,Y),根据平台C。
x % y may differ.
frexp(x, /)
Return the mantissa and exponent of x, as pair (m, e).
返回尾数和x的指数,作为对(m,e)。
m is a float and e is an int, such that x = m * 2.**e.
M是一个浮点,E是int,因此x= m * 2。
If x is 0, m and e are both 0. Else 0.5 <= abs(m) < 1.0.
如果x是0,m和e都是0。否则0.5 <ABS(m)<1。
fsum(seq, /)
Return an accurate floating point sum of values in the iterable seq.
在迭代的SEQ中返回精确的浮点值和。
Assumes IEEE-754 floating point arithmetic.
假设IEEE-74浮点运算。
gamma(x, /)
Gamma function at x.
gcd(x, y, /)
greatest common divisor of x and y
X和Y的最大公约数
hypot(x, y, /)
Return the Euclidean distance, sqrt(x*x + y*y).
返回欧几里得距离,sqrt(x*x+y*y)。
isclose(a, b, *, rel_tol=1e-09, abs_tol=0.0)
Determine whether two floating point numbers are close in value.
确定两个浮点数的值是否接近。
rel_tol
maximum difference for being considered "close", relative to the magnitude of the input values
被认为是“接近”的最大差异,相对于输入值的大小
abs_tol
maximum difference for being considered "close", regardless of the magnitude of the input values Return True if a is close in value to b, and False otherwise.
被认为是“接近”的最大差异,不管输入值的大小如果A值接近B,则返回true,否则为false。
For the values to be considered close, the difference between them
对于要考虑的值,它们之间的差异
must be smaller than at least one of the tolerances.
必须小于公差中的至少一个。
-inf, inf and NaN behave similarly to the IEEE 754 Standard. That
INF、INF和NAN的行为类似于IEEE 754标准。那
is, NaN is not close to anything, even itself. inf and -inf are
是,楠不接近任何东西,甚至它自己。INF和INF都是
only close to themselves.
只有接近自己。
isfinite(x, /)
Return True if x is neither an infinity nor a NaN, and False otherwise.
如果x既不是无穷大也不是NA,则返回true,否则为false。
isinf(x, /)
Return True if x is a positive or negative infinity, and False otherwise.
如果x是正的或负的无穷大,则返回真,否则为假。
isnan(x, /)
Return True if x is a NaN (not a number), and False otherwise.
如果x是楠(不是数字),则返回true,否则为false。
ldexp(x, i, /)
Return x * (2**i).
返回x*(2×*i)。
This is essentially the inverse of frexp().
这基本上是FrxPh()的倒数。
lgamma(x, /)
Natural logarithm of absolute value of Gamma function at x.
X的Γ函数绝对值的自然对数。
log(...)
log(x, [base=math.e])
Return the logarithm of x to the given base.
将X的对数返回到给定的基数。
If the base not specified, returns the natural logarithm (base e) of x.
如果未指定基,则返回X的自然对数(基E)。
log10(x, /)
Return the base 10 logarithm of x.
返回x的基10对数。
log1p(x, /)
Return the natural logarithm of 1+x (base e).
返回1±x(基E)的自然对数。
The result is computed in a way which is accurate for x near zero.
结果以精确接近x的方式计算。
log2(x, /)
Return the base 2 logarithm of x.
返回x的基2对数。
modf(x, /)
Return the fractional and integer parts of x.
返回X的分数和整数部分。
Both results carry the sign of x and are floats.
两个结果都带有x的符号,并且是浮点数。
pow(x, y, /)
Return x**y (x to the power of y).
返回x**y(x到y的幂)。
radians(x, /)
Convert angle x from degrees to radians.
将角度x从度转换为弧度。
remainder(x, y, /)
Difference between x and the closest integer multiple of y.
x与y的最近整数倍之差。
Return x - n*y where n*y is the closest integer multiple of y.
返回x -n*y,其中n*y是y的最接近整数倍。
In the case where x is exactly halfway between two multiples of
在x正好介于两个倍数之间的情况下
y, the nearest even value of n is used. The result is always exact.
Y,使用n的最近偶数值。结果总是精确的。
sin(x, /)
Return the sine of x (measured in radians).
返回X的正弦(以弧度测量)。
sinh(x, /)
Return the hyperbolic sine of x.
返回x的双曲正弦。
sqrt(x, /)
Return the square root of x.
返回X的平方根。
tan(x, /)
Return the tangent of x (measured in radians).
返回X的切线(以弧度测量)。
tanh(x, /)
Return the hyperbolic tangent of x.
返回x的双曲正切。
trunc(x, /)
Truncates the Real x to the nearest Integral toward 0.
将实X截断为最近的积分,朝向0。
Uses the __trunc__ magic method.
使用γ-Trunthix-魔方法。
DATA
e = 2.718281828459045
e=2.718281828459045
inf = inf
INF=INF
nan = nan
pi = 3.141592653589793
π=3.141592653589793
tau = 6.283185307179586
τ=6.283185307179586
FILE

python标准库《math》

标签:eval   not   公约数   use   log   dexp   similar   iterable   测量   

原文地址:https://www.cnblogs.com/whxutao/p/9780847.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!