math --- 数学関数

math モジュールは、浮動小数点数を扱うための基本的な数学関数をいくつか提供します。

注: OpenMV Cam では、浮動小数点数は 32 ビット精度です。

関数

math.acos(x: float) float

x の逆余弦を返します。

math.acosh(x: float) float

x の逆双曲線余弦を返します。

math.asin(x: float) float

x の逆正弦を返します。

math.asinh(x: float) float

x の逆双曲線正弦を返します。

math.atan(x: float) float

x の逆正接を返します。

math.atan2(y: float, x: float) float

y/x の逆正接の主値を返します。

math.atanh(x: float) float

x の逆双曲線正接を返します。

math.ceil(x: float) int

x を正の無限大方向に丸めた整数を返します。

math.copysign(x: float, y: float) float

y の符号を持つ x を返します。

math.cos(x: float) float

x の余弦を返します。

math.cosh(x: float) float

x の双曲線余弦を返します。

math.degrees(x: float) float

ラジアン x を度に変換して返します。

math.erf(x: float) float

x の誤差関数を返します。

math.erfc(x: float) float

x の相補誤差関数を返します。

math.exp(x: float) float

x の指数関数を返します。

math.expm1(x: float) float

exp(x) - 1 を返します。

math.fabs(x: float) float

x の絶対値を返します。

math.floor(x: float) int

x を負の無限大方向に丸めた整数を返します。

math.fmod(x: float, y: float) float

x/y の剰余を返します。

math.frexp(x: float) Tuple[float, int]

浮動小数点数を仮数部と指数部に分解します。返される値は x == m * 2**e が正確に成り立つようなタプル (m, e) です。x == 0 の場合、関数は (0.0, 0) を返します。それ以外の場合は 0.5 <= abs(m) < 1 の関係が成り立ちます。

math.gamma(x: float) float

x のガンマ関数を返します。

math.isfinite(x: float) bool

x が有限であれば True を返します。

math.isinf(x: float) bool

x が無限であれば True を返します。

math.isnan(x: float) bool

x が非数(NaN)であれば True を返します

math.ldexp(x: float, exp: int) float

x * (2**exp) を返します。

math.lgamma(x: float) float

x のガンマ関数の自然対数を返します。

math.log(x: float, base: float = e) float

引数が 1 つの場合、x の自然対数を返します。

引数が 2 つの場合、指定された base を底とする x の対数を返します。

math.log10(x: float) float

x の常用対数(底 10)を返します。

math.log2(x: float) float

x の底 2 の対数を返します。

math.modf(x: float) Tuple[float, float]

x の小数部と整数部からなる 2 つの float のタプルを返します。どちらの戻り値も x と同じ符号を持ちます。

math.pow(x: float, y: float) float

xy 乗を返します。

math.radians(x: float) float

x をラジアンに変換して返します。

math.sin(x: float) float

x の正弦を返します。

math.sinh(x: float) float

x の双曲線正弦を返します。

math.sqrt(x: float) float

x の平方根を返します。

math.tan(x: float) float

x の正接を返します。

math.tanh(x: float) float

x の双曲線正接を返します。

math.trunc(x: float) int

x を 0 方向に丸めた整数を返します。

定数

math.e: float

自然対数の底。

math.pi: float

円周の直径に対する比率。