Click here to Skip to main content
11,484,162 members (69,178 online)

Algorithms

 
GeneralRe: Inverse of NORMSDIST function Pin
Paul Conrad23-Jul-08 13:18
memberPaul Conrad23-Jul-08 13:18 
QuestionNORMSDIST function Pin
sumit70342-Jul-08 23:28
membersumit70342-Jul-08 23:28 
GeneralI know, Pin
CPallini2-Jul-08 23:51
mvpCPallini2-Jul-08 23:51 
GeneralRe: I know, Pin
sumit70343-Jul-08 0:50
membersumit70343-Jul-08 0:50 
QuestionRe: I know, Pin
CPallini3-Jul-08 0:54
mvpCPallini3-Jul-08 0:54 
AnswerRe: I know, Pin
sumit70343-Jul-08 1:04
membersumit70343-Jul-08 1:04 
QuestionRe: I know, Pin
CPallini3-Jul-08 1:11
mvpCPallini3-Jul-08 1:11 
AnswerRe: I know, Pin
sumit70343-Jul-08 1:28
membersumit70343-Jul-08 1:28 
GeneralRe: I know, Pin
cp98763-Jul-08 1:52
membercp98763-Jul-08 1:52 
GeneralRe: I know, Pin
CPallini3-Jul-08 1:56
mvpCPallini3-Jul-08 1:56 
GeneralRe: I know, Pin
sumit70343-Jul-08 2:36
membersumit70343-Jul-08 2:36 
GeneralRe: I know, Pin
Paul Conrad3-Jul-08 19:32
memberPaul Conrad3-Jul-08 19:32 
GeneralRe: I know, Pin
CPallini3-Jul-08 1:53
mvpCPallini3-Jul-08 1:53 
AnswerRe: NORMSDIST function Pin
73Zeppelin3-Jul-08 3:11
member73Zeppelin3-Jul-08 3:11 
Implementation 1:

