当前位置:首页 > python教程 > python进阶

Python math.cosh() 方法

python math.cosh() 方法

python math.cosh(x) 返回 x 的双曲余弦值,相当于 (exp(number) + exp(-number)) / 2。

python 版本: 1.4

语法

math.cosh() 方法语法如下:

math.cosh(x)

参数说明:

  • x -- 必需,个正数或负数。如果 x 不是一个数字,返回 typeerror。
返回值

返回一个浮点数,表示一个数字的双曲余弦值。

实例

以下实例返回不同数字的双曲余弦值:

实例

# 导入 math 包
import math

# 输出双曲余弦值
print (math.cosh(1))
print (math.cosh(8.90))
print (math.cosh(0))
print (math.cosh(1.52))

输出结果:

1.5430806348152437
3665.986837772461
1.0
2.395468541047187


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!