7 #pragma GCC diagnostic push
8 #pragma GCC diagnostic ignored "-Wshadow"
9 #include <boost/math/special_functions.hpp>
10 #pragma GCC diagnostic pop
24 void dkia_(
int *IFAC,
double *
X,
double *
A,
double *DKI,
double *DKID,
int *IERRO);
25 void dlia_(
int *IFAC,
double *
X,
double *
A,
double *DLI,
double *DLID,
int *IERRO);
30 #define jn(order, x) boost::math::cyl_bessel_j(order, x)
32 #define yn(order, x) boost::math::cyl_neumann(order, x)
34 #define in(order, x) boost::math::cyl_bessel_i(order, x)
36 #define kn(order, x) boost::math::cyl_bessel_k(order, x)
37 #define limu(im_order, x) Rossegger::Limu(im_order, x)
38 #define kimu(im_order, x) Rossegger::Kimu(im_order, x)
58 char zeroesfilename[200];
59 sprintf(zeroesfilename,
"rosseger_zeroes_eps%1.0E_a%2.2f_b%2.2f_L%2.2f.root",
epsilon,
a,
b,
L);
60 TFile *fileptr = TFile::Open(zeroesfilename,
"READ");
75 std::cout <<
"Rossegger object initialized as follows:" << std::endl;
76 std::cout <<
" Inner Radius = " <<
a <<
" cm." << std::endl;
77 std::cout <<
" Outer Radius = " <<
b <<
" cm." << std::endl;
78 std::cout <<
" Half Length = " <<
L <<
" cm." << std::endl;
82 std::cout <<
"CheckZeroes(0.01) returned false, exiting" << std::endl;
90 double previous = (this->*func)(order, xstart);
91 double x = xstart + localepsilon;
92 double value = previous;
94 while (!((value == 0) || (value < 0 && previous > 0) || (value > 0 && previous < 0)))
97 value = (this->*func)(order, x);
100 std::cout <<
"hit it exactly! Go buy a lottery ticket!" << std::endl;
102 if ((value == 0) || (value < 0 && previous > 0) || (value > 0 && previous < 0))
108 double slope = (value - previous) / localepsilon;
110 double x0 = -intercept / slope;
113 std::cout <<
" " << x0 <<
"," << std::endl;
115 double n0 = (this->*func)(order, x - localepsilon);
116 double n1 = (this->*func)(order, x + localepsilon);
117 if ((n0 < 0 && n1 < 0) || (n0 > 0 && n1 > 0))
119 printf(
"neighbors on both sides have the same sign. Check your function resolution!\n");
127 std::cout <<
"logic break!\n";
134 std::cout <<
"Now filling the Beta[m][n] Array..." << std::endl;
143 std::cout <<
"Filling Beta[" <<
m <<
"][n]..." << std::endl;
146 double x = localepsilon;
165 N2mn[
m][
n] *= (jna_over_jnb * jna_over_jnb - 1.0);
169 std::cout <<
"m: " <<
m <<
" n: " <<
n <<
" N2[m][n]: " <<
N2mn[
m][
n];
175 for (
double r = a;
r <
b;
r +=
step)
177 double rmnval =
Rmn(
m,
n,
r);
179 integral += rmnval * rmnval *
r *
step;
181 std::cout <<
" Int: " << integral << std::endl;
187 std::cout <<
"Done." << std::endl;
192 std::cout <<
"Now filling the Mu[n][k] Array..." << std::endl;
208 std::cout <<
"Filling Mu[" <<
n <<
"][k]..." << std::endl;
210 double x = localepsilon;
219 printf(
"adjacent values are Rnk[mu-localepsilon]=%E\tRnk[mu+localepsilon]=%E\n",
223 printf(
"values of argument to limu and kimu are %f and %f\n",
245 integral += rnkval * rnkval /
r *
step;
249 std::cout <<
" Int: " << integral << std::endl;
254 std::cout <<
"n: " <<
n <<
" k: " <<
k <<
" N2nk[n][k]: " <<
N2nk[
n][
k];
259 std::cout <<
"Done." << std::endl;
272 if (abs(result) > localepsilon)
274 printf(
"(m=%d,n=%d) Jm(x)Ym(lx)-Jm(lx)Ym(x) = %f for x=b*%f\n",
m,
n, result,
Betamn[
m][
n]);
286 if (abs(result) > localepsilon * 100)
288 printf(
"(n=%d,k=%d) limu(npi*a/L)kimu(npi*b/L)-kimu(npi*a/L)kimu(npi*b/L) = %f (>eps*100) for mu=%f\n",
289 n, k, result,
Munk[
n][k]);
355 dlia_(&IFAC, &X, &A, &DLI, &DERR, &IERRO);
367 dkia_(&IFAC, &X, &A, &DKI, &DERR, &IERRO);
373 double lx =
a * x /
b;
376 return jn(m, x) *
yn(m, lx) -
jn(m, lx) *
yn(m, x);
383 std::cout <<
"Determine Rmn(" << m <<
"," << n <<
"," << r <<
") = ";
402 std::cout <<
"Invalid arguments Rmn(" << m <<
"," << n <<
"," << r <<
")" << std::endl;
415 std::cout << R << std::endl;
424 std::cout <<
"Determine Rmn(" << m <<
"," << n <<
"," << r <<
") = ";
443 std::cout <<
"Invalid arguments Rmn(" << m <<
"," << n <<
"," << r <<
")" << std::endl;
456 std::cout << R << std::endl;
479 std::cout <<
"Invalid arguments Rmn1(" << m <<
"," << n <<
"," << r <<
")" << std::endl;
511 std::cout <<
"Invalid arguments Rmn1(" << m <<
"," << n <<
"," << r <<
")" << std::endl;
520 double BetaN_ = (n + 1) *
pi /
L;
521 R =
kn(m, BetaN_ *
a) *
in(m, BetaN_ * r) -
in(m, BetaN_ * a) *
kn(m, BetaN_ * r);
544 std::cout <<
"Invalid arguments Rmn2(" << m <<
"," << n <<
"," << r <<
")" << std::endl;
576 std::cout <<
"Invalid arguments Rmn2(" << m <<
"," << n <<
"," << r <<
")" << std::endl;
585 double BetaN_ = (n + 1) *
pi /
L;
586 R =
kn(m, BetaN_ * b) *
in(m, BetaN_ * r) -
in(m, BetaN_ * b) *
kn(m, BetaN_ * r);
603 if (ref < a || ref >
b)
613 std::cout <<
"Invalid arguments RPrime(" << m <<
"," << n <<
"," << ref <<
"," << r <<
")" << std::endl;
627 double term1 =
kn(m, BetaN_ * ref) * (
in(m - 1, BetaN_ * r) +
in(m + 1, BetaN_ * r));
628 double term2 =
in(m, BetaN_ * ref) * (
kn(m - 1, BetaN_ * r) +
kn(m + 1, BetaN_ * r));
629 R = BetaN_ / 2.0 * (term1 + term2);
646 if (ref < a || ref >
b)
656 std::cout <<
"Invalid arguments RPrime(" << m <<
"," << n <<
"," << ref <<
"," << r <<
")" << std::endl;
668 double BetaN_ = (n + 1) *
pi /
L;
669 double term1 =
kn(m, BetaN_ * ref) * (
in(m - 1, BetaN_ * r) +
in(m + 1, BetaN_ * r));
670 double term2 =
in(m, BetaN_ * ref) * (
kn(m - 1, BetaN_ * r) +
kn(m + 1, BetaN_ * r));
671 R = BetaN_ / 2.0 * (term1 + term2);
681 printf(
"Rnk_for_zeroes called with n=%d,mu=%f\n", n, mu);
688 return limu(mu, betana) *
kimu(mu, betanb) -
kimu(mu, betana) *
limu(mu, betanb);
696 printf(
"Rnk_for_zeroes called with n=%d,mu=%f\n", n, mu);
698 double BetaN_ = (n + 1) *
pi /
L;
699 double betana = BetaN_ *
a;
700 double betanb = BetaN_ *
b;
704 return limu(mu, betana) *
kimu(mu, betanb) -
kimu(mu, betana) *
limu(mu, betanb);
725 std::cout <<
"Invalid arguments Rnk(" << n <<
"," << k <<
"," << r <<
")" << std::endl;
753 std::cout <<
"Invalid arguments Rnk(" << n <<
"," << k <<
"," << r <<
")" << std::endl;
757 double BetaN_ = (n + 1) *
pi /
L;
772 if (phi < 0 || phi > 2 *
pi)
780 if (r1 < a || r1 > b)
784 if (phi1 < 0 || phi1 > 2 * pi)
788 if (z1 < 0 || z1 > L)
794 std::cout <<
"Invalid arguments Ez(";
795 std::cout << r <<
",";
796 std::cout << phi <<
",";
797 std::cout << z <<
",";
798 std::cout << r1 <<
",";
799 std::cout << phi1 <<
",";
801 std::cout <<
")" << std::endl;
811 std::cout << std::endl
818 std::cout <<
" " <<
n;
823 std::cout <<
" " << term;
825 term *= (2 - ((
m == 0) ? 1 : 0)) * cos(
m * (phi - phi1));
828 std::cout <<
" " << term;
833 std::cout <<
" " << term;
845 std::cout <<
" " << term;
850 std::cout <<
" " << term <<
" " << G << std::endl;
858 std::cout <<
"Ez = " << G << std::endl;
873 if (phi < 0 || phi > 2 *
pi)
881 if (r1 < a || r1 > b)
885 if (phi1 < 0 || phi1 > 2 * pi)
889 if (z1 < 0 || z1 > L)
895 std::cout <<
"Invalid arguments Ez(";
896 std::cout << r <<
",";
897 std::cout << phi <<
",";
898 std::cout << z <<
",";
899 std::cout << r1 <<
",";
900 std::cout << phi1 <<
",";
902 std::cout <<
")" << std::endl;
912 std::cout << std::endl
919 std::cout <<
" " <<
n;
921 double term = 1 / (2.0 *
pi);
924 std::cout <<
" " << term;
926 term *= (2 - ((
m == 0) ? 1 : 0)) * cos(
m * (phi - phi1));
929 std::cout <<
" " << term;
934 std::cout <<
" " << term;
947 std::cout <<
" " << term;
952 std::cout <<
" " << term <<
" " << G << std::endl;
958 std::cout <<
"Ez = " << G << std::endl;
977 if (phi < 0 || phi > 2 *
pi)
985 if (r1 < a || r1 > b)
989 if (phi1 < 0 || phi1 > 2 * pi)
993 if (z1 < 0 || z1 > L)
999 std::cout <<
"Invalid arguments Er(";
1000 std::cout << r <<
",";
1001 std::cout << phi <<
",";
1002 std::cout << z <<
",";
1003 std::cout << r1 <<
",";
1004 std::cout << phi1 <<
",";
1006 std::cout <<
")" << std::endl;
1018 part = (2 - ((
m == 0) ? 1 : 0)) * cos(
m * (phi - phi1));
1021 printf(
"(2 - ((m==0)?1:0))*cos(m*(phi-phi1)); = %f\n", part);
1027 printf(
"sin(BetaN[n]*z)*sin(BetaN[n]*z1); = %f\n", part);
1047 std::cout <<
"Er = " << G << std::endl;
1065 if (phi < 0 || phi > 2 *
pi)
1073 if (r1 < a || r1 > b)
1077 if (phi1 < 0 || phi1 > 2 * pi)
1081 if (z1 < 0 || z1 > L)
1087 std::cout <<
"Invalid arguments Er(";
1088 std::cout << r <<
",";
1089 std::cout << phi <<
",";
1090 std::cout << z <<
",";
1091 std::cout << r1 <<
",";
1092 std::cout << phi1 <<
",";
1094 std::cout <<
")" << std::endl;
1104 double term = 1 / (L *
pi);
1105 term *= (2 - ((
m == 0) ? 1 : 0)) * cos(
m * (phi - phi1));
1106 double BetaN_ = (
n + 1) * pi / L;
1107 term *= sin(BetaN_ * z) * sin(BetaN_ * z1);
1117 term /= TMath::BesselI(
m, BetaN_ *
a) * TMath::BesselK(
m, BetaN_ * b) - TMath::BesselI(
m, BetaN_ * b) * TMath::BesselK(
m, BetaN_ * a);
1125 std::cout <<
"Er = " << G << std::endl;
1141 if (phi < 0 || phi > 2 *
pi)
1149 if (r1 < a || r1 > b)
1153 if (phi1 < 0 || phi1 > 2 * pi)
1157 if (z1 < 0 || z1 > L)
1163 std::cout <<
"Invalid arguments Ephi(";
1164 std::cout << r <<
",";
1165 std::cout << phi <<
",";
1166 std::cout << z <<
",";
1167 std::cout << r1 <<
",";
1168 std::cout << phi1 <<
",";
1170 std::cout <<
")" << std::endl;
1188 term *= -sinh(
Munk[
n][
k] * (pi - (phi - phi1)));
1192 term *= sinh(
Munk[
n][
k] * (pi - (phi1 - phi)));
1202 std::cout <<
"Ephi = " << G << std::endl;
1217 if (phi < 0 || phi > 2 *
pi)
1225 if (r1 < a || r1 > b)
1229 if (phi1 < 0 || phi1 > 2 * pi)
1233 if (z1 < 0 || z1 > L)
1239 std::cout <<
"Invalid arguments Ephi(";
1240 std::cout << r <<
",";
1241 std::cout << phi <<
",";
1242 std::cout << z <<
",";
1243 std::cout << r1 <<
",";
1244 std::cout << phi1 <<
",";
1246 std::cout <<
")" << std::endl;
1258 std::cout <<
"\nk=" <<
k;
1264 std::cout <<
" n=" <<
n;
1266 double BetaN_ = (
n + 1) * pi / L;
1267 double term = 1 / (L *
r);
1270 std::cout <<
" 1/L=" << term;
1272 term *= sin(BetaN_ * z) * sin(BetaN_ * z1);
1275 std::cout <<
" *sinsin=" << term;
1280 std::cout <<
" *rnkrnk=" << term;
1285 std::cout <<
" */nnknnk=" << term;
1291 term *= -sinh(
Munk[
n][
k] * (pi - (phi - phi1)));
1297 term *= sinh(
Munk[
n][
k] * (pi - (phi1 - phi)));
1303 std::cout <<
" *sinh(mu*pi-phi-phi)=" << term;
1305 term *= 1 / (sinh(pi *
Munk[
n][
k]));
1311 std::cout <<
" /sinh=" << term <<
" G=" << G << std::endl;
1317 std::cout <<
"Ephi = " << G << std::endl;
1326 TFile *
output = TFile::Open(destfile,
"RECREATE");
1329 TTree *tInfo =
new TTree(
"info",
"Mu[n][k] values");
1331 tInfo->Branch(
"order", &ord);
1332 tInfo->Branch(
"epsilon", &
epsilon);
1336 double munk, betamn;
1338 TTree *tmunk =
new TTree(
"munk",
"Mu[n][k] values");
1339 tmunk->Branch(
"n", &n);
1340 tmunk->Branch(
"k", &k);
1341 tmunk->Branch(
"munk", &munk);
1342 tmunk->Branch(
"n2nk", &n2nk);
1343 for (n = 0; n < ord; n++)
1345 for (k = 0; k < ord; k++)
1353 TTree *tbetamn =
new TTree(
"betamn",
"Beta[m][n] values");
1354 tbetamn->Branch(
"m", &m);
1355 tbetamn->Branch(
"n", &n);
1356 tbetamn->Branch(
"betamn", &betamn);
1357 tbetamn->Branch(
"n2mn", &n2mn);
1358 for (m = 0; m < ord; m++)
1360 for (n = 0; n < ord; n++)
1378 TFile *
f = TFile::Open(destfile,
"READ");
1379 printf(
"reading rossegger zeroes from %s\n", destfile);
1380 TTree *tInfo = (TTree *) (f->Get(
"info"));
1382 tInfo->SetBranchAddress(
"order", &ord);
1383 tInfo->SetBranchAddress(
"epsilon", &
epsilon);
1388 double munk, betamn;
1390 TTree *tmunk = (TTree *) (f->Get(
"munk"));
1391 tmunk->SetBranchAddress(
"n", &n);
1392 tmunk->SetBranchAddress(
"k", &k);
1393 tmunk->SetBranchAddress(
"munk", &munk);
1394 tmunk->SetBranchAddress(
"n2nk", &n2nk);
1395 for (
int i = 0;
i < tmunk->GetEntries();
i++)
1402 TTree *tbetamn = (TTree *) (f->Get(
"betamn"));
1403 tbetamn->SetBranchAddress(
"m", &m);
1404 tbetamn->SetBranchAddress(
"n", &n);
1405 tbetamn->SetBranchAddress(
"betamn", &betamn);
1406 tbetamn->SetBranchAddress(
"n2mn", &n2mn);
1407 for (
int i = 0;
i < tbetamn->GetEntries();
i++)
1409 tbetamn->GetEntry(
i);