python 的math模块
数学模块用法:
import math
# 或
from math import *
| 变量 | 描述 |
| math.e | 自然对数的底e |
| math.pi | 圆周率pi |
| 函数名 | 描述 |
| math.ceil(x) | 对x向上取整,比如x=1.2,返回2 |
| math.floor(x) | 对x向下取整,比如x=1.2,返回1 |
| math.sqrt(x) | 返回x的平方根 |
| math.factorial(x) | 求x的阶乘 |
| math.log(x[, base]) | 返回以base为底x的对数, 如果不给出base,则以自然对数e为底 |
| math.log10(x) | 求以10为底x的对数 |
| math.pow(x, y) | 返回 x**y (x的y次方) |
| math.fabs(x) | 返回浮点数x的绝对值 |
| math.degree(x) | 将弧度x转换为角度 |
| math.radians(x) | 将角度x转换为弧度 |
| math.sin(x) | 返回x的正弦(x为弧度) |
| math.cos(x) | 返回x的余弦(x为弧度) |
| math.tan(x) | 返回x的正切(x为弧度) |
| math.asin(x) | 返回x的反正弦(返回值为为弧度) |
| math.acos(x) | 返回x的反余弦(返回值为为弧度) |
| math.atan(x) | 返回x的反正切(返回值为为弧度) |
python 的math模块的更多相关文章
- python之math模块
1.math简介 >>>import math #导入math模块 >>>dir(math) #这句可查看所有函数名列表 >>>help(math ...
- python 之math模块
一.math 简介 import math # 导入模块 ret = dir(math) # 查看所有函数名列表 print(ret) # ['__doc__', '__loader__', '__n ...
- python中math模块常用的方法整理
ceil:取大于等于x的最小的整数值,如果x是一个整数,则返回x copysign:把y的正负号加到x前面,可以使用0 cos:求x的余弦,x必须是弧度 degrees:把x从弧度转换成角度 e:表示 ...
- Python的math模块
ceil(x) 返回整数 >>> math.ceil(-1.273) -1 >>> math.ceil(1.33) 2 copysign(x,y) 把y的符号给x, ...
- (转)python中math模块常用的方法整理
原文:https://www.cnblogs.com/renpingsheng/p/7171950.html#ceil ceil:取大于等于x的最小的整数值,如果x是一个整数,则返回x copysig ...
- 【转载】python中math模块常用的方法
转自:https://www.cnblogs.com/renpingsheng/p/7171950.html ceil #取大于等于x的最小的整数值,如果x是一个整数,则返回x ceil(x) Ret ...
- Python:python中math模块中提供的基本数学函数
sin(x):求x的正弦 cos(x):求x的余弦 asin(x):求x的反正弦 acos(x):求x的反余弦 tan(x):求x的正切 atan(x):求x的反正切 hypot(x,y):求直角三角 ...
- Python:基本运算、基本函数(包括复数)、Math模块、NumPy模块
基本运算 x**2 : x^2 若x是mat矩阵,那就表示x内每个元素求平方 inf:表示正无穷 逻辑运算符:and,or,not 字典的get方法 a.get(k,d) 1 1 get相当于一条if ...
- Python常用的一些内建函数和math模块函数
一:Python内建函数 # abs取绝对值 num = -10 print(abs(num)) # max 求最大值 print(max(6, 9, 2, 12, 8)) # min求最小值 pri ...
随机推荐
- C# 日志系统 log4net 配置及使用
1.引用Dll 版本是:1.2.10.0,下载Dll 2.Web.config文件配置 <?xml version="1.0" encoding="utf-8&qu ...
- android中SimpleCursorAdapter _id错误的问题
作为一个android新手,在绑定数据的时候是这样的 ListView listview=(ListView)this.findViewById(R.id.listView1); XJDal xj=n ...
- Unity3D笔记 GUI 二 、实现选项卡一窗口
实现目标: 1.个性化Box控件 2.新建TextAmount样式 3.新建TextItem样式 一.个性化Windows界面 设置GUI Skin 1.2 部分代码 Rect stateBox = ...
- 我的node+express小例子
启动index.js: var express = require("express"); var path = require("path"); var op ...
- easyui---easyloader.js
1.easyloader.js 是根据用户指定,动态加载组件,可以替换下面jqueryeasyui <!-- <script type="text/javascript" ...
- Scikit-learn技巧(拓展)总结
Scikit-learn技巧(拓展)总结 本文转载自:http://www.jianshu.com/p/516f009c0875 最近看了<Python数据挖掘入门与实战>,网上有说翻译地 ...
- 计蒜客 30994 - AC Challenge - [状压DP][2018ICPC南京网络预赛E题]
题目链接:https://nanti.jisuanke.com/t/30994 样例输入: 5 5 6 0 4 5 1 1 3 4 1 2 2 3 1 3 1 2 1 4 样例输出: 55 样例输入: ...
- HDU 6447 - YJJ's Salesman - [树状数组优化DP][2018CCPC网络选拔赛第10题]
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6447 Problem DescriptionYJJ is a salesman who has tra ...
- HDU 1686 - Oulipo - [KMP模板题]
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1686 Time Limit: 3000/1000 MS (Java/Others) Memory Li ...
- JDBC及Filter
JNDI容器:Java Naming Directory Interface,java命名目录接口EJB:javaEE服务器端组件模型,Enterprise JavaBean,设计目标与核心应用是建立 ...