博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
python独立log示例_带有Python示例的math.log1p()方法
阅读量:2531 次
发布时间:2019-05-11

本文共 1344 字,大约阅读时间需要 4 分钟。

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 moduleimport math# log1p()x = 21print("Natural logarithm of 1 +", x, " is = ", math.log1p(x))x = 10.23print("Natural logarithm of 1 +", x, " is = ", math.log1p(x))

Output

输出量

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

翻译自:

python独立log示例

转载地址:http://guxzd.baihongyu.com/

你可能感兴趣的文章
Flask项目之手机端租房网站的实战开发(十)
查看>>
adb常用命令
查看>>
[总结]编程中遇到的vc提示的一些警告
查看>>
Python学习笔记-EXCEL操作
查看>>
9.for循环
查看>>
百度PaddlePaddle再获新技能 智能推荐、对话系统、控制领域都能搞定!
查看>>
SELINUX setsebool
查看>>
C#的Socket程序(TCP/IP)总结
查看>>
java源码生成可运行jar
查看>>
用一个常见的生活小例子来解释和演示面向接口编程
查看>>
找出数组中两个只出现一次的数字
查看>>
【TYVJ水题三连发】1502 兴建高铁 1568 Rabbit Number 1673 位图
查看>>
centos 允许远程连接mysql
查看>>
最近几个月的感想
查看>>
CSS动画效果
查看>>
JS递归
查看>>
[转帖] IIS经典模式和集成模式的区别
查看>>
Asp.Net生命周期
查看>>
RCNN
查看>>
UVa 10305 给任务排序
查看>>