mathモジュール
数値 数表現 判定 計算 集合 指数関数 対数関数 三角関数 ※ラジアンで指定。※戻り値もラジアン 2点間の直線距離 角度変換 ラジアン⇄角度 双曲線関数 特殊関数 定数 数値 Python - math.inf:無限大 数表現 Python - math.fabs(x):絶対値 Python - math.ceil…
概要 インポート 実行結果 表示イメージ 概要nan 浮動小数点型(非数値)Nanの値 mathモジュール インポート import math 実行結果 import math print(math.nan) 表示イメージ nan
概要 インポート 実行結果 表示イメージ 概要inf 浮動小数の正の無限大 mathモジュール インポート import math 実行結果 import math print(math.inf) 表示イメージ inf
概要 インポート 実行結果 表示イメージ 概要tau 円定数Tau(2π)「円周と半径の比」 mathモジュール インポート import math 実行結果 import math print(math.tau) 表示イメージ 6.283185307179586
概要 インポート 実行結果 表示イメージ 概要e 自然対数の底 mathモジュール インポート import math 実行結果 import math print(math.e) 表示イメージ 2.718281828459045
概要 インポート 実行結果 表示イメージ 概要pi 円周率 mathモジュール インポート import math 実行結果 import math print(math.pi) 表示イメージ 3.141592653589793
概要 インポート 実行結果 表示イメージ 概要lgamma(x) ガンマ関数で絶対値の自然対数 mathモジュール インポート import math 実行結果 import math print(math.lgamma(1)) print(math.lgamma(2)) print(math.lgamma(3)) 表示イメージ 0.0 0.0 0.6931471805…
概要 インポート 実行結果 表示イメージ 概要gamma(x) ガンマ関数 mathモジュール ちょこっとメモガンマ関数(複素階乗)階乗を一般化する関数。複素数全体におよぶ。 インポート import math 実行結果 import math print(math.gamma(1)) print(math.gamma(2))…
概要 インポート 実行結果 表示イメージ 概要erfc(x) 相補誤差関数 (記号:「erfc」) 1-xが桁落ちのとき(x=大きな数) に利用。 mathモジュール インポート import math 実行結果 import math print(math.erfc(1)) print(math.erfc(0)) print(math.erfc(-1…
概要 インポート 実行結果 表示イメージ 概要erf(x) 誤差関数 mathモジュール ちょこっとメモ誤差関数(ガウスの誤差関数)数学におけるシグモイド形状の特殊関数。記号:「erf 」インポート import math 実行結果 import math print(math.erf(1)) print(math.…
概要 インポート 実行結果 表示イメージ 概要atanh(x) -1<x<1 逆双曲線正接 mathモジュール インポート import math 実行結果 import math print(math.atanh(0.5)) print(math.atanh(0)) print(math.atanh(-0.5)) 表示イメージ 0.5493061443340548 0.0 -…
概要 インポート 実行結果 表示イメージ 概要acosh(x) 逆双曲線余弦 mathモジュール インポート import math 実行結果 import math print(math.cosh(1)) print(math.cosh(0)) print(math.cosh(-1)) 表示イメージ 1.5430806348152437 1.0 1.5430806348152437
概要 インポート 実行結果 表示イメージ 概要asinh(x) 逆双曲線正弦 mathモジュール インポート import math 実行結果 import math print(math.asinh(1)) print(math.asinh(0)) print(math.asinh(-1)) 表示イメージ 0.881373587019543 0.0 -0.881373587019543
概要 インポート 実行結果 表示イメージ 概要tanh(x) 双曲線正接 mathモジュール インポート import math 実行結果 import math print(math.tanh(1)) print(math.tanh(0)) print(math.tanh(-1)) 表示イメージ 0.7615941559557649 0.0 -0.7615941559557649
概要 インポート 実行結果 表示イメージ 概要cosh(x) 双曲線余弦 mathモジュール インポート import math 実行結果 import math print(math.cosh(1)) print(math.cosh(0)) print(math.cosh(-1)) 表示イメージ 1.5430806348152437 1.0 1.5430806348152437
概要 インポート 実行結果 表示イメージ 概要sinh(x) 双曲線正弦 mathモジュール インポート import math 実行結果 import math print(math.sinh(1)) print(math.sinh(0)) print(math.sinh(-1)) 表示イメージ 1.1752011936438014 0.0 -1.1752011936438014
概要 インポート 実行結果 表示イメージ 概要asinh(x) 逆双曲線正弦 mathモジュール インポート import math 実行結果 import math print(math.asinh(1)) print(math.asinh(0)) print(math.asinh(-1)) 表示イメージ 0.881373587019543 0.0 -0.881373587019543
概要 インポート 実行結果 表示イメージ 概要acosh(x) 逆双曲線余弦 mathモジュール インポート import math 実行結果 import math print(math.cosh(1)) print(math.cosh(0)) print(math.cosh(-1)) 表示イメージ 1.5430806348152437 1.0 1.5430806348152437
概要 インポート 実行結果 表示イメージ 概要hypot(*coordinates) ユークリッドノルム(原点→座標のベクトルの長さ) mathモジュール インポート import math 実行結果 import math print(math.hypot(2)) print(math.hypot(2,2)) print(math.hypot(2,2,2)) 表…
概要 インポート 実行結果 表示イメージ 概要dist(p, q) ユークリッド(2点間の直線)距離 mathモジュール インポート import math 実行結果 import math print(math.dist((0, 0),(2, 2))) print(math.dist((4, 1),(1, 5))) print(math.dist((0, 0, 0),(2, 2, …
概要 インポート 実行結果 表示イメージ 概要radians(x) 角度→ラジアン mathモジュール インポート import math 実行結果 import math print(math.radians(0)) print(math.radians(45)) print(math.radians(90)) print(math.radians(180)) 表示イメージ 0.0 …
概要 インポート 実行結果 表示イメージ 概要degrees(x) ラジアン→角度 mathモジュール インポート import math 実行結果 import math print(math.degrees(0)) print(math.degrees(0.7853981633974483)) print(math.degrees(1.5707963267948966)) print(math…
概要 インポート 実行結果 表示イメージ 概要tan(x) 正接(タンジェント) mathモジュール インポート import math 実行結果 import math print(math.tan(1)) print(math.tan(0)) print(math.tan(-1)) 表示イメージ 1.5574077246549023 0.0 -1.5574077246549023
概要 インポート 実行結果 表示イメージ 概要sin(x) 正弦(サイン) mathモジュール インポート import math 実行結果 import math print(math.sin(1)) print(math.sin(0)) print(math.sin(-1)) 表示イメージ 0.8414709848078965 0.0 -0.8414709848078965
概要 インポート 実行結果 表示イメージ 概要atan2(y, x) 原点→(x,y)のベクトルとX軸正方向との角度 (極座標平面上) mathモジュール インポート import math 実行結果 import math print(math.atan2(0,0)) print(math.atan2(1,1)) print(math.atan2(1,0)) print…
概要 インポート 実行結果 表示イメージ 概要cos(x) 余弦 (コサイン) mathモジュール インポート import math 実行結果 import math print(math.cos(1)) print(math.cos(0)) print(math.cos(-1)) 表示イメージ 0.5403023058681398 1.0 0.5403023058681398
概要 インポート 実行結果 表示イメージ 概要atan(x) 逆正接(アークタンジェント) mathモジュール インポート import math 実行結果 import math print(math.atan(1)) print(math.atan(0)) print(math.atan(-1)) 表示イメージ 0.7853981633974483 0.0 -0.785…
概要 インポート 実行結果 表示イメージ 概要asin(x) 逆正弦(アークサイン) mathモジュール インポート import math 実行結果 import math print(math.asin(1)) print(math.asin(0)) print(math.asin(-1)) 表示イメージ 1.5707963267948966 0.0 -1.570796326…
概要 インポート 実行結果 表示イメージ 概要acos(x) 逆余弦(アークコサイン) mathモジュール インポート import math 実行結果 import math print(math.acos(1)) print(math.acos(0)) print(math.acos(-1)) 表示イメージ 0.0 1.5707963267948966 3.14159265…
概要 インポート 実行結果 表示イメージ 概要sqrt(x) 平方根(ルート√) mathモジュール インポート import math 実行結果 import math print(math.sqrt(2)) print(math.sqrt(4)) 表示イメージ 1.4142135623730951 2.0