// for (i=0;i<N;i++) System.out.printf(x[i] << " ";
// System.out.printf(endl;
// Calculate some function values and derivatives
Ran myran=new Ran(14);
Bessjy bess=new Bessjy();
for (i=0;i<N;i++) {
y=x[0]*(2.0*myran.doub()-1.0);
Weights.weights(y,x,c);
// Calculate function
f=f1=f2=0;
for (j=0;j<N;j++) {
f += c[j][0]*bess.jn(5,x[j]);
f1 += c[j][1]*bess.jn(5,x[j]);
f2 += c[j][2]*bess.jn(5,x[j]);
}
// System.out.printf(y);
// System.out.printf(abs(bess.jn(5,y)-f) << " ";
// System.out.printf(abs(0.5*(bess.jn(4,y)-bess.jn(6,y))-f1) << " ";
// System.out.printf(abs(0.25*(bess.jn(3,y)-2.0*bess.jn(5,y)+bess.jn(7,y))-f2));
sbeps=1.e-3;
localflag = abs(bess.jn(5,y)-f) > sbeps;
globalflag = globalflag || localflag;
if (localflag) {
fail("*** weights: Evaluation of function was inaccurate");
}
sbeps=1.e-3;
localflag = abs(0.5*(bess.jn(4,y)-bess.jn(6,y))-f1) > sbeps;
globalflag = globalflag || localflag;
if (localflag) {
fail("*** weights: Evaluation of first derivative was inaccurate");
}
sbeps=1.e-3;
localflag = abs(0.25*(bess.jn(3,y)-2.0*bess.jn(5,y)+bess.jn(7,y))-f2) > sbeps;
globalflag = globalflag || localflag;
if (localflag) {
fail("*** weights: Evaluation of second derivative was inaccurate");
}