1.15440105519259143,4.43020145207026971,21.0903075895088051,
120.426893194368698};
double[] uu1=buildVector(u1),uu2=buildVector(u2),uu3=buildVector(u3),uu4=buildVector(u4),zz=new double[N],zz1=new double[N],zz2=new double[N];
boolean localflag, globalflag=false;
Bessel bess = new Bessel();
Bessjy bjy = new Bessjy();
Bessik bik = new Bessik();
// Test Bessel (besseljy and besselik)
System.out.println("Testing Bessel (besseljy)");
// Test for integer values of nu
sbeps=1.e-10;
for (i=0;i<5;i++) {
nnu=(double)(i);
for (j=0;j<N;j++) {
xx=0.2*(j+1);
if (i == 0) {
zz1[j]=bjy.j0(xx);
zz2[j]=bess.jnu(nnu,xx);
} else if (i == 1) {
zz1[j]=bjy.j1(xx);
zz2[j]=bess.jnu(nnu,xx);
} else {
zz1[j]=bjy.jn(i,xx);
zz2[j]=bess.jnu(nnu,xx);
}
}
localflag = maxel(vecsub(zz1,zz2)) > sbeps;
globalflag = globalflag || localflag;
if (localflag) {
fail("*** Bessel (besseljy,jnu): Incorrect function values, integer order");
}
for (j=0;j<N;j++) {
xx=0.2*(j+1);
if (i == 0) {
zz1[j]=bjy.y0(xx);
zz2[j]=bess.ynu(nnu,xx);
} else if (i == 1) {
zz1[j]=bjy.y1(xx);
zz2[j]=bess.ynu(nnu,xx);
} else {
zz1[j]=bjy.yn(i,xx);
zz2[j]=bess.ynu(nnu,xx);
}
}
localflag = maxel(vecsub(zz1,zz2)) > sbeps;
globalflag = globalflag || localflag;
if (localflag) {
fail("*** Bessel (besseljy,ynu): Incorrect function values, integer order");
}
for (j=0;j<N;j++) {
xx=0.2*(j+1);
if (i == 0) {
zz1[j]=bik.i0(xx);
zz2[j]=bess.inu(nnu,xx);
} else if (i == 1) {
zz1[j]=bik.i1(xx);
zz2[j]=bess.inu(nnu,xx);
} else {
zz1[j]=bik.in(i,xx);
zz2[j]=bess.inu(nnu,xx);
}
}
localflag = maxel(vecsub(zz1,zz2)) > sbeps;
globalflag = globalflag || localflag;
if (localflag) {
fail("*** Bessel (besselik,inu): Incorrect function values, integer order");
}
for (j=0;j<N;j++) {
xx=0.2*(j+1);
if (i == 0) {
zz1[j]=bik.k0(xx);
zz2[j]=bess.knu(nnu,xx);
} else if (i == 1) {
zz1[j]=bik.k1(xx);
zz2[j]=bess.knu(nnu,xx);
} else {
zz1[j]=bik.kn(i,xx);
zz2[j]=bess.knu(nnu,xx);
}
}
localflag = maxel(vecsub(zz1,zz2)) > sbeps;
globalflag = globalflag || localflag;
if (localflag) {
fail("*** Bessel (besselik,knu): Incorrect function values, integer order");
}
}
// Test some non-integer values of nu
// Test Bessel (besseljy)
System.out.println("Testing Bessel (besseljy),jnu");
for (i=0;i<N;i++)
zz[i]=bess.jnu(nu[i],x[i]);
System.out.printf("Bessel (besseljy),jnu: Maximum discrepancy = %f\n", maxel(vecsub(zz,uu1)));
localflag = maxel(vecsub(zz,uu1)) > sbeps;
globalflag = globalflag || localflag;
if (localflag) {
fail("*** Bessel (besselij),jnu: Incorrect function values, non-integer order");
}
System.out.println("Testing Bessel (besseljy),ynu");
for (i=0;i<N;i++)
zz[i]=bess.ynu(nu[i],x[i]);
System.out.printf("Bessel (besseljy),ynu: Maximum discrepancy = %f\n", maxel(vecsub(zz,uu2)));
localflag = maxel(vecsub(zz,uu2)) > sbeps;
globalflag = globalflag || localflag;
if (localflag) {
fail("*** Bessel (besseljy),ynu: Incorrect function values, non-integer order");
}
// Test Bessel (besselik)
System.out.println("Testing Bessel (besselik),inu");
for (i=0;i<N;i++) zz[i]=bess.inu(nu[i],x[i]);
System.out.printf("Bessel (besselik),inu: Maximum discrepancy = %f\n", maxel(vecsub(zz,uu3)));
localflag = maxel(vecsub(zz,uu3)) > sbeps;
globalflag = globalflag || localflag;
if (localflag) {
fail("*** Bessel (besselik),inu: Incorrect function values, non-integer order");
}
System.out.println("Testing Bessel (besselik),knu");
for (i=0;i<N;i++) zz[i]=bess.knu(nu[i],x[i]);
System.out.printf("Bessel (besselik),knu: Maximum discrepancy = %f\n", maxel(vecsub(zz,uu4)));
localflag = maxel(vecsub(zz,uu4)) > sbeps;
globalflag = globalflag || localflag;
if (localflag) {
fail("*** Bessel (besselik),knu: Incorrect function values, non-integer order");