double Type3SmallestValueRV::getStdv() { double a = gammaFunction(1.0+2.0/k); double b = gammaFunction(1.0+1.0/k); return (u-epsilon) * sqrt(a-b*b); }
double Type3SmallestValueRV::getMean() { double result; result = epsilon + (u-epsilon) * gammaFunction(1.0+1.0/k); return result; }
double GammaRV::getPDFvalue(double rvValue) { double result; if ( 0.0 < rvValue ) { result = lambda*pow((lambda*rvValue),(k-1.0))*exp(-lambda*rvValue) / gammaFunction(k); } else { result = 0.0; } return result; }
double ChiSquareRV::getPDFvalue(double rvValue) { double result; if ( 0.0 < rvValue ) { double a = gammaFunction(0.5*nu); result = pow(0.5*rvValue,0.5*nu-1.0)*exp(-0.5*rvValue)/(2.0*a); } else { result = 0.0; } return result; }
void testSequence(){ int i; long *fib; unsigned char *primeNumbmer; pdf *dist; dist=normalDistribution(10.0, 5.0, 4, 0.1, 400); printf("\nSequence\n"); printf("Normal distribution\n"); for (i=0;i<400;i++){ printf("%f\t%f\n",(dist+i)->x,(dist+i)->fx); } printf("gamma 1 =%f\n",tgamma(4)); printf("gamma 1 =%f\n",gammaFunction(4)); printf("p(a|b) =%f\n",bayes(0.8, 0.01, 0.096)); printf("factorial =%d\n",factorial(5)); printf("double factorial =%d\n",doubleFactorial(5)); fib=fibonacci(20); primeNumbmer=prime(20); printf("fibonacci\n"); for (i=0;i<20;i++){ printf("%d ",i); } printf("\n"); for (i=0;i<20;i++){ printf("%ld ",fib[i]); } printf("\n"); printf("prime\n"); for (i=0;i<20;i++){ if (primeNumbmer[i] ==1) printf("%d ",i); } printf("\n"); }