math
-- 数学関数¶
このモジュールは、該当する CPython モジュールのサブセットを実装しています。
詳しくはオリジナルの CPython ドキュメンテーションを参照してください: math
.
math
モジュールは浮動小数点数を扱うための基本的な数学関数を提供します。
注記: pyboard では、浮動小数点は 32 ビット精度(単精度)です。
対応ポート: WiPy では利用できません。このモジュールには浮動小数点数のサポートが必要です。
関数¶
- math.acos(x)¶
x
の逆余弦を返します。
- math.acosh(x)¶
x
の双曲線逆余弦を返します。
- math.asin(x)¶
x
の逆正弦を返します。
- math.asinh(x)¶
x
の双曲線逆正弦を返します。
- math.atan(x)¶
x
の逆正接を返します。
- math.atan2(y, x)¶
y/x
の逆正接の主値を返します。
- math.atanh(x)¶
x
の双曲線逆正接を返します。
- math.ceil(x)¶
x
の正の無限大方向に丸めた整数値を返します。
- math.copysign(x, y)¶
x
をy
の符号で返します。
- math.cos(x)¶
x
の余弦を返します。
- math.cosh(x)¶
x
の双曲線余弦を返します。
- math.degrees(x)¶
ラジアン
x
を度に変換して返します。
- math.erf(x)¶
x
の誤差関数を返します。
- math.erfc(x)¶
x
の相補誤差関数を返します。
- math.exp(x)¶
x
の指数を返します。
- math.expm1(x)¶
exp(x) - 1
を返します。
- math.fabs(x)¶
x
の絶対値を返します。
- math.floor(x)¶
x
の負の無限大方向に丸めた整数を返します。
- math.fmod(x, y)¶
x/y
の剰余を返します。
- math.frexp(x)¶
浮動小数点数を仮数部と指数部に分解します。返される値は
x == m * 2**e
となる(m, e)
のタプルです。x == 0
の場合、関数は(0.0, 0)
を返します。さもなければ0.5 <= abs(m) < 1
の関係が成り立ちます。
- math.gamma(x)¶
x
のガンマ関数を返します。
- math.isfinite(x)¶
x
が有限数であればTrue
を返します。
- math.isinf(x)¶
x
が無限数であればTrue
を返します。
- math.isnan(x)¶
x
が非数(NaN: Not-a-Number)であればTrue
を返します。
- math.ldexp(x, exp)¶
x * (2**exp)
を返します。
- math.lgamma(x)¶
x
のガンマ関数の自然対数を返します。
- math.log(x)¶
- math.log(x, base)
引数が1つの場合は x の自然対数を返します。
引数が2つの場合は base を基数とした x の対数を返します。
- math.log10(x)¶
x
の常用対数を返します。
- math.log2(x)¶
x
の2進対数を返します。
- math.modf(x)¶
x
の小数部分と整数部分の2つの浮動小数点数のタプルを返します。両方の戻り値はx
と同じ符号を持ちます。
- math.pow(x, y)¶
x
のy
乗を返します。
- math.radians(x)¶
度
x
をラジアンに変換して返します。
- math.sin(x)¶
x
の正弦を返します。
- math.sinh(x)¶
x
の双曲線正弦を返します。
- math.sqrt(x)¶
x
の平方根を返します。
- math.tan(x)¶
x
の正接を返します。
- math.tanh(x)¶
x
の双曲線正接を返します。
- math.trunc(x)¶
x
の 0 方向に丸めた整数を返します。
定数¶
- math.e¶
自然対数の底
- math.pi¶
円の円周と直径の比(円周率)