“模块1:math库的使用”的版本间的差异

来自CloudWiki
跳转至: 导航搜索
(创建页面,内容为“==函数库的引用== *两种方式 ==math库解析== ===数学常数 === ===数值表示函数 === ===幂对数函数=== ===三角运算函数=== ===高等特殊…”)
 
第1行: 第1行:
 
==函数库的引用==
 
==函数库的引用==
 
*两种方式
 
*两种方式
 
+
*第1种:
 +
>>>import math
 +
>>>math.ceil(10,2)
 +
*第2种:
 +
>>>from math import floor
 +
 +
>>>from math import *
 
==math库解析==
 
==math库解析==
 
===数学常数 ===
 
===数学常数 ===
 +
math.pi
 +
math.e
 +
math.inf
 +
math.nan
 
===数值表示函数 ===
 
===数值表示函数 ===
 +
math.fabs(x)
 +
math.fmod(x,y):求余数
 +
math.fsum([x,y,...])
 +
math.ceil(x)
 +
math.floor(x)
 +
math.factorial(x)
 +
math.gcd(a,b)
 
===幂对数函数===
 
===幂对数函数===
 +
math.pow(x,y)
 +
math.exp(x)
 +
 
===三角运算函数===
 
===三角运算函数===
 +
math.degree(x)
 +
math.radians(x)
 +
math.sin(x)
 +
math.cos(x)
 +
math.tan(x)
 
===高等特殊函数==
 
===高等特殊函数==
  
 
下一节 [[实例3:天天向上的力量]]
 
下一节 [[实例3:天天向上的力量]]

2018年2月6日 (二) 03:32的版本

函数库的引用

  • 两种方式
  • 第1种:
>>>import math
>>>math.ceil(10,2)
  • 第2种:
>>>from math import floor

>>>from math import *

math库解析

数学常数

math.pi
math.e
math.inf
math.nan

数值表示函数

math.fabs(x)
math.fmod(x,y):求余数
math.fsum([x,y,...])
math.ceil(x)
math.floor(x)
math.factorial(x)
math.gcd(a,b)

幂对数函数

math.pow(x,y)
math.exp(x)

三角运算函数

math.degree(x)
math.radians(x)
math.sin(x)
math.cos(x)
math.tan(x)

=高等特殊函数

下一节 实例3:天天向上的力量