scipy.special.ndtr#
- scipy.special.ndtr(x, out=None) = <ufunc 'ndtr'>#
標準常態分佈的累積分布函數。
返回標準高斯機率密度函數下的面積,從負無限積分到 x
\[\frac{1}{\sqrt{2\pi}} \int_{-\infty}^x \exp(-t^2/2) dt\]- 參數:
- xarray_like, real or complex
引數
- outndarray, optional
函數結果的可選輸出陣列
- 返回:
- 純量或 ndarray
在 x 處評估的常態 CDF 值
另請參閱
log_ndtr
ndtr 的對數
ndtri
ndtr 的反函數,標準常態百分位函數
erf
誤差函數
erfc
1 - erf
scipy.stats.norm
常態分佈
範例
在一個點評估
ndtr
。>>> import numpy as np >>> from scipy.special import ndtr >>> ndtr(0.5) 0.6914624612740131
透過為 x 提供 NumPy 陣列或列表,在多個點評估函數。
>>> ndtr([0, 0.5, 2]) array([0.5 , 0.69146246, 0.97724987])
繪製函數圖。
>>> import matplotlib.pyplot as plt >>> x = np.linspace(-5, 5, 100) >>> fig, ax = plt.subplots() >>> ax.plot(x, ndtr(x)) >>> ax.set_title(r"Standard normal cumulative distribution function $\Phi$") >>> plt.show()