Python math.erf() メソッド
Python math.erf(x)メソッドは数値の誤差関数を返します
math.erf(x)メソッドは -inf と +inf の間の値を受け入れ、-1 から +1 の間の値を返します。
Python バージョン: 3.2
構文
math.erf() メソッドの構文は次のとおりです:
math.erf(x)
パラメータの説明:
- xx -- 必須、数値。x が数値でない場合は TypeError を返します。
戻り値
数値の誤差関数を表す浮動小数点数。
例
次の例では、同じ正負の数値の誤差関数を計算します:
例
# math パッケージをインポート
import math
# 誤差関数を出力
print (math.erf(1.28))
print (math.erf(-1.28))
import math
# 誤差関数を出力
print (math.erf(1.28))
print (math.erf(-1.28))
出力結果:
0.9297341930135782 -0.9297341930135782その他の拡張
Python math モジュール