acos acosh asin asinh atan atan2 atanh ceil cos cosh degrees e erf erfc exp expm1 fabs factorial floor fmod frexp fsum gamma gcd hypot inf isclose isfinite isinf isnan math.acos(x) math.acosh(x) math.asin(x) math.asinh(x) math.atan(x) math.atan2(x , y) math.atanh(x) math.ceil(x) math.cos(x) math.cosh(x) math.degrees(x) math.e math.erf(x) math.erfc(x) math.exp(x) math.expm1(x) math.fabs(x) math.factorial(x) math.floor(x) math.fmod(x , y) math.frexp(x) math.fsum([x , y , z , …]) math.gamma(x) math.gcd(x , y) math.hypot(x , y) math.inf math.isclose (a , b , rel_tol , abs_tol) math.isfinite(x) math.isinf(x) math.isnan(x) acos(x)=arccosx acosh(𝑥)=ln(𝑥+√𝑥2−1) asin(x)=arcsinx asinh(𝑥)=ln(𝑥+√𝑥2+1) atan(x)=arctanx 𝑥atan2(𝑥 ,𝑦)=atan() 𝑦atanh(x)=arctanh(x) 返回≥x的最小整数 返回与y同号的x值 cos(x)=cosx e𝑥+e−𝑥cosh(𝑥)= 2将 x (弧度) 转成角度 返回自然常数e=2.71828… erf(𝑥)=2√𝜋0erfc(x)=1-erf(x) exp (x)=ex expm1(x)=ex-1 以浮点数形式返回x的绝对值 返回x! 返回≤x的最大整数 返回(m , n),满足x=m×2n 其中m∈(-1,0)∪(0,1),n∈N* 以浮点数返回x+y+z+… +∞𝑥反余弦函数 反双曲余弦函数 反正弦函数 反双曲正弦函数 反正切函数 反双曲正切函数 与floor区别 双曲余弦函数 误差函数 erf(∞)=1 互补误差函数 指数函数 1是数字 0!=1 注意区别 math.ldexp(x , y) 伽马函数Γ(x) Python3.x独有 Python3.x独有 Python3.x独有 Python3.x独有 Not a Number copysign math.copysign(x , y) ×∫𝑒−𝑡d𝑡 2以浮点数形式返回x对y的取余 gamma(𝑥)=∫0𝑡𝑥−1𝑒−𝑡d𝑡 返回两个数的最大公约数 hypot(𝑥 ,𝑦)=√𝑥2+𝑦2 返回inf(无穷) 判断a与b是否近似相等 判断x是否非inf或者nan 判断x是否为±inf 判断x是否为nan ldexp lgamma log log10 loglp log2 modf nan pi pow radians sin sinh sqrt tan tanh tau trunc math.ldexp(x , y) math.lgamma(x) math.log(x , a) math.log10(x) math.log1p(x) math.log2(x) math.modf(x) math.nan math.pi math.pow(x , y) math.radians(x) math.sin(x) math.sinh(x) math.sqrt(x) math.tan(x) math.tanh(x) math.tau math.trunc(x) 以浮点数形式返回x×2y lgamma(x)=ln|gamma(x)| log(x , a)=logax log10(x)=lg(x) log1p(x)=ln(1+x) log2(x)=log2x 浮点返回x的小数部分与整数 返回π 浮点返回xy 将x的角度转换为弧度 sin(x)=sinx e𝑥−e−𝑥sinh(𝑥)= 2sqrt(𝑥)=√𝑥 tan(x)=tanx e𝑥−e−𝑥sinh(𝑥)=𝑥 e+e−𝑥返回2π 返回x的整数部分,相当于int |gamma|取e对数 1p中1是数字 Python3.x独有 与pow函数区别 双曲正弦 双曲正切 Python3.x独有 返回nan(非数值:Not a Number) Python3.x独有 部分函数的说明: math模块isclose函数
使用格式:math.isclose(a , b , rel_tol = c, abs_tol = d) 函数意义:满足abs(a-b)≤max{c × max{abs(a) , abs(b)} , d}返回True,否则返回False。
math模块fmod函数与%的区别
fmod函数:
1. >>> import math 2. >>> math.fmod(4 , 5) 3. 4.0
4. >>> math.fmod(4 , -5.0) 5. 4.0
6. >>> math.fmod(-4 , 5) 7. -4.0
8. >>> math.fmod(-4 , -5) 9. -4.0
操作符%:
1. >>> 2. >>> 4 % 5 3. 4
4. >>> 4 % -5.0 5. -1.0 6. >>> -4 % 5 7. 1
8. >>> -4 % -5 9. -4
math.fmod(x , y)返回值一定为浮点数,x % y返回值与原始数值保持一致; math.fmod(x , y)返回值正负与x保持一致,x % y返回值正负与y保持一致。
因篇幅问题不能全部显示,请点此查看更多更全内容