// Test rj
System.out.println("Testing rj");
Ran myran = new Ran(17);
// Test rj(x,x,x,x) = 1/x^(3/2)
for (i=0;i<N;i++) {
x=myran.doub();
f1[i]=rj(x,x,x,x);
f2[i]=1.0/pow(x,3.0/2.0);
}
System.out.printf("rj: Maximum discrepancy = %f\n", maxel(vecsub(f1,f2)));
sbeps=2.e-11; // XXX 1.e-12 not pass
localflag = maxel(vecsub(f1,f2)) > sbeps;
globalflag = globalflag || localflag;
if (localflag) {
fail("*** rj: Function rj(x,x,x,x) is not equal to 1/x^(3/2)");
}
// Symmetry test
for (i=0;i<N;i++) {
x=10.0*myran.doub();
y=10.0*myran.doub();
z=10.0*myran.doub();
p=10.0*myran.doub();
f1[i]=rj(x,y,z,p);
f2[i]=rj(y,x,z,p);
f3[i]=rj(x,z,y,p);
}
// Symmetry of x and y
System.out.printf("rj: maximum discrepance with swap of x,y = %f\n", maxel(vecsub(f1,f2)));
sbeps=1.e-14;
localflag = maxel(vecsub(f1,f2)) > sbeps;
globalflag = globalflag || localflag;
if (localflag) {
fail("*** rj: Function rj(x,y,z,p) is not equal to rj(y,x,z,p)");
}
// Symmetry of y and z
System.out.printf("rj: maximum discrepance with swap of y,z = %f\n", maxel(vecsub(f1,f3)));
sbeps=1.e-14;
localflag = maxel(vecsub(f1,f3)) > sbeps;
globalflag = globalflag || localflag;
if (localflag) {
fail("*** rj: Function rj(x,y,z,p) is not equal to rj(x,z,y,p)");
}
// Test symmetry with respect to p
for (i=0;i<N;i++) {
x=myran.doub();
z=myran.doub();
p=myran.doub();
f1[i]=rj(x,x,z,p);
f2[i]=rj(p,p,z,x);
}
// Symmetry of x,y and p
System.out.printf("rj: maximum discrepance with x,y,p symmetry = %f\n", maxel(vecsub(f1,f2)));
sbeps=1.e-12;
localflag = maxel(vecsub(f1,f2)) > sbeps;
globalflag = globalflag || localflag;
if (localflag) {
fail("*** rj: Function rj(x,x,z,p) is not equal to rj(p,p,z,x)");
}
// Test symmetry with respect to p
for (i=0;i<N;i++) {
x=myran.doub();
y=myran.doub();
p=myran.doub();
f1[i]=rj(x,y,y,p);
f2[i]=rj(x,p,p,y);
}