// returns the cumulative normal distribution function (CNDF)
// for a standard normal: N(0,1)
double CNDF(double x)
{
	int neg = (x < 0);
	if ( neg ) 
		x *= -1;
 
	double k(1/(1+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*exp(-0.5*x*x)*y;
	
	return (1-neg)*y + neg*(1-y);
}

Implementation 2

// another implementation of the CNDF
// for a standard normal: N(0,1)
double CumNorm(double x)
{
	// protect against overflow
	if (x > 6.0)
		return 1.0;
	if (x < -6.0)
		return 0.0;
 
	double b1 = 0.31938153;
	double b2 = -0.356563782;
	double b3 = 1.781477937;
	double b4 = -1.821255978;
	double b5 = 1.330274429;
	double p = 0.2316419;
	double c2 = 0.3989423;
 
	double a = fabs(x);
	double t = 1.0 / (1.0 + a * p);
	double b = c2*exp((-x)*(x/2.0));
	double n = ((((b5*t+b4)*t+b3)*t+b2)*t+b1)*t;
	n = 1.0-b*n;
	
	if ( x < 0.0 )
		n = 1.0 - n;
	
	return n;
}


I'm the ocean. I'm a giant undertow.

QuestionRe: NORMSDIST function Pin
CPallini3-Jul-08 3:29
mvpCPallini3-Jul-08 3:29 
AnswerRe: NORMSDIST function Pin
73Zeppelin3-Jul-08 4:19
member73Zeppelin3-Jul-08 4:19 
GeneralRe: NORMSDIST function Pin
sumit70343-Jul-08 3:47
membersumit70343-Jul-08 3:47 
GeneralRe: NORMSDIST function Pin
Member 82494621-Dec-11 0:54
memberMember 82494621-Dec-11 0:54 
GeneralThe six rightmost non-zero digits of 1000000! Pin
Rod Gowdy2-Jul-08 5:50
memberRod Gowdy2-Jul-08 5:50 
GeneralRe: The six rightmost non-zero digits of 1000000! [modified] Pin
Robert.C.Cartaino2-Jul-08 7:33
memberRobert.C.Cartaino2-Jul-08 7:33 
GeneralRe: The six rightmost non-zero digits of 1000000! Pin
Rod Gowdy3-Jul-08 4:42
memberRod Gowdy3-Jul-08 4:42 
GeneralRe: The six rightmost non-zero digits of 1000000! Pin
Robert.C.Cartaino3-Jul-08 11:06
memberRobert.C.Cartaino3-Jul-08 11:06 
QuestionSpecify numbers as product of Primes? Pin
Ian Uy25-Jun-08 20:37
memberIan Uy25-Jun-08 20:37 
AnswerRe: Specify numbers as product of Primes? Pin
cp987625-Jun-08 22:32
membercp987625-Jun-08 22:32 
GeneralRe: Specify numbers as product of Primes? Pin
Ian Uy26-Jun-08 1:42
memberIan Uy26-Jun-08 1:42 
AnswerRe: Specify numbers as product of Primes? Pin
Robert.C.Cartaino26-Jun-08 5:48
memberRobert.C.Cartaino26-Jun-08 5:48 
GeneralRe: Specify numbers as product of Primes? Pin
Ian Uy26-Jun-08 5:50
memberIan Uy26-Jun-08 5:50 
GeneralRe: Specify numbers as product of Primes? Pin
The Developer8-Aug-08 8:03
memberThe Developer8-Aug-08 8:03 
GeneralRe: Specify numbers as product of Primes? Pin
Ian Uy26-Jun-08 7:28
memberIan Uy26-Jun-08 7:28 
GeneralRe: Specify numbers as product of Primes? Pin
Paul Conrad28-Jun-08 6:44
memberPaul Conrad28-Jun-08 6:44 
GeneralRe: Specify numbers as product of Primes? Pin
Ian Uy28-Jun-08 6:46
memberIan Uy28-Jun-08 6:46 
GeneralRe: Specify numbers as product of Primes? Pin
Paul Conrad28-Jun-08 7:11
memberPaul Conrad28-Jun-08 7:11 
GeneralRe: Specify numbers as product of Primes? Pin
Ravi Bhavnani8-Aug-08 8:16
memberRavi Bhavnani8-Aug-08 8:16 
GeneralRe: Specify numbers as product of Primes? Pin
cp987628-Jun-08 21:27
membercp987628-Jun-08 21:27 
GeneralRe: Specify numbers as product of Primes? Pin
Luc Pattyn29-Jun-08 3:42
mvpLuc Pattyn29-Jun-08 3:42 
GeneralRe: Specify numbers as product of Primes? Pin
MarkBrock27-Jun-08 19:46
memberMarkBrock27-Jun-08 19:46 
GeneralRe: Specify numbers as product of Primes? Pin
Paul Conrad28-Jun-08 6:42
memberPaul Conrad28-Jun-08 6:42 
GeneralRe: Specify numbers as product of Primes? Pin
ChandraRam2-Jul-08 23:49
memberChandraRam2-Jul-08 23:49 
GeneralRe: Specify numbers as product of Primes? Pin
MarkBrock3-Jul-08 0:06
memberMarkBrock3-Jul-08 0:06 
AnswerRe: Specify numbers as product of Primes? Pin
Member 419459326-Jun-08 9:19
memberMember 419459326-Jun-08 9:19 
GeneralRe: Specify numbers as product of Primes? Pin
Robert.C.Cartaino26-Jun-08 9:47
memberRobert.C.Cartaino26-Jun-08 9:47 
GeneralRe: Specify numbers as product of Primes? Pin
Ian Uy26-Jun-08 18:51
memberIan Uy26-Jun-08 18:51 
GeneralRe: Specify numbers as product of Primes? Pin
cp987629-Jun-08 15:57
membercp987629-Jun-08 15:57 
AnswerRe: Specify numbers as product of Primes? Pin
Arash Partow29-Jun-08 1:48
memberArash Partow29-Jun-08 1:48 
GeneralRe: Specify numbers as product of Primes? [modified] Pin
cp987629-Jun-08 4:53
membercp987629-Jun-08 4:53 
GeneralRe: Specify numbers as product of Primes? Pin
Luc Pattyn29-Jun-08 5:40
mvpLuc Pattyn29-Jun-08 5:40 
GeneralRe: Specify numbers as product of Primes? Pin
cp987629-Jun-08 15:47
membercp987629-Jun-08 15:47 
GeneralRe: Specify numbers as product of Primes? Pin
Arash Partow30-Jun-08 3:54
memberArash Partow30-Jun-08 3:54 
GeneralRe: Specify numbers as product of Primes? Pin
cp987630-Jun-08 4:18
membercp987630-Jun-08 4:18 
GeneralRe: Specify numbers as product of Primes? Pin
Arash Partow30-Jun-08 5:27
memberArash Partow30-Jun-08 5:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web04 | 2.8.150520.1 | Last Updated 25 May 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid