Python math.cosh() 方法
示例
查詢不同數字的雙曲餘弦
# 匯入 math 庫
import math
# 返回不同數字的雙曲餘弦
print (math.cosh(1))
print (math.cosh(8.90))
print (math.cosh(0))
print (math.cosh(1.52))
自己動手試一試 »
定義和用法
math.cosh()
方法返回一個數字的雙曲餘弦(等同於 (exp(number) + exp(-number)) / 2)。
語法
math.cosh(x)
引數值
引數 | 描述 |
---|---|
x | 必需。一個用於查詢雙曲餘弦的數字。如果該值不是數字,則返回 TypeError。 |
技術詳情
返回值 | 一個 float 值,表示數字的雙曲餘弦。 |
---|---|
Python 版本 | 1.4 |