Python math.cosh() メソッド

Python math 模块Python math モジュール

Python math.cosh(x)x の双曲線余弦(ハイパボリックコサイン)の値を返します。(exp(number) + exp(-number)) / 2 に相当します。

Python バージョン: 1.4

構文

math.cosh() メソッドの構文は次のとおりです:

math.cosh(x)

パラメータの説明:

  • xx -- 必須。正の数または負の数。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

Python math 模块Python math モジュール

その他の拡張