1 / 16
文档名称:

python库-math.docx

格式:docx   大小:20KB   页数:16页
下载后只包含 1 个 DOCX 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

python库-math.docx

上传人:mh900965 2017/12/21 文件大小:20 KB

下载得到文件列表

python库-math.docx

文档介绍

文档介绍:import math
dir(math)
Out[2]:
['__doc__',
'__name__',
'__package__',
'acos',---反余弦
'acosh',---反双曲余弦
'asin',---反正弦
'asinh',---反双曲正弦
'atan',---反正切
'atan2',---(y,x),y/x的反正切
'atanh',---反双曲正切
'ceil',---返回>=x的最小整数,反floor
'copysign',---(x,y),返回与y同号的x值(改变x值符号)
'cos',---余弦
'cosh',---反余弦
'degrees',---将弧长转化为角度,反radians
'e',---2。7128
'erf',---误差函数
'erfc',---1-erf
'exp',---e的x次方
'expm1',---e的x次方-1
'fabs',---绝对值
'factorial',---x阶乘
'floor',---返回<=x的最大整数,反ceil
'fmod',--- 返回 x对y取模的余数,以x来决定余数的符号,%以y来决定余数的符号
'frexp',---反ldexp,frexp(x),返回m,n
'fsum',---返回x阵列各项和,([2,5])
'gamma',---伽马函数
'hypot',---hypot(x,y)平方和开根号
'isinf',---是否为正负无穷大,是则true
'isnan',---x = NaN,true,x为0也返回false
'ldexp',---ldexp(x,y),输出m*2的n次方,反frexp
'lgamma',---伽马函数的自然对数
'log',---log(x,a),a不写则为e
'log10',---log10(x)
'log1p',--- 返回 
'modf',--- 返回 x 的小数部份与整数部份,似trunc
'pi',---π
'pow',--- 返回 xy
'radians',--- 將 x(角度) 转成弧长,与 degrees 为反函数
'sin',---正弦
'sinh',---反正弦
'sqrt',---开根号
'tan',---正切
'tanh',---反正切
'trunc']--- 返回 x 的整数部份,等同 int,似modf
两个常量pi,e
举例:
(5,3)
Out[12]:
In [14]: (-5,3)
Out[14]: -
In [15]: (5,-3)
Out[15]:
In [16]: (-5,-3)
Out[16]: -
5%3
Out[17]: 2
5%(-3)
Out[19]: -1
-5%3
Out[20]: 1
-5%(-3)
Out[21]: -2
官方文档:
. math — Mathematical functions
This module is always available. It provides access to the mathematical functions defined by the C standard.
These functions cannot be used plex numbers; use the functions of the same name from the cmath module if you require support plex numbers. The distinction between functions which plex numbers and those which don’t is made since most users do not want to learn quite as much mathematics as required to plex numbers. Receiving an exception instead of plex result allows earlier detection of the plex number used as a parameter, so that the programmer can determine how and why it was gene