2009-01-14 284 views

回答

2

一位同事建議colt,因爲他以前使用過。該function與參考文檔中的示例具有完全相同的結果。

6

如果你想確切的代碼,這一次似乎是在OpenOffice的Calc中使用相同的功能(我做了一些改變它在Java工作):

// returns the cumulative normal distribution function (CNDF) 
// for a standard normal: N(0,1) 
double CNDF(double x) 
{ 
    int neg = (x < 0d) ? 1 : 0; 
    if (neg == 1) 
     x *= -1d; 

    double k = (1d/(1d + 0.2316419 * x)); 
    double y = ((((1.330274429 * k - 1.821255978) * k + 1.781477937) * 
        k - 0.356563782) * k + 0.319381530) * k; 
    y = 1.0 - 0.398942280401 * Math.exp(-0.5 * x * x) * y; 

    return (1d - neg) * y + neg * (1d - y); 
} 

在這裏找到它:http://www.codeproject.com/Messages/2622967/Re-NORMSDIST-function.aspx

+0

問題想要正常分配的pdf! – 2013-06-04 11:30:31