python独立log示例

Python math.log1p()方法 (Python math.log1p() method)

math.log1p() method is a library method of math module, it is used to get the natural logarithm of 1+x (base e), it accepts a number and returns the natural logarithm of 1+number on base e.

math.log1p()方法数学模块的库方法,用于获取1 + x(以e为底)的自然对数,它接受一个数字并以e基础返回1+数字的自然对数。

Note: If we provide anything else except a number, the method returns a TypeError – "TypeError: a float is required".

注意:如果我们提供除数字以外的任何其他内容,该方法将返回TypeError – “ TypeError:需要浮点数”

Syntax of math.log1p() method:

math.log1p()方法的语法:

    math.log1p(x)

Parameter(s):x – is the number whose logarithm to be calculated.

参数: x –是要计算其对数的数字。

Return value: float – it returns a float value that is the natural logarithm of 1 + x.

返回值: float-返回一个浮点值,它是1 + x的自然对数。

Example:

例:

    Input:
x = 21
# function call
print(math.log1p(x))
Output:
3.091042453358316

Python代码演示math.log1p()方法的示例 (Python code to demonstrate example of math.log1p() method)

# python code to demonstrate example of
# math.log1p() method
# importing math module
import math
# log1p()
x = 21
print("Natural logarithm of 1 +", x, " is = ", math.log1p(x))
x = 10.23
print("Natural logarithm of 1 +", x, " is = ", math.log1p(x))

Output

输出量

Natural logarithm of 1 + 21  is =  3.091042453358316
Natural logarithm of 1 + 10.23  is =  2.418588768750352

翻译自: https://www.includehelp.com/python/math-log1p-method-with-example.aspx

python独立log示例

python独立log示例_带有Python示例的math.log1p()方法相关推荐

  1. python独立log示例_带有Python示例的math.log()方法

    python独立log示例 Python math.log()方法 (Python math.log() method) math.log() method is a library method o ...

  2. python requests 异步调用_带有Python请求的异步请求

    小编典典 注意 下面的答案是不适用于请求v0.13.0 +.编写此问题后,异步功能已移至grequests.但是,你可以将其替换requests为grequests下面的内容,它应该可以工作. 我已经 ...

  3. factorial函数_带有Python示例的math.factorial()方法

    factorial函数 Python math.factorial()方法 (Python math.factorial() method) math.factorial() method is a ...

  4. python 示例_在Python中带有示例的while关键字

    python 示例 关键字的Python (Python for keyword) while is a keyword (case-sensitive) in python, it is used ...

  5. frexp 中文_带有Python示例的math.frexp()方法

    frexp 中文 Python math.frexp()方法 (Python math.frexp() method) math.frexp() method is a library method ...

  6. python中math.ceil是什么意思_带有Python示例的math.ceil()方法

    Python math.ceil() 方法 math.ceil()方法是数学模块的库方法,用于获取给定数字的ceil值,它接受数字/数字表达式并返回大于该数字的最小整数值. 注意:如果数字是整数值,则 ...

  7. python实现邮件客户端_利用python实现简单的邮件发送客户端示例

    脚本过于简单,供学习和参考.主要了解一下smtplib库的使用和超时机制的实现.使用signal.alarm实现超时机制. #!/usr/bin/env python # -*- coding: ut ...

  8. python常用语法和示例_使用Python中的示例进行输入和输出操作

    python常用语法和示例 A Program needs to interact with the user to accomplish the desired task; this is done ...

  9. python 强制结束线程_在python中实现强制关闭线程的示例

    Python 如何强制关闭线程过去只可以用来回忆,别沉迷在阴影中,否则永远看不清前面的路. Python用sleep停止一个线程的运行,而不影响主线程的运行,案例代码如下: from threadin ...

最新文章

  1. matlab.10折交叉验证
  2. oracle逻辑结构包含,在Oracle中,逻辑结构由哪几个部分组成?
  3. cvtcolor python opencv_二值分析 | OpenCV + skimage如何提取中心线
  4. Redux/Mobx面试题汇总
  5. GPRS底层API(转)
  6. 优先级队列用的的数据结构
  7. Python 代码格式化工具 「Black」 使用详解(摘录翻译自官方文档)
  8. Qt 绘制炫彩滚动文本
  9. EDA实验(3)计数器设计
  10. 《中国程序化广告技术生态图》2015年三月号更新发布
  11. 如何用python turtle 画出奥运五环图
  12. Lua程序设计读书 随笔
  13. 字符串String s =sfds55d676455dfg32434eertre; 怎么样把非数字全部去除,只保留数字?
  14. 农副产品视觉检测——大米外观品质检测仪
  15. java验证歌德巴赫猜想
  16. 2019年互联网产业人才发展报告显示:互联网产业人才需求整体回暖
  17. 数据存储之归档解档 NSKeyedArchiver NSKeyedUnarchiver
  18. linux如何查看本地yum源地址,CentOS配置本地yum源
  19. maven优先引用本地库_maven默认本地仓库
  20. paylinks.php_私服发布网站PHP程序(含系统安装教程)

热门文章

  1. python 怎么将数组转为列表_怎么将视频转为GIF动态图 表情包怎么制作
  2. php3.2.3 升级,thinkphp3.2.3 升级到3.2.4时出错问题
  3. uc3842改可调电源教程_明纬开关电源改可调详细教程
  4. 八个角最多可以把平面分成多少部分?_一个空间最多能被分成几块?
  5. 世上最简单的mysql_mysql这样学最简单|基本操作上
  6. Google File System 学习笔记
  7. 在线图表编辑工具 draw.io 10.6.5 版本发布
  8. html的学习思维导图
  9. spring boot 1.4默认使用 hibernate validator
  10. WPF自定义控件与样式(5)-Calendar/DatePicker日期控件自定义样式及扩展