}
// inverse cdf agrees with cdf
n=2.0;m=0.5;s=1.5;
Studenttdist normc = new Studenttdist(n,m,s);
Ran myran = new Ran(17);
sbeps=1.0e-13;
localflag=false;
for (i=0;i<1000;i++) {
u=m-3.0*s+6.0*s*myran.doub();
a=normc.cdf(u);
b=normc.invcdf(a);
// System.out.printf(setprecision(15) << u << " %f\n", b << " %f\n", abs(u-b));
localflag = localflag || abs(u-b) > sbeps;
}
globalflag = globalflag || localflag;
if (localflag) {
fail("*** Studenttdist: Inverse cdf does not accurately invert the cdf");
}
// Function aa() agrees with incomplete integral
sbeps=1.e-7;
n=2.0;m=0.0;s=1.0;
func_Studenttdist dist3 = new func_Studenttdist(n,m,s);
Studenttdist normaa = new Studenttdist(n,m,s);
localflag=false;
for (i=0;i<10;i++) {
u = 0.5*i;
Midpnt qq1 = new Midpnt(dist3,-u,u);
c[i]=qromo(qq1);
d[i]=normaa.aa(u);
// System.out.printf(setprecision(6) << c[i] << " %f\n", d[i] << " %f\n", c[i]-d[i]);
localflag = localflag || abs(c[i]-d[i]) > sbeps;
}
globalflag = globalflag || localflag;
if (localflag) {
fail("*** Studenttdist: aa() does not agree with result of direct quadrature");
}
// inverse invaa() agrees with aa()
n=2.0;m=0.5;s=1.5;
Studenttdist normaa2 = new Studenttdist(n,m,s);
sbeps=1.0e-13;
localflag=false;
for (i=0;i<1000;i++) {
u=m+3.0*s*myran.doub();
a=normaa2.aa(u);
b=normaa2.invaa(a);
// System.out.printf(setprecision(15) << u << " %f\n", b << " %f\n", abs(u-b));
localflag = localflag || abs(u-b) > sbeps;
}