Commit 8ffb8373b71fd5d6e8327b372b67c50fb8df43f9

Authored by dmayerich
1 parent 4198e3be

Improved materials and the Kramers-Kronig solver.

CMakeLists.txt
... ... @@ -25,6 +25,9 @@ find_package(GLUT REQUIRED)
25 25 #find GLEW
26 26 find_package(GLEW REQUIRED)
27 27  
  28 +#find Qwt
  29 +find_package(Qwt REQUIRED)
  30 +
28 31 #add Qt OpenGL stuff
29 32 set(QT_USE_QTOPENGL TRUE)
30 33  
... ... @@ -53,9 +56,10 @@ file(GLOB SRC_CU "*.cu")
53 56 #set up copying data files
54 57 configure_file(kPMMA.txt ${CMAKE_CURRENT_BINARY_DIR}/kPMMA.txt @ONLY)
55 58 configure_file(eta_polystyreneK.txt ${CMAKE_CURRENT_BINARY_DIR}/eta_polystyreneK.txt @ONLY)
56   -configure_file(eta_TolueneK.txt ${CMAKE_CURRENT_BINARY_DIR}/eta_TolueneK.txt @ONLY)
57   -configure_file(eta_TolueneN.txt ${CMAKE_CURRENT_BINARY_DIR}/eta_TolueneN.txt @ONLY)
  59 +configure_file(etaToluene.txt ${CMAKE_CURRENT_BINARY_DIR}/etaToluene.txt @ONLY)
58 60 configure_file(source_midIR.txt ${CMAKE_CURRENT_BINARY_DIR}/source_midIR.txt @ONLY)
  61 +configure_file(kPolyethylene.txt ${CMAKE_CURRENT_BINARY_DIR}/kPolyethylene.txt @ONLY)
  62 +configure_file(kPTFE.txt ${CMAKE_CURRENT_BINARY_DIR}/kPTFE.txt @ONLY)
59 63  
60 64 #determine which source files have to be moc'd
61 65 Qt4_wrap_cpp(UI_MOC ${SRC_H})
... ... @@ -72,7 +76,4 @@ source_group(QtUI FILES ${SRC_UI})
72 76 cuda_add_executable(IMie ${SRC_CPP} ${SRC_H} ${UI_H} ${UI_MOC} ${ALL_RCC} ${SRC_CU})
73 77  
74 78 #set the link libraries
75   -target_link_libraries(IMie ${QT_LIBRARIES} ${QT_QTOPENGL_LIBRARY} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${GLEW_LIBRARY})
76   -
77   -
78   -
  79 +target_link_libraries(IMie ${QT_LIBRARIES} ${QT_QTOPENGL_LIBRARY} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${GLEW_LIBRARY} ${QWT_LIBRARY})
79 80 \ No newline at end of file
... ...
EstimateMaterial.cpp
1   -#include "globals.h"
2   -#include <stdlib.h>
3   -#define PI 3.14159
4   -
5   -double CalculateError(double* E)
6   -{
7   - //Calculate the error between the Reference Spectrum and the Simulated Spectrum
8   - double sumE = 0.0;
9   - int nVals = RefSpectrum[currentSpec].size();
10   - double nu;
11   - for(int i=0; i<nVals; i++)
12   - {
13   - nu = RefSpectrum[currentSpec][i].nu;
14   - E[i] = RefSpectrum[currentSpec][i].A + nu * refSlope - SimSpectrum[i].A;
15   - sumE += E[i]*E[i];
16   - }
17   -
18   - return sumE/nVals;
19   -}
20   -
21   -void EstimateK(double* E)
22   -{
23   - int nVals = RefSpectrum[currentSpec].size();
24   - double nuStart = RefSpectrum[currentSpec].front().nu;
25   - double nuEnd = RefSpectrum[currentSpec].back().nu;
26   -
27   - double r = radius/10000.0;
28   - double nu;
29   - double dNu = (nuEnd - nuStart)/(nVals-1);
30   - double eScale;
31   - for(int i=0; i<nVals; i++)
32   - {
33   - nu = nuStart + i*2;
34   -
35   - eScale = 1/(8*PI*r*nu);
36   - EtaK[i].A = EtaK[i].A + eScale * E[i];
37   - if(EtaK[i].A < 0.0) EtaK[i].A = 0.0;
38   - }
39   -}
40   -
41   -void EstimateMaterial()
42   -{
43   - /*This function estimates the material properties of a sphere based on the
44   - input spectrum RefSpectrum and the optical properties of the system.
45   - 1) The material properties are stored in EtaK and EtaN
46   - 2) The best fit is stored in SimSpectrum*/
47   -
48   - //initialize the material index of refraction
49   - EtaN.clear();
50   - EtaK.clear();
51   -
52   - //insert the default material properties
53   - SpecPair temp;
54   - for(int s=0; s<(int)RefSpectrum[currentSpec].size(); s++)
55   - {
56   - //the real part of the IR is the user-specified baseline IR
57   - temp.nu = RefSpectrum[currentSpec][s].nu;
58   - temp.A = baseIR;
59   - EtaN.push_back(temp);
60   - //the imaginary part of the IR is zero absorbance
61   - temp.A = 0.0f;
62   - EtaK.push_back(temp);
63   - }
64   -
65   -
66   - //allocate space to store the list of error values
67   - double* E = (double*)malloc(sizeof(double) * RefSpectrum[currentSpec].size());
68   - //copy the absorbance values into a linear array
69   - double* k = (double*)malloc(sizeof(double) * EtaK.size());
70   - double* n = (double*)malloc(sizeof(double) * EtaN.size());
71   -
72   - //iterate to solve for both n and k
73   - double sumE = 99999.9;
74   - int j=0;
75   - //clear the console
76   - system("cls");
77   - while(sumE > minMSE && j < maxFitIter)
78   - {
79   - //simulate a spectrum based on the current IR
80   - SimulateSpectrum();
81   -
82   - //calculate the error term
83   - sumE = CalculateError(E);
84   -
85   - //estimate the new absorbance
86   - EstimateK(E);
87   -
88   - //use Kramers-Kronig to compute n
89   -
90   - for(unsigned int i=0; i<EtaK.size(); i++)
91   - k[i] = EtaK[i].A;
92   - cudaKramersKronig(n, k, EtaK.size(), EtaK.front().nu, EtaK.back().nu, baseIR);
93   -
94   - //copy the real part of the index of refraction into the vector
95   - EtaN.clear();
96   - for(int i=0; i<(int)EtaK.size(); i++)
97   - {
98   - temp.nu = EtaK[i].nu;
99   - temp.A = n[i];
100   - EtaN.push_back(temp);
101   - }
102   -
103   - cout<<" E = "<<sumE<<endl;
104   - j++;
105   - //SaveSpectrum(n, nVals, "simNj.txt");
106   - //SaveSpectrum(k, nVals, "simKj.txt");
107   - //SaveSpectrum(simSpec, nVals, "simSpec.txt");
108   - //exit(1);
109   -
110   - }
111   -
112   - free(E);
113   - free(k);
114   - free(n);
115   -
116   -
117   -
118   -
119   -}
120 1 \ No newline at end of file
  2 +#include "globals.h"
  3 +#include <stdlib.h>
  4 +#define PI 3.14159
  5 +
  6 +double CalculateError(double* E)
  7 +{
  8 + //Calculate the error between the Reference Spectrum and the Simulated Spectrum
  9 + double sumE = 0.0;
  10 + int nVals = RefSpectrum[currentSpec].size();
  11 + double nu;
  12 + for(int i=0; i<nVals; i++)
  13 + {
  14 + nu = RefSpectrum[currentSpec][i].nu;
  15 + E[i] = RefSpectrum[currentSpec][i].A + nu * refSlope - SimSpectrum[i].A;
  16 + sumE += E[i]*E[i];
  17 + }
  18 +
  19 + return sumE/nVals;
  20 +}
  21 +
  22 +void EstimateK(double* E)
  23 +{
  24 + int nVals = RefSpectrum[currentSpec].size();
  25 + double nuStart = RefSpectrum[currentSpec].front().nu;
  26 + double nuEnd = RefSpectrum[currentSpec].back().nu;
  27 +
  28 + double r = radius/10000.0;
  29 + double nu;
  30 + double dNu = (nuEnd - nuStart)/(nVals-1);
  31 + double eScale;
  32 + for(int i=0; i<nVals; i++)
  33 + {
  34 + nu = nuStart + i*2;
  35 +
  36 + eScale = 1/(8*PI*r*nu);
  37 + EtaK[i].A = EtaK[i].A + eScale * E[i];
  38 + if(EtaK[i].A < 0.0) EtaK[i].A = 0.0;
  39 + }
  40 +}
  41 +
  42 +void EstimateMaterial()
  43 +{
  44 + /*This function estimates the material properties of a sphere based on the
  45 + input spectrum RefSpectrum and the optical properties of the system.
  46 + 1) The material properties are stored in EtaK and EtaN
  47 + 2) The best fit is stored in SimSpectrum*/
  48 +
  49 + //initialize the material index of refraction
  50 + EtaN.clear();
  51 + EtaK.clear();
  52 +
  53 + //insert the default material properties
  54 + SpecPair temp;
  55 + for(int s=0; s<(int)RefSpectrum[currentSpec].size(); s++)
  56 + {
  57 + //the real part of the IR is the user-specified baseline IR
  58 + temp.nu = RefSpectrum[currentSpec][s].nu;
  59 + temp.A = baseIR;
  60 + EtaN.push_back(temp);
  61 + //the imaginary part of the IR is zero absorbance
  62 + temp.A = 0.0f;
  63 + EtaK.push_back(temp);
  64 + }
  65 +
  66 +
  67 + //allocate space to store the list of error values
  68 + double* E = (double*)malloc(sizeof(double) * RefSpectrum[currentSpec].size());
  69 + //copy the absorbance values into a linear array
  70 + double* k = (double*)malloc(sizeof(double) * EtaK.size());
  71 + double* n = (double*)malloc(sizeof(double) * EtaN.size());
  72 +
  73 + //iterate to solve for both n and k
  74 + double sumE = 99999.9;
  75 + int j=0;
  76 + //clear the console
  77 + system("cls");
  78 + while(sumE > minMSE && j < maxFitIter)
  79 + {
  80 + //simulate a spectrum based on the current IR
  81 + SimulateSpectrum();
  82 +
  83 + //calculate the error term
  84 + sumE = CalculateError(E);
  85 +
  86 + //estimate the new absorbance
  87 + EstimateK(E);
  88 +
  89 + //use Kramers-Kronig to compute n
  90 +
  91 + for(unsigned int i=0; i<EtaK.size(); i++)
  92 + k[i] = EtaK[i].A;
  93 + cudaKramersKronig(n, k, EtaK.size(), EtaK.front().nu, EtaK.back().nu, baseIR);
  94 +
  95 + //copy the real part of the index of refraction into the vector
  96 + EtaN.clear();
  97 + for(int i=0; i<(int)EtaK.size(); i++)
  98 + {
  99 + temp.nu = EtaK[i].nu;
  100 + temp.A = n[i];
  101 + EtaN.push_back(temp);
  102 + }
  103 +
  104 + cout<<" E = "<<sumE<<endl;
  105 + j++;
  106 + //SaveSpectrum(n, nVals, "simNj.txt");
  107 + //SaveSpectrum(k, nVals, "simKj.txt");
  108 + //SaveSpectrum(simSpec, nVals, "simSpec.txt");
  109 + //exit(1);
  110 +
  111 + }
  112 +
  113 + free(E);
  114 + free(k);
  115 + free(n);
  116 +
  117 +
  118 +
  119 +
  120 +}
... ...
FileIO.cpp
... ... @@ -6,191 +6,198 @@ using namespace std;
6 6  
7 7 vector<SpecPair> LoadSpectrum(string filename)
8 8 {
9   - //load a spectrum from a file and resample to 2wn intervals
10   -
11   - //create the spectrum
12   - vector<SpecPair> S;
13   -
14   - //open the file
15   - ifstream inFile(filename.c_str());
16   -
17   - //read all elements of the file
18   - SpecPair temp;
19   - while(!inFile.eof()){
20   - inFile>>temp.nu;
21   - inFile>>temp.A;
22   - S.push_back(temp);
23   - }
24   -
25   - //compute the minimum and maximum input wavenumbers
26   - double inMin = S.front().nu;
27   - double inMax = S.back().nu;
28   -
29   - int nuMin = (int)ceil(inMin);
30   - int nuMax = (int)floor(inMax);
31   -
32   - //make sure both are either even or odd
33   - if(nuMin % 2 != nuMax % 2)
34   - nuMax--;
35   -
36   - //compute the number of values in the resampled spectrum
37   - int nVals = (nuMax - nuMin)/2 + 1;
38   -
39   - //allocate space for the spectrum
40   - vector<SpecPair> outSpec;
41   -
42   - double nu, highVal, lowVal, a;
43   - int j=1;
44   - for(int i=0; i<nVals; i++)
45   - {
46   - nu = nuMin + i * 2;
47   - temp.nu = nu;
48   -
49   - //handle the boundary cases
50   - if(nu < inMin || nu > inMax)
51   - temp.A = 0.0;
52   - else
53   - {
54   - //move to the correct position in the input array
55   - while(j < (int)S.size()-1 && S[j].nu <= nu)
56   - j++;
57   -
58   -
59   - lowVal = S[j-1].nu;
60   - highVal = S[j].nu;
61   - a = (nu - lowVal)/(highVal - lowVal);
62   - temp.A = S[j-1].A * (1.0 - a) + S[j].A * a;
63   - }
64   - outSpec.push_back(temp);
65   - }
66   -
67   -
68   -
69   - return outSpec;
  9 + //load a spectrum from a file and resample to 2wn intervals
  10 +
  11 + //create the spectrum
  12 + vector<SpecPair> S;
  13 +
  14 + //open the file
  15 + ifstream inFile(filename.c_str());
  16 + if(!inFile)
  17 + {
  18 + cout<<"Error loading spectrum: "<<inFile<<endl;
  19 + return S;
  20 + }
  21 +
  22 + //read all elements of the file
  23 + SpecPair temp;
  24 + while(!inFile.eof()) {
  25 + inFile>>temp.nu;
  26 + inFile>>temp.A;
  27 + S.push_back(temp);
  28 + }
  29 +
  30 + //compute the minimum and maximum input wavenumbers
  31 + double inMin = S.front().nu;
  32 + double inMax = S.back().nu;
  33 +
  34 + int nuMin = (int)ceil(inMin);
  35 + int nuMax = (int)floor(inMax);
  36 +
  37 + //make sure both are either even or odd
  38 + if(nuMin % 2 != nuMax % 2)
  39 + nuMax--;
  40 +
  41 + //compute the number of values in the resampled spectrum
  42 + int nVals = (nuMax - nuMin)/2 + 1;
  43 +
  44 + //allocate space for the spectrum
  45 + vector<SpecPair> outSpec;
  46 +
  47 + double nu, highVal, lowVal, a;
  48 + int j=1;
  49 + for(int i=0; i<nVals; i++)
  50 + {
  51 + nu = nuMin + i * 2;
  52 + temp.nu = nu;
  53 +
  54 + //handle the boundary cases
  55 + if(nu < inMin || nu > inMax)
  56 + temp.A = 0.0;
  57 + else
  58 + {
  59 + //move to the correct position in the input array
  60 + while(j < (int)S.size()-1 && S[j].nu <= nu)
  61 + j++;
  62 +
  63 +
  64 + lowVal = S[j-1].nu;
  65 + highVal = S[j].nu;
  66 + a = (nu - lowVal)/(highVal - lowVal);
  67 + temp.A = S[j-1].A * (1.0 - a) + S[j].A * a;
  68 + }
  69 + outSpec.push_back(temp);
  70 + }
  71 +
  72 +
  73 +
  74 + return outSpec;
70 75 }
71 76  
72 77 vector<SpecPair> SetReferenceSpectrum(char* text)
73 78 {
74   - stringstream inString(text);
  79 + stringstream inString(text);
75 80  
76   - //create the spectrum
77   - vector<SpecPair> S;
  81 + //create the spectrum
  82 + vector<SpecPair> S;
78 83  
79   - SpecPair temp;
80   - while(!inString.eof()){
81   - inString>>temp.nu;
82   - inString>>temp.A;
83   - S.push_back(temp);
84   - }
  84 + SpecPair temp;
  85 + while(!inString.eof()) {
  86 + inString>>temp.nu;
  87 + inString>>temp.A;
  88 + S.push_back(temp);
  89 + }
85 90  
86   - return S;
  91 + return S;
87 92 }
88 93  
89   -void SaveK(string fileName)
  94 +/*void SaveK(string fileName)
90 95 {
91   - ofstream outFile(fileName.c_str());
92   - for(unsigned int i=0; i<EtaK.size(); i++)
93   - {
94   - outFile<<EtaK[i].nu<<" ";
95   - outFile<<EtaK[i].A<<endl;
96   - }
97   - outFile.close();
98   -}
99   -
100   -void SaveN(string fileName)
  96 + ofstream outFile(fileName.c_str());
  97 + for(unsigned int i=0; i<EtaK.size(); i++)
  98 + {
  99 + outFile<<EtaK[i].nu<<" ";
  100 + outFile<<EtaK[i].A<<endl;
  101 + }
  102 + outFile.close();
  103 +}*/
  104 +
  105 +void SaveMaterial(string fileName)
101 106 {
102   - ofstream outFile(fileName.c_str());
103   - for(unsigned int i=0; i<EtaN.size(); i++)
104   - {
105   - outFile<<EtaN[i].nu<<" ";
106   - outFile<<EtaN[i].A<<endl;
107   - }
108   - outFile.close();
  107 + ofstream outFile(fileName.c_str());
  108 + outFile<<"nu"<<'\t'<<"n"<<'\t'<<"k"<<endl;
  109 + for(unsigned int i=0; i<EtaN.size(); i++)
  110 + {
  111 + outFile<<EtaN[i].nu<<'\t';
  112 + outFile<<EtaN[i].A<<'\t';
  113 + outFile<<EtaK[i].A<<endl;
  114 + }
  115 + outFile.close();
109 116 }
110 117  
111 118 void SaveSimulation(string fileName)
112 119 {
113   - ofstream outFile(fileName.c_str());
114   - outFile.precision(10);
115   - for(unsigned int i=0; i<SimSpectrum.size(); i++)
116   - {
117   - outFile<<SimSpectrum[i].nu<<" ";
118   - outFile<<SimSpectrum[i].A<<endl;
119   - }
120   - outFile.close();
  120 + ofstream outFile(fileName.c_str());
  121 + outFile.precision(10);
  122 + for(unsigned int i=0; i<SimSpectrum.size(); i++)
  123 + {
  124 + outFile<<SimSpectrum[i].nu<<" ";
  125 + outFile<<SimSpectrum[i].A<<endl;
  126 + }
  127 + outFile.close();
121 128 }
122 129  
123 130 void SaveState()
124 131 {
125   - ofstream outFile("main.prj");
126   - //Window Parameters
127   - outFile<<nuMin<<endl;
128   - outFile<<nuMax<<endl;
129   - outFile<<aMin<<endl;
130   - outFile<<aMax<<endl;
131   - outFile<<dNu<<endl;
132   -
133   - //material parameters
134   - outFile<<radius<<endl;
135   - outFile<<baseIR<<endl;
136   - outFile<<cA<<endl;
137   -
138   - //optical parameters
139   - outFile<<cNAi<<endl;
140   - outFile<<cNAo<<endl;
141   - outFile<<oNAi<<endl;
142   - outFile<<oNAo<<endl;
143   -
144   - outFile.close();
  132 + ofstream outFile("main.prj");
  133 + //Window Parameters
  134 + outFile<<nuMin<<endl;
  135 + outFile<<nuMax<<endl;
  136 + outFile<<aMin<<endl;
  137 + outFile<<aMax<<endl;
  138 + outFile<<dNu<<endl;
  139 +
  140 + //material parameters
  141 + outFile<<radius<<endl;
  142 + outFile<<baseIR<<endl;
  143 + outFile<<cA<<endl;
  144 +
  145 + //optical parameters
  146 + outFile<<cNAi<<endl;
  147 + outFile<<cNAo<<endl;
  148 + outFile<<oNAi<<endl;
  149 + outFile<<oNAo<<endl;
  150 +
  151 + outFile.close();
145 152  
146 153 }
147 154  
148 155 void LoadState()
149 156 {
150   - ifstream inFile("main.prj");
151   - //Window Parameters
152   - inFile>>nuMin;
153   - inFile>>nuMax;
154   - inFile>>aMin;
155   - inFile>>aMax;
156   - inFile>>dNu;
157   -
158   - //material parameters
159   - inFile>>radius;
160   - inFile>>baseIR;
161   - inFile>>cA;
162   -
163   - //optical parameters
164   - inFile>>cNAi;
165   - inFile>>cNAo;
166   - inFile>>oNAi;
167   - inFile>>oNAo;
168   -
169   - inFile.close();
  157 + ifstream inFile("main.prj");
  158 + //Window Parameters
  159 + inFile>>nuMin;
  160 + inFile>>nuMax;
  161 + inFile>>aMin;
  162 + inFile>>aMax;
  163 + inFile>>dNu;
  164 +
  165 + //material parameters
  166 + inFile>>radius;
  167 + inFile>>baseIR;
  168 + inFile>>cA;
  169 +
  170 + //optical parameters
  171 + inFile>>cNAi;
  172 + inFile>>cNAo;
  173 + inFile>>oNAi;
  174 + inFile>>oNAo;
  175 +
  176 + inFile.close();
170 177  
171 178 }
172 179  
173 180 void SetDefaults()
174 181 {
175 182  
176   - nuMin = 800;
177   - nuMax = 4000;
178   - dNu = 2;
  183 + nuMin = 800;
  184 + nuMax = 4000;
  185 + dNu = 2;
179 186  
180   - aMin = 0;
181   - aMax = 1;
  187 + aMin = 0;
  188 + aMax = 1;
182 189  
183 190  
184   - //material parameters
185   - radius = 4.0f;
186   - baseIR = 1.49f;
187   - cA = 1.0;
188   - vector<SpecPair> KMaterial;
189   - vector<SpecPair> NMaterial;
  191 + //material parameters
  192 + radius = 4.0f;
  193 + baseIR = 1.49f;
  194 + cA = 1.0;
  195 + vector<SpecPair> KMaterial;
  196 + vector<SpecPair> NMaterial;
190 197  
191   - //optical parameters
192   - cNAi = 0.0;
193   - cNAo = 0.6;
194   - oNAi = 0.0;
195   - oNAo = 0.6;
196   -}
197 198 \ No newline at end of file
  199 + //optical parameters
  200 + cNAi = 0.0;
  201 + cNAo = 0.6;
  202 + oNAi = 0.0;
  203 + oNAo = 0.6;
  204 +}
... ...
GAMMA.cpp
1   -// gamma.cpp -- computation of gamma function.
2   -// Algorithms and coefficient values from "Computation of Special
3   -// Functions", Zhang and Jin, John Wiley and Sons, 1996.
4   -//
5   -// (C) 2003, C. Bond. All rights reserved.
6   -//
7   -// Returns gamma function of argument 'x'.
8   -//
9   -// NOTE: Returns 1e308 if argument is a negative integer or 0,
10   -// or if argument exceeds 171.
11   -//
12   -#define _USE_MATH_DEFINES
13   -#include <math.h>
14   -double gamma(double x)
15   -{
16   - int i,k,m;
17   - double ga,gr,r,z;
18   -
19   - static double g[] = {
20   - 1.0,
21   - 0.5772156649015329,
22   - -0.6558780715202538,
23   - -0.420026350340952e-1,
24   - 0.1665386113822915,
25   - -0.421977345555443e-1,
26   - -0.9621971527877e-2,
27   - 0.7218943246663e-2,
28   - -0.11651675918591e-2,
29   - -0.2152416741149e-3,
30   - 0.1280502823882e-3,
31   - -0.201348547807e-4,
32   - -0.12504934821e-5,
33   - 0.1133027232e-5,
34   - -0.2056338417e-6,
35   - 0.6116095e-8,
36   - 0.50020075e-8,
37   - -0.11812746e-8,
38   - 0.1043427e-9,
39   - 0.77823e-11,
40   - -0.36968e-11,
41   - 0.51e-12,
42   - -0.206e-13,
43   - -0.54e-14,
44   - 0.14e-14};
45   -
46   - if (x > 171.0) return 1e308; // This value is an overflow flag.
47   - if (x == (int)x) {
48   - if (x > 0.0) {
49   - ga = 1.0; // use factorial
50   - for (i=2;i<x;i++) {
51   - ga *= i;
52   - }
53   - }
54   - else
55   - ga = 1e308;
56   - }
57   - else {
58   - if (fabs(x) > 1.0) {
59   - z = fabs(x);
60   - m = (int)z;
61   - r = 1.0;
62   - for (k=1;k<=m;k++) {
63   - r *= (z-k);
64   - }
65   - z -= m;
66   - }
67   - else
68   - z = x;
69   - gr = g[24];
70   - for (k=23;k>=0;k--) {
71   - gr = gr*z+g[k];
72   - }
73   - ga = 1.0/(gr*z);
74   - if (fabs(x) > 1.0) {
75   - ga *= r;
76   - if (x < 0.0) {
77   - ga = -M_PI/(x*ga*sin(M_PI*x));
78   - }
79   - }
80   - }
81   - return ga;
82   -}
  1 +// gamma.cpp -- computation of gamma function.
  2 +// Algorithms and coefficient values from "Computation of Special
  3 +// Functions", Zhang and Jin, John Wiley and Sons, 1996.
  4 +//
  5 +// (C) 2003, C. Bond. All rights reserved.
  6 +//
  7 +// Returns gamma function of argument 'x'.
  8 +//
  9 +// NOTE: Returns 1e308 if argument is a negative integer or 0,
  10 +// or if argument exceeds 171.
  11 +//
  12 +#define _USE_MATH_DEFINES
  13 +#include <math.h>
  14 +double gamma(double x)
  15 +{
  16 + int i,k,m;
  17 + double ga,gr,r,z;
  18 +
  19 + static double g[] = {
  20 + 1.0,
  21 + 0.5772156649015329,
  22 + -0.6558780715202538,
  23 + -0.420026350340952e-1,
  24 + 0.1665386113822915,
  25 + -0.421977345555443e-1,
  26 + -0.9621971527877e-2,
  27 + 0.7218943246663e-2,
  28 + -0.11651675918591e-2,
  29 + -0.2152416741149e-3,
  30 + 0.1280502823882e-3,
  31 + -0.201348547807e-4,
  32 + -0.12504934821e-5,
  33 + 0.1133027232e-5,
  34 + -0.2056338417e-6,
  35 + 0.6116095e-8,
  36 + 0.50020075e-8,
  37 + -0.11812746e-8,
  38 + 0.1043427e-9,
  39 + 0.77823e-11,
  40 + -0.36968e-11,
  41 + 0.51e-12,
  42 + -0.206e-13,
  43 + -0.54e-14,
  44 + 0.14e-14
  45 + };
  46 +
  47 + if (x > 171.0) return 1e308; // This value is an overflow flag.
  48 + if (x == (int)x) {
  49 + if (x > 0.0) {
  50 + ga = 1.0; // use factorial
  51 + for (i=2; i<x; i++) {
  52 + ga *= i;
  53 + }
  54 + }
  55 + else
  56 + ga = 1e308;
  57 + }
  58 + else {
  59 + if (fabs(x) > 1.0) {
  60 + z = fabs(x);
  61 + m = (int)z;
  62 + r = 1.0;
  63 + for (k=1; k<=m; k++) {
  64 + r *= (z-k);
  65 + }
  66 + z -= m;
  67 + }
  68 + else
  69 + z = x;
  70 + gr = g[24];
  71 + for (k=23; k>=0; k--) {
  72 + gr = gr*z+g[k];
  73 + }
  74 + ga = 1.0/(gr*z);
  75 + if (fabs(x) > 1.0) {
  76 + ga *= r;
  77 + if (x < 0.0) {
  78 + ga = -M_PI/(x*ga*sin(M_PI*x));
  79 + }
  80 + }
  81 + }
  82 + return ga;
  83 +}
... ...
PerformanceData.h
1   -// add the following to a cpp file:
2   -// PerformanceData PD;
3   -
4   -
5   -#pragma once
6   -#include <ostream>
7   -using namespace std;
8   -
9   -enum PerformanceDataType
10   -{
11   - PD_DISPLAY=0,
12   - PD_SPS,
13   - PD_UNUSED0,
14   -
15   - //my stuff
16   - SIMULATE_SPECTRUM,
17   - SIMULATE_GPU,
18   - KRAMERS_KRONIG,
19   -
20   -
21   -
22   - //end my stuff
23   - PERFORMANCE_DATA_TYPE_COUNT
24   -};
25   -
26   -static char PDTypeNames[][255] = {
27   - "Display ",
28   - "Simulation Total ",
29   - " ----------------- ",
30   - //my stuff
31   - "Simulate Spectrum ",
32   - " GPU Portion ",
33   - "Kramers-Kronig ",
34   -
35   - //end my stuff
36   -
37   -};
38   -#ifdef WIN32
39   -#include <stdio.h>
40   -#include <windows.h>
41   -#include <float.h>
42   -
43   -#include <iostream>
44   -#include <iomanip>
45   -
46   -//-------------------------------------------------------------------------------
47   -
48   -class PerformanceData
49   -{
50   -public:
51   - PerformanceData() { ClearAll(); QueryPerformanceFrequency(&cps); }
52   - ~PerformanceData(){}
53   -
54   - void ClearAll()
55   - {
56   - for ( int i=0; i<PERFORMANCE_DATA_TYPE_COUNT; i++ ) {
57   - for ( int j=0; j<256; j++ ) times[i][j] = 0;
58   - pos[i] = 0;
59   - minTime[i] = 0xFFFFFFFF;
60   - maxTime[i] = 0;
61   - totalTime[i] = 0;
62   - dataReady[i] = false;
63   - }
64   - }
65   -
66   - void StartTimer( int type ) { QueryPerformanceCounter( &startTime[type] );}
67   - void EndTimer( int type ) {
68   - LARGE_INTEGER endTime;
69   - QueryPerformanceCounter( &endTime );
70   - double t = (double)(endTime.QuadPart - startTime[type].QuadPart);
71   - //unsigned int t = GetTickCount() - startTime[type];
72   - if ( t < minTime[type] ) minTime[type] = t;
73   - if ( t > maxTime[type] ) maxTime[type] = t;
74   - totalTime[type] -= times[type][ pos[type] ];
75   - times[type][ pos[type] ] = t;
76   - totalTime[type] += t;
77   - pos[type]++;
78   - if ( pos[type] == 0 ) dataReady[type] = true;
79   - }
80   -
81   - void PrintResult( ostream &os,int i=PERFORMANCE_DATA_TYPE_COUNT)
82   - {
83   - os.setf(ios::fixed);
84   - if ((i<PERFORMANCE_DATA_TYPE_COUNT)&&(i>=0)){
85   - double a = GetAvrgTime(i);
86   - if ( a )
87   - os<< PDTypeNames[i]<<" : avrg="<<setw(8)<<setprecision(3)<<a<<"\tmin="<<setw(8)<<setprecision(3)<< GetMinTime(i) <<"\tmax="<<setw(8)<<setprecision(3)<< GetMaxTime(i) <<endl ;
88   - else
89   - os<< PDTypeNames[i]<<" : avrg= -----\tmin= -----\tmax= -----"<<endl;
90   - }
91   - }
92   -
93   - void PrintResults( ostream &os)
94   - {
95   - for ( int i=0; i<PERFORMANCE_DATA_TYPE_COUNT; i++ )
96   - PrintResult(os,i);
97   - }
98   -
99   - double GetLastTime( int type ) { return times[type][pos[type]]; }
100   - double GetAvrgTime( int type ) { double a = 1000.0 * totalTime[type] / (float)cps.QuadPart / ( (dataReady[type]) ? 256.0 : (double)pos[type] ); return (_finite(a))? a:0; }
101   - double GetMinTime( int type ) { return 1000.0 * minTime[type] / (float)cps.LowPart; }
102   - double GetMaxTime( int type ) { return 1000.0 * maxTime[type] / (float)cps.LowPart; }
103   -
104   -private:
105   - double times[PERFORMANCE_DATA_TYPE_COUNT][256];
106   - unsigned char pos[PERFORMANCE_DATA_TYPE_COUNT];
107   - LARGE_INTEGER startTime[PERFORMANCE_DATA_TYPE_COUNT];
108   - double minTime[ PERFORMANCE_DATA_TYPE_COUNT ];
109   - double maxTime[ PERFORMANCE_DATA_TYPE_COUNT ];
110   - double totalTime[ PERFORMANCE_DATA_TYPE_COUNT ];
111   - bool dataReady[ PERFORMANCE_DATA_TYPE_COUNT ];
112   - LARGE_INTEGER cps;
113   -};
114   -
115   -//-------------------------------------------------------------------------------
116   -#else
117   -
118   -class PerformanceData{
119   -public:
120   - PerformanceData() {;};
121   - ~PerformanceData(){;};
122   - void ClearAll(){;};
123   - void StartTimer( int type ) {;};
124   - void EndTimer( int type ) {;};
125   - void PrintResults( ostream &os){;};
126   - void PrintResult( ostream &os, int i=PERFORMANCE_DATA_TYPE_COUNT){;};
127   - double GetLastTime( int type ) { return 0.0; };
128   - double GetAvrgTime( int type ) { return 0.0; };
129   - double GetMinTime( int type ) { return 0.0; };
130   - double GetMaxTime( int type ) { return 0.0; };
131   -};
132   -
133   -#endif
134   -//-------------------------------------------------------------------------------
135   -
136   -extern PerformanceData PD;
137   -
138   -//-------------------------------------------------------------------------------
  1 +// add the following to a cpp file:
  2 +// PerformanceData PD;
  3 +
  4 +
  5 +#pragma once
  6 +#include <ostream>
  7 +using namespace std;
  8 +
  9 +enum PerformanceDataType
  10 +{
  11 + PD_DISPLAY=0,
  12 + PD_SPS,
  13 + PD_UNUSED0,
  14 +
  15 + //my stuff
  16 + SIMULATE_SPECTRUM,
  17 + SIMULATE_GPU,
  18 + KRAMERS_KRONIG,
  19 +
  20 +
  21 +
  22 + //end my stuff
  23 + PERFORMANCE_DATA_TYPE_COUNT
  24 +};
  25 +
  26 +static char PDTypeNames[][255] = {
  27 + "Display ",
  28 + "Simulation Total ",
  29 + " ----------------- ",
  30 + //my stuff
  31 + "Simulate Spectrum ",
  32 + " GPU Portion ",
  33 + "Kramers-Kronig ",
  34 +
  35 + //end my stuff
  36 +
  37 +};
  38 +#ifdef WIN32
  39 +#include <stdio.h>
  40 +#include <windows.h>
  41 +#include <float.h>
  42 +
  43 +#include <iostream>
  44 +#include <iomanip>
  45 +
  46 +//-------------------------------------------------------------------------------
  47 +
  48 +class PerformanceData
  49 +{
  50 +public:
  51 + PerformanceData() {
  52 + ClearAll();
  53 + QueryPerformanceFrequency(&cps);
  54 + }
  55 + ~PerformanceData() {}
  56 +
  57 + void ClearAll()
  58 + {
  59 + for ( int i=0; i<PERFORMANCE_DATA_TYPE_COUNT; i++ ) {
  60 + for ( int j=0; j<256; j++ ) times[i][j] = 0;
  61 + pos[i] = 0;
  62 + minTime[i] = 0xFFFFFFFF;
  63 + maxTime[i] = 0;
  64 + totalTime[i] = 0;
  65 + dataReady[i] = false;
  66 + }
  67 + }
  68 +
  69 + void StartTimer( int type ) {
  70 + QueryPerformanceCounter( &startTime[type] );
  71 + }
  72 + void EndTimer( int type ) {
  73 + LARGE_INTEGER endTime;
  74 + QueryPerformanceCounter( &endTime );
  75 + double t = (double)(endTime.QuadPart - startTime[type].QuadPart);
  76 + //unsigned int t = GetTickCount() - startTime[type];
  77 + if ( t < minTime[type] ) minTime[type] = t;
  78 + if ( t > maxTime[type] ) maxTime[type] = t;
  79 + totalTime[type] -= times[type][ pos[type] ];
  80 + times[type][ pos[type] ] = t;
  81 + totalTime[type] += t;
  82 + pos[type]++;
  83 + if ( pos[type] == 0 ) dataReady[type] = true;
  84 + }
  85 +
  86 + void PrintResult( ostream &os,int i=PERFORMANCE_DATA_TYPE_COUNT)
  87 + {
  88 + os.setf(ios::fixed);
  89 + if ((i<PERFORMANCE_DATA_TYPE_COUNT)&&(i>=0)) {
  90 + double a = GetAvrgTime(i);
  91 + if ( a )
  92 + os<< PDTypeNames[i]<<" : avrg="<<setw(8)<<setprecision(3)<<a<<"\tmin="<<setw(8)<<setprecision(3)<< GetMinTime(i) <<"\tmax="<<setw(8)<<setprecision(3)<< GetMaxTime(i) <<endl ;
  93 + else
  94 + os<< PDTypeNames[i]<<" : avrg= -----\tmin= -----\tmax= -----"<<endl;
  95 + }
  96 + }
  97 +
  98 + void PrintResults( ostream &os)
  99 + {
  100 + for ( int i=0; i<PERFORMANCE_DATA_TYPE_COUNT; i++ )
  101 + PrintResult(os,i);
  102 + }
  103 +
  104 + double GetLastTime( int type ) {
  105 + return times[type][pos[type]];
  106 + }
  107 + double GetAvrgTime( int type ) {
  108 + double a = 1000.0 * totalTime[type] / (float)cps.QuadPart / ( (dataReady[type]) ? 256.0 : (double)pos[type] );
  109 + return (_finite(a))? a:0;
  110 + }
  111 + double GetMinTime( int type ) {
  112 + return 1000.0 * minTime[type] / (float)cps.LowPart;
  113 + }
  114 + double GetMaxTime( int type ) {
  115 + return 1000.0 * maxTime[type] / (float)cps.LowPart;
  116 + }
  117 +
  118 +private:
  119 + double times[PERFORMANCE_DATA_TYPE_COUNT][256];
  120 + unsigned char pos[PERFORMANCE_DATA_TYPE_COUNT];
  121 + LARGE_INTEGER startTime[PERFORMANCE_DATA_TYPE_COUNT];
  122 + double minTime[ PERFORMANCE_DATA_TYPE_COUNT ];
  123 + double maxTime[ PERFORMANCE_DATA_TYPE_COUNT ];
  124 + double totalTime[ PERFORMANCE_DATA_TYPE_COUNT ];
  125 + bool dataReady[ PERFORMANCE_DATA_TYPE_COUNT ];
  126 + LARGE_INTEGER cps;
  127 +};
  128 +
  129 +//-------------------------------------------------------------------------------
  130 +#else
  131 +
  132 +class PerformanceData {
  133 +public:
  134 + PerformanceData() {
  135 + ;
  136 + };
  137 + ~PerformanceData() {
  138 + ;
  139 + };
  140 + void ClearAll() {
  141 + ;
  142 + };
  143 + void StartTimer( int type ) {
  144 + ;
  145 + };
  146 + void EndTimer( int type ) {
  147 + ;
  148 + };
  149 + void PrintResults( ostream &os) {
  150 + ;
  151 + };
  152 + void PrintResult( ostream &os, int i=PERFORMANCE_DATA_TYPE_COUNT) {
  153 + ;
  154 + };
  155 + double GetLastTime( int type ) {
  156 + return 0.0;
  157 + };
  158 + double GetAvrgTime( int type ) {
  159 + return 0.0;
  160 + };
  161 + double GetMinTime( int type ) {
  162 + return 0.0;
  163 + };
  164 + double GetMaxTime( int type ) {
  165 + return 0.0;
  166 + };
  167 +};
  168 +
  169 +#endif
  170 +//-------------------------------------------------------------------------------
  171 +
  172 +extern PerformanceData PD;
  173 +
  174 +//-------------------------------------------------------------------------------
... ...
SimulateSpectrum.cpp
1   -#include <math.h>
2   -#include <complex>
3   -#include <iostream>
4   -#include <fstream>
5   -#include "globals.h"
6   -#include <QProgressDialog>
7   -#include <stdlib.h>
8   -//#include "cufft.h"
9   -using namespace std;
10   -
11   -#define pi 3.14159
12   -
13   -typedef complex<double> scComplex;
14   -
15   -extern int cbessjyva(double v,complex<double> z,double &vm,complex<double>*cjv,
16   - complex<double>*cyv,complex<double>*cjvp,complex<double>*cyvp);
17   -extern int bessjyv(double v,double x,double &vm,double *jv,double *yv,
18   - double *djv,double *dyv);
19   -
20   -complex<double> Jl_neg(complex<double> x)
21   -{
22   - //this function computes the bessel function of the first kind Jl(x) for l = -0.5
23   - return ( sqrt(2.0/pi) * cos(x) )/sqrt(x);
24   -}
25   -
26   -double Jl_neg(double x)
27   -{
28   - //this function computes the bessel function of the first kind Jl(x) for l = -0.5
29   - return ( sqrt(2.0/pi) * cos(x) )/sqrt(x);
30   -}
31   -
32   -double Yl_neg(double x)
33   -{
34   - //this function computes the bessel function of the second kind Yl(x) for l = -0.5;
35   - return ( sqrt(2.0/pi) * sin(x) )/sqrt(x);
36   -}
37   -
38   -void computeB(complex<double>* B, double radius, complex<double> refIndex, double lambda, int Nl)
39   -{
40   - double k = (2*pi)/lambda;
41   - int b = 2;
42   -
43   - //allocate space for the real bessel functions
44   - double* jv = (double*)malloc(sizeof(double)*(Nl+b));
45   - double* yv = (double*)malloc(sizeof(double)*(Nl+b));
46   - double* jvp = (double*)malloc(sizeof(double)*(Nl+b));
47   - double* yvp = (double*)malloc(sizeof(double)*(Nl+b));
48   -
49   - //allocate space for the complex bessel functions
50   - complex<double>* cjv = (complex<double>*)malloc(sizeof(complex<double>)*(Nl+b));
51   - complex<double>* cyv = (complex<double>*)malloc(sizeof(complex<double>)*(Nl+b));
52   - complex<double>* cjvp = (complex<double>*)malloc(sizeof(complex<double>)*(Nl+b));
53   - complex<double>* cyvp = (complex<double>*)malloc(sizeof(complex<double>)*(Nl+b));
54   -
55   - double kr = k*radius;
56   - complex<double> knr = k*refIndex*(double)radius;
57   - complex<double> n = refIndex;
58   -
59   - //compute the bessel functions for k*r
60   - double vm;// = Nl - 1;
61   - bessjyv((Nl)+0.5, kr, vm, jv, yv, jvp, yvp);
62   - //cout<<"Nl: "<<Nl<<" vm: "<<vm<<endl;
63   - //printf("Nl: %f, vm: %f\n", (float)Nl, (float)vm);
64   -
65   - //compute the bessel functions for k*n*r
66   - cbessjyva((Nl)+0.5, knr, vm, cjv, cyv, cjvp, cyvp);
67   -
68   - //scale factor for spherical bessel functions
69   - double scale_kr = sqrt(pi/(2.0*kr));
70   - complex<double> scale_knr = sqrt(pi/(2.0*knr));
71   -
72   - complex<double> numer, denom;
73   - double j_kr;
74   - double y_kr;
75   - complex<double> j_knr;
76   - complex<double> j_d_knr;
77   - double j_d_kr;
78   - complex<double> h_kr;
79   - complex<double> h_d_kr;
80   - complex<double> h_neg;
81   - complex<double> h_pos;
82   -
83   - //cout<<"B coefficients:"<<endl;
84   - for(int l=0; l<Nl; l++)
85   - {
86   - //compute the spherical bessel functions
87   - j_kr = jv[l] * scale_kr;
88   - y_kr = yv[l] * scale_kr;
89   - j_knr = cjv[l] * scale_knr;
90   -
91   - //compute the Hankel function
92   - h_kr = complex<double>(j_kr, y_kr);
93   -
94   - //compute the derivatives
95   - if(l == 0)
96   - {
97   - //spherical bessel functions for l=0
98   - j_d_kr = scale_kr * (Jl_neg(kr) - (jv[l] + kr*jv[l+1])/kr )/2.0;
99   - j_d_knr = scale_knr * ( Jl_neg(knr) - (cjv[l] + knr*cjv[l+1])/knr )/2.0;
100   - h_neg = complex<double>(scale_kr*Jl_neg(kr), scale_kr*Yl_neg(kr));
101   - h_pos = complex<double>(scale_kr*jv[l+1], scale_kr*yv[l+1]);
102   - h_d_kr = (h_neg - (h_kr + kr*h_pos)/kr)/2.0;
103   - }
104   - else
105   - {
106   - //spherical bessel functions
107   - j_d_kr = scale_kr * (jv[l-1] - (jv[l] + kr*jv[l+1])/kr )/2.0;
108   - j_d_knr = scale_knr * ( cjv[l-1] - (cjv[l] + knr*cjv[l+1])/knr )/2.0;
109   - h_neg = complex<double>(scale_kr*jv[l-1], scale_kr*yv[l-1]);
110   - h_pos = complex<double>(scale_kr*jv[l+1], scale_kr*yv[l+1]);
111   - h_d_kr = (h_neg - (h_kr + kr*h_pos)/kr)/2.0;
112   - }
113   -
114   - numer = j_kr*j_d_knr*n - j_knr*j_d_kr;
115   - denom = j_knr*h_d_kr - h_kr*j_d_knr*n;
116   - B[l] = numer/denom;
117   -
118   - //B[l] = scComplex(temp.real(), temp.imag());
119   - //cout<<B[l]<<endl;
120   - }
121   -
122   - free(jv);
123   - free(yv);
124   - free(jvp);
125   - free(yvp);
126   - free(cjv);
127   - free(cyv);
128   - free(cjvp);
129   - free(cyvp);
130   -}
131   -
132   -void Legendre(double* P, double x, int Nl)
133   -{
134   - //computes the legendre polynomials from orders 0 to Nl-1
135   - P[0] = 1;
136   - if(Nl == 1) return;
137   - P[1] = x;
138   - for(int l = 2; l < Nl; l++)
139   - {
140   - P[l] = ((2*l - 1)*x*P[l-1] - (l - 1)*P[l-2])/l;
141   - }
142   -
143   -}
144   -
145   -complex<double> integrateUi(double cAngleI, double cAngleO, double oAngleI, double oAngleO, double M = 2*pi)
146   -{
147   - /*This function integrates the incident field of magnitude M in the far zone
148   - in order to evaluate the field at the central pixel of a detector.
149   - cNAi = condenser inner angle
150   - cNAo = condenser outer angle
151   - oNAi = objective inner angle
152   - oNAo = objective outer angle
153   - M = field magnitude*/
154   -
155   - double alphaIn = max(cAngleI, oAngleI);
156   - double alphaOut = min(cAngleO,oAngleO);
157   -
158   - complex<double> Ui;
159   - if(alphaIn > alphaOut)
160   - Ui = complex<double>(0.0, 0.0);
161   - else
162   - Ui = complex<double>(M * 2 * pi * (cos(alphaIn) - cos(alphaOut)), 0.0f);
163   -
164   - return Ui;
165   -
166   -}
167   -
168   -void computeCondenserAlpha(double* alpha, int Nl, double cAngleI, double cAngleO)
169   -{
170   - /*This function computes the condenser integral in order to build the field of incident light
171   - alpha = list of Nl floating point values representing the condenser alpha as a function of l
172   - Nl = number of orders in the incident field
173   - cAngleI, cAngleO = inner and outer condenser angles (inner and outer NA)*/
174   -
175   - //compute the Legendre polynomials for the condenser aperature
176   - double* PcNAo = (double*)malloc(sizeof(double)*(Nl+1));
177   - Legendre(PcNAo, cos(cAngleO), Nl+1);
178   - double* PcNAi = (double*)malloc(sizeof(double)*(Nl+1));
179   - Legendre(PcNAi, cos(cAngleI), Nl+1);
180   -
181   - for(int l=0; l<Nl; l++)
182   - {
183   - //integration term
184   - if(l == 0)
185   - alpha[l] = -PcNAo[l+1] + PcNAo[0] + PcNAi[l+1] - PcNAi[0];
186   - else
187   - alpha[l] = -PcNAo[l+1] + PcNAo[l-1] + PcNAi[l+1] - PcNAi[l-1];
188   -
189   - alpha[l] *= 2 * pi;
190   - }
191   -
192   -}
193   -
194   -complex<double> integrateUs(double r, double lambda, complex<double> eta,
195   - double cAngleI, double cAngleO, double oAngleI, double oAngleO, double M = 2*pi)
196   -{
197   - /*This function integrates the incident field of magnitude M in the far zone
198   - in order to evaluate the field at the central pixel of a detector.
199   - r = sphere radius
200   - lambda = wavelength
201   - eta = index of refraction
202   - cNAi = condenser inner NA
203   - cNAo = condenser outer NA
204   - oNAi = objective inner NA
205   - oNAo = objective outer NA
206   - M = field magnitude*/
207   -
208   - //compute the required number of orders
209   - double k = 2*pi/lambda;
210   - int Nl = (int)ceil( k + 4 * exp(log(k*r)/3) + 3 );
211   -
212   - //compute the material coefficients B
213   - complex<double>* B = (complex<double>*)malloc(sizeof(complex<double>)*Nl);
214   - //compute the Legendre polynomials for the condenser and objective aperatures
215   - double* PcNAo = (double*)malloc(sizeof(double)*(Nl+1));
216   - Legendre(PcNAo, cos(cAngleO), Nl+1);
217   - double* PcNAi = (double*)malloc(sizeof(double)*(Nl+1));
218   - Legendre(PcNAi, cos(cAngleI), Nl+1);
219   -
220   - double* PoNAo = (double*)malloc(sizeof(double)*(Nl+1));
221   - Legendre(PoNAo, cos(oAngleO), Nl+1);
222   - double* PoNAi = (double*)malloc(sizeof(double)*(Nl+1));
223   - Legendre(PoNAi, cos(oAngleI), Nl+1);
224   -
225   - //store the index of refraction;
226   - complex<double> IR(eta.real(), eta.imag());
227   -
228   - //compute the scattering coefficients
229   - computeB(B, r, IR, lambda, Nl);
230   -
231   - //aperature terms for the condenser (alpha) and objective (beta)
232   - double alpha;
233   - double beta;
234   - double c;
235   - complex<double> Us(0.0, 0.0);
236   -
237   - for(int l=0; l<Nl; l++)
238   - {
239   - //integration term
240   - if(l == 0)
241   - {
242   - alpha = -PcNAo[l+1] + PcNAo[0] + PcNAi[l+1] - PcNAi[0];
243   - beta = -PoNAo[l+1] + PoNAo[0] + PoNAi[l+1] - PoNAi[0];
244   - }
245   - else
246   - {
247   - alpha = -PcNAo[l+1] + PcNAo[l-1] + PcNAi[l+1] - PcNAi[l-1];
248   - beta = -PoNAo[l+1] + PoNAo[l-1] + PoNAi[l+1] - PoNAi[l-1];
249   - }
250   - c = (2*pi)/(2.0 * l + 1.0);
251   - Us += c * alpha * beta * B[l] * M;
252   -
253   -
254   - }
255   - free(PcNAo);
256   - free(PcNAi);
257   - free(PoNAo);
258   - free(PoNAi);
259   - free(B);
260   -
261   - return Us;
262   -
263   -}
264   -
265   -void pointSpectrum()
266   -{
267   - PD.StartTimer(SIMULATE_SPECTRUM);
268   - //clear the previous spectrum
269   - SimSpectrum.clear();
270   -
271   - double dNu = 2.0f;
272   - double lambda;
273   -
274   - //compute the angles based on NA
275   - double cAngleI = asin(cNAi);
276   - double cAngleO = asin(cNAo);
277   - double oAngleI = asin(oNAi);
278   - double oAngleO = asin(oNAo);
279   -
280   - //implement a reflection-mode system if necessary
281   - if(opticsMode == ReflectionOpticsType){
282   -
283   - //set the condenser to match the objective
284   - cAngleI = oAngleI;
285   - cAngleO = oAngleO;
286   -
287   - //invert the objective
288   - oAngleO = pi - cAngleI;
289   - oAngleI = pi - cAngleO;
290   - }
291   -
292   - //integrate the incident field at the detector position
293   - complex<double> Ui = integrateUi(cAngleI, cAngleO, oAngleI, oAngleO, 2*pi);
294   - double I0 = Ui.real() * Ui.real() + Ui.imag() * Ui.imag();
295   - I0 *= scaleI0;
296   -
297   -
298   -
299   - //double I;
300   - SpecPair temp;
301   - double nu;
302   - complex<double> eta;
303   - complex<double> Us, U;
304   -
305   - double vecLen = 0.0;
306   - for(unsigned int i=0; i<EtaK.size(); i++)
307   - {
308   - nu = EtaK[i].nu;
309   - lambda = 10000.0f/nu;
310   - if(applyMaterial)
311   - eta = complex<double>(EtaN[i].A, EtaK[i].A);
312   - else
313   - eta = complex<double>(baseIR, 0.0);
314   -
315   -
316   - //integrate the scattered field at the detector position
317   - Us = integrateUs(radius, lambda, eta, cAngleI, cAngleO, oAngleI, oAngleO, 2*pi);
318   - U = Us + Ui;
319   - double I = U.real() * U.real() + U.imag() * U.imag();
320   -
321   - temp.nu = nu;
322   -
323   - //set the spectrum value based on the current display type
324   - if(dispSimType == AbsorbanceSpecType)
325   - temp.A = -log10(I/I0);
326   - else
327   - temp.A = I;
328   -
329   - if(dispNormalize)
330   - vecLen += temp.A * temp.A;
331   -
332   - SimSpectrum.push_back(temp);
333   - }
334   - vecLen = sqrt(vecLen);
335   -
336   - if(dispNormalize)
337   - for(unsigned int i=0; i<SimSpectrum.size(); i++)
338   - SimSpectrum[i].A = (SimSpectrum[i].A / vecLen) * dispNormFactor;
339   -
340   - PD.EndTimer(SIMULATE_SPECTRUM);
341   -}
342   -
343   -void updateSpectrum(double* I, double I0, int n)
344   -{
345   - SimSpectrum.clear();
346   - SpecPair temp;
347   -
348   - //update the displayed spectrum based on the computed intensity I
349   - for(int i=0; i<n; i++)
350   - {
351   - temp.nu = EtaK[i].nu;
352   -
353   - //set the spectrum value based on the current display type
354   - if(dispSimType == AbsorbanceSpecType)
355   - {
356   - temp.A = -log10(I[i]/I0);
357   - //cout<<temp.nu<<" "<<I[i]<<endl;
358   - }
359   - else
360   - {
361   - temp.A = I[i];
362   - if(useSourceSpectrum)
363   - temp.A *= SourceResampled[i].A;
364   - }
365   -
366   - SimSpectrum.push_back(temp);
367   - }
368   -}
369   -
370   -void computeCassegrainAngles(double& cAngleI, double& cAngleO, double& oAngleI, double& oAngleO)
371   -{
372   - //compute the angles based on NA
373   - cAngleI = asin(cNAi);
374   - cAngleO = asin(cNAo);
375   - oAngleI = asin(oNAi);
376   - oAngleO = asin(oNAo);
377   -
378   - //implement a reflection-mode system if necessary
379   - if(opticsMode == ReflectionOpticsType){
380   -
381   - //set the condenser to match the objective
382   - cAngleI = oAngleI;
383   - cAngleO = oAngleO;
384   -
385   - //invert the objective
386   - oAngleO = pi - cAngleI;
387   - oAngleI = pi - cAngleO;
388   - }
389   -
390   -
391   -}
392   -
393   -int computeNl()
394   -{
395   - double maxNu = EtaK.back().nu;
396   - double maxLambda = 10000.0f/maxNu;
397   - double k = 2*pi/maxLambda;
398   - int Nl = (int)ceil( k + 4 * exp(log(k*radius)/3) + 3 );
399   -
400   - return Nl;
401   -}
402   -
403   -void computeBArray(complex<double>* B, int Nl, int nLambda)
404   -{
405   - double nu;
406   - complex<double> eta;
407   - double* Lambda = (double*)malloc(sizeof(double) * nLambda);
408   -
409   - //for each wavenumber nu
410   - for(unsigned int i=0; i<EtaK.size(); i++)
411   - {
412   - //compute information based on wavelength and material
413   - nu = EtaK[i].nu;
414   - Lambda[i] = 10000.0f/nu;
415   - if(applyMaterial)
416   - eta = complex<double>(EtaN[i].A, EtaK[i].A);
417   - else
418   - eta = complex<double>(baseIR, 0.0);
419   -
420   - //allocate memory for the scattering coefficients
421   - //complex<float>* B = (complex<float>*)malloc(sizeof(complex<float>)*Nl);
422   -
423   - complex<double> IR(eta.real(), eta.imag());
424   - computeB(&B[i * Nl], radius, IR, Lambda[i], Nl);
425   - }
426   -}
427   -
428   -void computeOpticalParameters(double& cAngleI, double& cAngleO, double& oAngleI, double& oAngleO, double& I0, double* alpha, int Nl)
429   -{
430   - computeCassegrainAngles(cAngleI, cAngleO, oAngleI, oAngleO);
431   -
432   - //evaluate the incident field intensity
433   - I0 = 0.0;
434   - complex<double> Ui;
435   -
436   - Ui = integrateUi(cAngleI, cAngleO, oAngleI, oAngleO, 2*pi);
437   - I0 = Ui.real()*2*pi;
438   -
439   - //compute alpha (condenser integral)
440   - computeCondenserAlpha(alpha, Nl, cAngleI, cAngleO);
441   -}
442   -
443   -void gpuDetectorSpectrum(int numSamples)
444   -{
445   - //integrate across the objective aperature and calculate the resulting intensity on a detector
446   - PD.StartTimer(SIMULATE_SPECTRUM);
447   - //clear the previous spectrum
448   - SimSpectrum.clear();
449   -
450   - //compute Nl (maximum order of the spectrum)
451   - int Nl = computeNl();
452   -
453   - double* alpha = (double*)malloc(sizeof(double)*(Nl + 1));
454   - double cAngleI, cAngleO, oAngleI, oAngleO, I0;
455   - computeOpticalParameters(cAngleI, cAngleO, oAngleI, oAngleO, I0, alpha, Nl);
456   -
457   - //allocate space for a list of wavelengths
458   - int nLambda = EtaK.size();
459   -
460   - //allocate space for the 2D array (Nl x nu) of scattering coefficients
461   - complex<double>* B = (complex<double>*)malloc(sizeof(complex<double>) * Nl * nLambda);
462   - computeBArray(B, Nl, nLambda);
463   -
464   -
465   -
466   - //allocate temporary space for the spectrum
467   - double* I = (double*)malloc(sizeof(double) * EtaK.size());
468   -
469   - //compute the spectrum on the GPU
470   - PD.StartTimer(SIMULATE_GPU);
471   - cudaComputeSpectrum(I, (double*)B, alpha, Nl, nLambda, oAngleI, oAngleO, cAngleI, cAngleO, numSamples);
472   - PD.EndTimer(SIMULATE_GPU);
473   -
474   - updateSpectrum(I, I0, nLambda);
475   -
476   - PD.EndTimer(SIMULATE_SPECTRUM);
477   -
478   -}
479   -
480   -void SimulateSpectrum()
481   -{
482   - if(pointDetector)
483   - pointSpectrum();
484   - else
485   - gpuDetectorSpectrum(objectiveSamples);
486   - //detectorSpectrum(objectiveSamples);
487   -}
488   -
489   -double absorbanceDistortion(){
490   -
491   - //compute the mean of the spectrum
492   - double sumSim = 0.0;
493   - for(unsigned int i=0; i<SimSpectrum.size(); i++)
494   - {
495   - sumSim += SimSpectrum[i].A;
496   - }
497   - double meanSim = sumSim/SimSpectrum.size();
498   -
499   - //compute the distortion (MSE from the mean)
500   - double sumSE = 0.0;
501   - for(unsigned int i=0; i<SimSpectrum.size(); i++)
502   - {
503   - sumSE += pow(SimSpectrum[i].A - meanSim, 2);
504   - }
505   - double MSE = sumSE / SimSpectrum.size();
506   -
507   - return MSE;
508   -}
509   -
510   -double intensityDistortion(){
511   -
512   - //compute the mean intensity of the spectrum
513   - double sumSim = 0.0;
514   - for(unsigned int i=0; i<SimSpectrum.size(); i++)
515   - {
516   - sumSim += pow(SimSpectrum[i].A, 2);
517   - }
518   - double magSim = sqrt(sumSim);
519   -
520   - //compute the distortion (MSE from the mean)
521   - double proj = 0.0;
522   - for(unsigned int i=0; i<SimSpectrum.size(); i++)
523   - {
524   - proj += (SimSpectrum[i].A/magSim) * (1.0/SimSpectrum.size());
525   - }
526   - double error = proj;
527   -
528   - return error;
529   -}
530   -
531   -void DistortionMap(float* distortionMap, int nSteps){
532   - ofstream outFile("distortion.txt");
533   -
534   - //set the parameters for the distortion simulation
535   - double range = 0.4;
536   - double step = (range)/(nSteps-1);
537   -
538   - oNAi = 0.2;
539   - oNAo = 0.5;
540   -
541   - double startNAi = 0.0;
542   - double startNAo = 0.3;
543   -
544   - //compute the optical parameters
545   - //compute Nl (maximum order of the spectrum)
546   - int Nl = computeNl();
547   -
548   - double* alpha = (double*)malloc(sizeof(double)*(Nl + 1));
549   - double cAngleI, cAngleO, oAngleI, oAngleO, I0;
550   -
551   - //allocate space for a list of wavelengths
552   - int nLambda = EtaK.size();
553   -
554   - //allocate temporary space for the spectrum
555   - double* I = (double*)malloc(sizeof(double) * EtaK.size());
556   -
557   - //calculate the material parameters
558   - //allocate space for the 2D array (Nl x nu) of scattering coefficients
559   - complex<double>* B = (complex<double>*)malloc(sizeof(complex<double>) * Nl * nLambda);
560   - computeBArray(B, Nl, nLambda);
561   -
562   - QProgressDialog progress("Computing distortion map...", "Stop", 0, nSteps * nSteps);
563   - progress.setWindowModality(Qt::WindowModal);
564   -
565   - double D;
566   - double e = 0.001;
567   - int i, o;
568   - for(i=0; i<nSteps; i++)
569   - {
570   - for(o=0; o<nSteps; o++)
571   - {
572   - //update the progress bar and check for an exit
573   - progress.setValue(i * nSteps + o);
574   - if (progress.wasCanceled())
575   - break;
576   -
577   - //set the current optical parameters
578   - cNAi = startNAi + i * step;
579   - cNAo = startNAo + o * step;
580   - //cout<<cNAi<<" "<<cNAo<<endl;
581   -
582   - //set the current optical parameters
583   - //cNAi = i;
584   - //cNAo = o;
585   -
586   - //compute the optical parameters
587   - computeOpticalParameters(cAngleI, cAngleO, oAngleI, oAngleO, I0, alpha, Nl);
588   -
589   - //simulate the spectrum
590   - cudaComputeSpectrum(I, (double*)B, alpha, Nl, nLambda, oAngleI, oAngleO, cAngleI, cAngleO, objectiveSamples);
591   - updateSpectrum(I, I0, nLambda);
592   -
593   - if(dispSimType == AbsorbanceSpecType)
594   - {
595   - if(cNAi >= cNAo || cNAi >= oNAo || oNAi >= cNAo || oNAi >= oNAo)
596   - D = -1.0;
597   - else
598   - D = absorbanceDistortion();
599   - }
600   - else
601   - {
602   - if(cNAi >= cNAo || oNAi >= oNAo)
603   - D = -1.0;
604   - else
605   - D = intensityDistortion();
606   - }
607   - distortionMap[o * nSteps + i] = D;
608   - outFile<<D<<" ";
609   - }
610   - outFile<<endl;
611   - //cout<<i<<endl;
612   - }
613   -
614   - progress.setValue(nSteps * nSteps);
615   -
616   - outFile.close();
617   -}
  1 +#include <math.h>
  2 +#include <complex>
  3 +#include <iostream>
  4 +#include <fstream>
  5 +#include "globals.h"
  6 +#include <QProgressDialog>
  7 +#include <stdlib.h>
  8 +//#include "cufft.h"
  9 +using namespace std;
  10 +
  11 +#define pi 3.14159
  12 +
  13 +typedef complex<double> scComplex;
  14 +
  15 +extern int cbessjyva(double v,complex<double> z,double &vm,complex<double>*cjv,
  16 + complex<double>*cyv,complex<double>*cjvp,complex<double>*cyvp);
  17 +extern int bessjyv(double v,double x,double &vm,double *jv,double *yv,
  18 + double *djv,double *dyv);
  19 +
  20 +complex<double> Jl_neg(complex<double> x)
  21 +{
  22 + //this function computes the bessel function of the first kind Jl(x) for l = -0.5
  23 + return ( sqrt(2.0/pi) * cos(x) )/sqrt(x);
  24 +}
  25 +
  26 +double Jl_neg(double x)
  27 +{
  28 + //this function computes the bessel function of the first kind Jl(x) for l = -0.5
  29 + return ( sqrt(2.0/pi) * cos(x) )/sqrt(x);
  30 +}
  31 +
  32 +double Yl_neg(double x)
  33 +{
  34 + //this function computes the bessel function of the second kind Yl(x) for l = -0.5;
  35 + return ( sqrt(2.0/pi) * sin(x) )/sqrt(x);
  36 +}
  37 +
  38 +void computeB(complex<double>* B, double radius, complex<double> refIndex, double lambda, int Nl)
  39 +{
  40 + double k = (2*pi)/lambda;
  41 + int b = 2;
  42 +
  43 + //allocate space for the real bessel functions
  44 + double* jv = (double*)malloc(sizeof(double)*(Nl+b));
  45 + double* yv = (double*)malloc(sizeof(double)*(Nl+b));
  46 + double* jvp = (double*)malloc(sizeof(double)*(Nl+b));
  47 + double* yvp = (double*)malloc(sizeof(double)*(Nl+b));
  48 +
  49 + //allocate space for the complex bessel functions
  50 + complex<double>* cjv = (complex<double>*)malloc(sizeof(complex<double>)*(Nl+b));
  51 + complex<double>* cyv = (complex<double>*)malloc(sizeof(complex<double>)*(Nl+b));
  52 + complex<double>* cjvp = (complex<double>*)malloc(sizeof(complex<double>)*(Nl+b));
  53 + complex<double>* cyvp = (complex<double>*)malloc(sizeof(complex<double>)*(Nl+b));
  54 +
  55 + double kr = k*radius;
  56 + complex<double> knr = k*refIndex*(double)radius;
  57 + complex<double> n = refIndex;
  58 +
  59 + //compute the bessel functions for k*r
  60 + double vm;// = Nl - 1;
  61 + bessjyv((Nl)+0.5, kr, vm, jv, yv, jvp, yvp);
  62 + //cout<<"Nl: "<<Nl<<" vm: "<<vm<<endl;
  63 + //printf("Nl: %f, vm: %f\n", (float)Nl, (float)vm);
  64 +
  65 + //compute the bessel functions for k*n*r
  66 + cbessjyva((Nl)+0.5, knr, vm, cjv, cyv, cjvp, cyvp);
  67 +
  68 + //scale factor for spherical bessel functions
  69 + double scale_kr = sqrt(pi/(2.0*kr));
  70 + complex<double> scale_knr = sqrt(pi/(2.0*knr));
  71 +
  72 + complex<double> numer, denom;
  73 + double j_kr;
  74 + double y_kr;
  75 + complex<double> j_knr;
  76 + complex<double> j_d_knr;
  77 + double j_d_kr;
  78 + complex<double> h_kr;
  79 + complex<double> h_d_kr;
  80 + complex<double> h_neg;
  81 + complex<double> h_pos;
  82 +
  83 + //cout<<"B coefficients:"<<endl;
  84 + for(int l=0; l<Nl; l++)
  85 + {
  86 + //compute the spherical bessel functions
  87 + j_kr = jv[l] * scale_kr;
  88 + y_kr = yv[l] * scale_kr;
  89 + j_knr = cjv[l] * scale_knr;
  90 +
  91 + //compute the Hankel function
  92 + h_kr = complex<double>(j_kr, y_kr);
  93 +
  94 + //compute the derivatives
  95 + if(l == 0)
  96 + {
  97 + //spherical bessel functions for l=0
  98 + j_d_kr = scale_kr * (Jl_neg(kr) - (jv[l] + kr*jv[l+1])/kr )/2.0;
  99 + j_d_knr = scale_knr * ( Jl_neg(knr) - (cjv[l] + knr*cjv[l+1])/knr )/2.0;
  100 + h_neg = complex<double>(scale_kr*Jl_neg(kr), scale_kr*Yl_neg(kr));
  101 + h_pos = complex<double>(scale_kr*jv[l+1], scale_kr*yv[l+1]);
  102 + h_d_kr = (h_neg - (h_kr + kr*h_pos)/kr)/2.0;
  103 + }
  104 + else
  105 + {
  106 + //spherical bessel functions
  107 + j_d_kr = scale_kr * (jv[l-1] - (jv[l] + kr*jv[l+1])/kr )/2.0;
  108 + j_d_knr = scale_knr * ( cjv[l-1] - (cjv[l] + knr*cjv[l+1])/knr )/2.0;
  109 + h_neg = complex<double>(scale_kr*jv[l-1], scale_kr*yv[l-1]);
  110 + h_pos = complex<double>(scale_kr*jv[l+1], scale_kr*yv[l+1]);
  111 + h_d_kr = (h_neg - (h_kr + kr*h_pos)/kr)/2.0;
  112 + }
  113 +
  114 + numer = j_kr*j_d_knr*n - j_knr*j_d_kr;
  115 + denom = j_knr*h_d_kr - h_kr*j_d_knr*n;
  116 + B[l] = numer/denom;
  117 +
  118 + //B[l] = scComplex(temp.real(), temp.imag());
  119 + //cout<<B[l]<<endl;
  120 + }
  121 +
  122 + free(jv);
  123 + free(yv);
  124 + free(jvp);
  125 + free(yvp);
  126 + free(cjv);
  127 + free(cyv);
  128 + free(cjvp);
  129 + free(cyvp);
  130 +}
  131 +
  132 +void Legendre(double* P, double x, int Nl)
  133 +{
  134 + //computes the legendre polynomials from orders 0 to Nl-1
  135 + P[0] = 1;
  136 + if(Nl == 1) return;
  137 + P[1] = x;
  138 + for(int l = 2; l < Nl; l++)
  139 + {
  140 + P[l] = ((2*l - 1)*x*P[l-1] - (l - 1)*P[l-2])/l;
  141 + }
  142 +
  143 +}
  144 +
  145 +complex<double> integrateUi(double cAngleI, double cAngleO, double oAngleI, double oAngleO, double M = 2*pi)
  146 +{
  147 + /*This function integrates the incident field of magnitude M in the far zone
  148 + in order to evaluate the field at the central pixel of a detector.
  149 + cNAi = condenser inner angle
  150 + cNAo = condenser outer angle
  151 + oNAi = objective inner angle
  152 + oNAo = objective outer angle
  153 + M = field magnitude*/
  154 +
  155 + double alphaIn = max(cAngleI, oAngleI);
  156 + double alphaOut = min(cAngleO,oAngleO);
  157 +
  158 + complex<double> Ui;
  159 + if(alphaIn > alphaOut)
  160 + Ui = complex<double>(0.0, 0.0);
  161 + else
  162 + Ui = complex<double>(M * 2 * pi * (cos(alphaIn) - cos(alphaOut)), 0.0f);
  163 +
  164 + return Ui;
  165 +
  166 +}
  167 +
  168 +void computeCondenserAlpha(double* alpha, int Nl, double cAngleI, double cAngleO)
  169 +{
  170 + /*This function computes the condenser integral in order to build the field of incident light
  171 + alpha = list of Nl floating point values representing the condenser alpha as a function of l
  172 + Nl = number of orders in the incident field
  173 + cAngleI, cAngleO = inner and outer condenser angles (inner and outer NA)*/
  174 +
  175 + //compute the Legendre polynomials for the condenser aperature
  176 + double* PcNAo = (double*)malloc(sizeof(double)*(Nl+1));
  177 + Legendre(PcNAo, cos(cAngleO), Nl+1);
  178 + double* PcNAi = (double*)malloc(sizeof(double)*(Nl+1));
  179 + Legendre(PcNAi, cos(cAngleI), Nl+1);
  180 +
  181 + for(int l=0; l<Nl; l++)
  182 + {
  183 + //integration term
  184 + if(l == 0)
  185 + alpha[l] = -PcNAo[l+1] + PcNAo[0] + PcNAi[l+1] - PcNAi[0];
  186 + else
  187 + alpha[l] = -PcNAo[l+1] + PcNAo[l-1] + PcNAi[l+1] - PcNAi[l-1];
  188 +
  189 + alpha[l] *= 2 * pi;
  190 + }
  191 +
  192 +}
  193 +
  194 +complex<double> integrateUs(double r, double lambda, complex<double> eta,
  195 + double cAngleI, double cAngleO, double oAngleI, double oAngleO, double M = 2*pi)
  196 +{
  197 + /*This function integrates the incident field of magnitude M in the far zone
  198 + in order to evaluate the field at the central pixel of a detector.
  199 + r = sphere radius
  200 + lambda = wavelength
  201 + eta = index of refraction
  202 + cNAi = condenser inner NA
  203 + cNAo = condenser outer NA
  204 + oNAi = objective inner NA
  205 + oNAo = objective outer NA
  206 + M = field magnitude*/
  207 +
  208 + //compute the required number of orders
  209 + double k = 2*pi/lambda;
  210 + int Nl = (int)ceil( k + 4 * exp(log(k*r)/3) + 3 );
  211 +
  212 + //compute the material coefficients B
  213 + complex<double>* B = (complex<double>*)malloc(sizeof(complex<double>)*Nl);
  214 + //compute the Legendre polynomials for the condenser and objective aperatures
  215 + double* PcNAo = (double*)malloc(sizeof(double)*(Nl+1));
  216 + Legendre(PcNAo, cos(cAngleO), Nl+1);
  217 + double* PcNAi = (double*)malloc(sizeof(double)*(Nl+1));
  218 + Legendre(PcNAi, cos(cAngleI), Nl+1);
  219 +
  220 + double* PoNAo = (double*)malloc(sizeof(double)*(Nl+1));
  221 + Legendre(PoNAo, cos(oAngleO), Nl+1);
  222 + double* PoNAi = (double*)malloc(sizeof(double)*(Nl+1));
  223 + Legendre(PoNAi, cos(oAngleI), Nl+1);
  224 +
  225 + //store the index of refraction;
  226 + complex<double> IR(eta.real(), eta.imag());
  227 +
  228 + //compute the scattering coefficients
  229 + computeB(B, r, IR, lambda, Nl);
  230 +
  231 + //aperature terms for the condenser (alpha) and objective (beta)
  232 + double alpha;
  233 + double beta;
  234 + double c;
  235 + complex<double> Us(0.0, 0.0);
  236 +
  237 + for(int l=0; l<Nl; l++)
  238 + {
  239 + //integration term
  240 + if(l == 0)
  241 + {
  242 + alpha = -PcNAo[l+1] + PcNAo[0] + PcNAi[l+1] - PcNAi[0];
  243 + beta = -PoNAo[l+1] + PoNAo[0] + PoNAi[l+1] - PoNAi[0];
  244 + }
  245 + else
  246 + {
  247 + alpha = -PcNAo[l+1] + PcNAo[l-1] + PcNAi[l+1] - PcNAi[l-1];
  248 + beta = -PoNAo[l+1] + PoNAo[l-1] + PoNAi[l+1] - PoNAi[l-1];
  249 + }
  250 + c = (2*pi)/(2.0 * l + 1.0);
  251 + Us += c * alpha * beta * B[l] * M;
  252 +
  253 +
  254 + }
  255 + free(PcNAo);
  256 + free(PcNAi);
  257 + free(PoNAo);
  258 + free(PoNAi);
  259 + free(B);
  260 +
  261 + return Us;
  262 +
  263 +}
  264 +
  265 +void pointSpectrum()
  266 +{
  267 + PD.StartTimer(SIMULATE_SPECTRUM);
  268 +
  269 + //if there is no material to simulate
  270 + if(EtaK.size() == 0)
  271 + return;
  272 + //clear the previous spectrum
  273 + SimSpectrum.clear();
  274 +
  275 + double dNu = 2.0f;
  276 + double lambda;
  277 +
  278 + //compute the angles based on NA
  279 + double cAngleI = asin(cNAi);
  280 + double cAngleO = asin(cNAo);
  281 + double oAngleI = asin(oNAi);
  282 + double oAngleO = asin(oNAo);
  283 +
  284 + //implement a reflection-mode system if necessary
  285 + if(opticsMode == ReflectionOpticsType) {
  286 +
  287 + //set the condenser to match the objective
  288 + cAngleI = oAngleI;
  289 + cAngleO = oAngleO;
  290 +
  291 + //invert the objective
  292 + oAngleO = pi - cAngleI;
  293 + oAngleI = pi - cAngleO;
  294 + }
  295 +
  296 + //integrate the incident field at the detector position
  297 + complex<double> Ui = integrateUi(cAngleI, cAngleO, oAngleI, oAngleO, 2*pi);
  298 + double I0 = Ui.real() * Ui.real() + Ui.imag() * Ui.imag();
  299 + I0 *= scaleI0;
  300 +
  301 +
  302 +
  303 + //double I;
  304 + SpecPair temp;
  305 + double nu;
  306 + complex<double> eta;
  307 + complex<double> Us, U;
  308 +
  309 + double vecLen = 0.0;
  310 + for(unsigned int i=0; i<EtaK.size(); i++)
  311 + {
  312 + nu = EtaK[i].nu;
  313 + lambda = 10000.0f/nu;
  314 + if(applyMaterial)
  315 + eta = complex<double>(EtaN[i].A, EtaK[i].A);
  316 + else
  317 + eta = complex<double>(baseIR, 0.0);
  318 +
  319 +
  320 + //integrate the scattered field at the detector position
  321 + Us = integrateUs(radius, lambda, eta, cAngleI, cAngleO, oAngleI, oAngleO, 2*pi);
  322 + U = Us + Ui;
  323 + double I = U.real() * U.real() + U.imag() * U.imag();
  324 +
  325 + temp.nu = nu;
  326 +
  327 + //set the spectrum value based on the current display type
  328 + if(dispSimType == AbsorbanceSpecType)
  329 + temp.A = -log10(I/I0);
  330 + else
  331 + temp.A = I;
  332 +
  333 + if(dispNormalize)
  334 + vecLen += temp.A * temp.A;
  335 +
  336 + SimSpectrum.push_back(temp);
  337 + }
  338 + vecLen = sqrt(vecLen);
  339 +
  340 + if(dispNormalize)
  341 + for(unsigned int i=0; i<SimSpectrum.size(); i++)
  342 + SimSpectrum[i].A = (SimSpectrum[i].A / vecLen) * dispNormFactor;
  343 +
  344 + PD.EndTimer(SIMULATE_SPECTRUM);
  345 +}
  346 +
  347 +void updateSpectrum(double* I, double I0, int n)
  348 +{
  349 + SimSpectrum.clear();
  350 + SpecPair temp;
  351 +
  352 + //update the displayed spectrum based on the computed intensity I
  353 + for(int i=0; i<n; i++)
  354 + {
  355 + temp.nu = EtaK[i].nu;
  356 +
  357 + //set the spectrum value based on the current display type
  358 + if(dispSimType == AbsorbanceSpecType)
  359 + {
  360 + temp.A = -log10(I[i]/I0);
  361 + //cout<<temp.nu<<" "<<I[i]<<endl;
  362 + }
  363 + else
  364 + {
  365 + temp.A = I[i];
  366 + if(useSourceSpectrum)
  367 + temp.A *= SourceResampled[i].A;
  368 + }
  369 +
  370 + SimSpectrum.push_back(temp);
  371 + }
  372 +}
  373 +
  374 +void computeCassegrainAngles(double& cAngleI, double& cAngleO, double& oAngleI, double& oAngleO)
  375 +{
  376 + //compute the angles based on NA
  377 + cAngleI = asin(cNAi);
  378 + cAngleO = asin(cNAo);
  379 + oAngleI = asin(oNAi);
  380 + oAngleO = asin(oNAo);
  381 +
  382 + //implement a reflection-mode system if necessary
  383 + if(opticsMode == ReflectionOpticsType) {
  384 +
  385 + //set the condenser to match the objective
  386 + cAngleI = oAngleI;
  387 + cAngleO = oAngleO;
  388 +
  389 + //invert the objective
  390 + oAngleO = pi - cAngleI;
  391 + oAngleI = pi - cAngleO;
  392 + }
  393 +
  394 +
  395 +}
  396 +
  397 +int computeNl()
  398 +{
  399 + double maxNu = EtaK.back().nu;
  400 + double maxLambda = 10000.0f/maxNu;
  401 + double k = 2*pi/maxLambda;
  402 + int Nl = (int)ceil( k + 4 * exp(log(k*radius)/3) + 3 );
  403 +
  404 + return Nl;
  405 +}
  406 +
  407 +void computeBArray(complex<double>* B, int Nl, int nLambda)
  408 +{
  409 + double nu;
  410 + complex<double> eta;
  411 + double* Lambda = (double*)malloc(sizeof(double) * nLambda);
  412 +
  413 + //for each wavenumber nu
  414 + for(unsigned int i=0; i<EtaK.size(); i++)
  415 + {
  416 + //compute information based on wavelength and material
  417 + nu = EtaK[i].nu;
  418 + Lambda[i] = 10000.0f/nu;
  419 + if(applyMaterial)
  420 + eta = complex<double>(EtaN[i].A, EtaK[i].A);
  421 + else
  422 + eta = complex<double>(baseIR, 0.0);
  423 +
  424 + //allocate memory for the scattering coefficients
  425 + //complex<float>* B = (complex<float>*)malloc(sizeof(complex<float>)*Nl);
  426 +
  427 + complex<double> IR(eta.real(), eta.imag());
  428 + computeB(&B[i * Nl], radius, IR, Lambda[i], Nl);
  429 + }
  430 +}
  431 +
  432 +void computeOpticalParameters(double& cAngleI, double& cAngleO, double& oAngleI, double& oAngleO, double& I0, double* alpha, int Nl)
  433 +{
  434 + computeCassegrainAngles(cAngleI, cAngleO, oAngleI, oAngleO);
  435 +
  436 + //evaluate the incident field intensity
  437 + I0 = 0.0;
  438 + complex<double> Ui;
  439 +
  440 + Ui = integrateUi(cAngleI, cAngleO, oAngleI, oAngleO, 2*pi);
  441 + I0 = Ui.real()*2*pi;
  442 +
  443 + //compute alpha (condenser integral)
  444 + computeCondenserAlpha(alpha, Nl, cAngleI, cAngleO);
  445 +}
  446 +
  447 +void gpuDetectorSpectrum(int numSamples)
  448 +{
  449 + //allocate space for a list of wavelengths
  450 + int nLambda = EtaK.size();
  451 + if(nLambda == 0)
  452 + return;
  453 +
  454 + //integrate across the objective aperature and calculate the resulting intensity on a detector
  455 + PD.StartTimer(SIMULATE_SPECTRUM);
  456 + //clear the previous spectrum
  457 + SimSpectrum.clear();
  458 +
  459 + //compute Nl (maximum order of the spectrum)
  460 + int Nl = computeNl();
  461 +
  462 +
  463 + double* alpha = (double*)malloc(sizeof(double)*(Nl + 1));
  464 + double cAngleI, cAngleO, oAngleI, oAngleO, I0;
  465 + computeOpticalParameters(cAngleI, cAngleO, oAngleI, oAngleO, I0, alpha, Nl);
  466 +
  467 +
  468 +
  469 +
  470 +
  471 + //allocate space for the 2D array (Nl x nu) of scattering coefficients
  472 + complex<double>* B = (complex<double>*)malloc(sizeof(complex<double>) * Nl * nLambda);
  473 + computeBArray(B, Nl, nLambda);
  474 +
  475 +
  476 +
  477 + //allocate temporary space for the spectrum
  478 + double* I = (double*)malloc(sizeof(double) * EtaK.size());
  479 +
  480 + //compute the spectrum on the GPU
  481 + PD.StartTimer(SIMULATE_GPU);
  482 + cudaComputeSpectrum(I, (double*)B, alpha, Nl, nLambda, oAngleI, oAngleO, cAngleI, cAngleO, numSamples);
  483 + PD.EndTimer(SIMULATE_GPU);
  484 +
  485 + updateSpectrum(I, I0, nLambda);
  486 +
  487 + PD.EndTimer(SIMULATE_SPECTRUM);
  488 +
  489 +}
  490 +
  491 +void SimulateSpectrum()
  492 +{
  493 + if(pointDetector)
  494 + pointSpectrum();
  495 + else
  496 + gpuDetectorSpectrum(objectiveSamples);
  497 +
  498 +}
  499 +
  500 +double absorbanceDistortion() {
  501 +
  502 + //compute the mean of the spectrum
  503 + double sumSim = 0.0;
  504 + for(unsigned int i=0; i<SimSpectrum.size(); i++)
  505 + {
  506 + sumSim += SimSpectrum[i].A;
  507 + }
  508 + double meanSim = sumSim/SimSpectrum.size();
  509 +
  510 + //compute the distortion (MSE from the mean)
  511 + double sumSE = 0.0;
  512 + for(unsigned int i=0; i<SimSpectrum.size(); i++)
  513 + {
  514 + sumSE += pow(SimSpectrum[i].A - meanSim, 2);
  515 + }
  516 + double MSE = sumSE / SimSpectrum.size();
  517 +
  518 + return MSE;
  519 +}
  520 +
  521 +double intensityDistortion() {
  522 +
  523 + //compute the mean intensity of the spectrum
  524 + double sumSim = 0.0;
  525 + for(unsigned int i=0; i<SimSpectrum.size(); i++)
  526 + {
  527 + sumSim += pow(SimSpectrum[i].A, 2);
  528 + }
  529 + double magSim = sqrt(sumSim);
  530 +
  531 + //compute the distortion (MSE from the mean)
  532 + double proj = 0.0;
  533 + for(unsigned int i=0; i<SimSpectrum.size(); i++)
  534 + {
  535 + proj += (SimSpectrum[i].A/magSim) * (1.0/SimSpectrum.size());
  536 + }
  537 + double error = proj;
  538 +
  539 + return error;
  540 +}
  541 +
  542 +void DistortionMap(float* distortionMap, int nSteps) {
  543 + ofstream outFile("distortion.txt");
  544 +
  545 + //set the parameters for the distortion simulation
  546 + double range = 0.4;
  547 + double step = (range)/(nSteps-1);
  548 +
  549 + oNAi = 0.2;
  550 + oNAo = 0.5;
  551 +
  552 + double startNAi = 0.0;
  553 + double startNAo = 0.3;
  554 +
  555 + //compute the optical parameters
  556 + //compute Nl (maximum order of the spectrum)
  557 + int Nl = computeNl();
  558 +
  559 + double* alpha = (double*)malloc(sizeof(double)*(Nl + 1));
  560 + double cAngleI, cAngleO, oAngleI, oAngleO, I0;
  561 +
  562 + //allocate space for a list of wavelengths
  563 + int nLambda = EtaK.size();
  564 +
  565 + //allocate temporary space for the spectrum
  566 + double* I = (double*)malloc(sizeof(double) * EtaK.size());
  567 +
  568 + //calculate the material parameters
  569 + //allocate space for the 2D array (Nl x nu) of scattering coefficients
  570 + complex<double>* B = (complex<double>*)malloc(sizeof(complex<double>) * Nl * nLambda);
  571 + computeBArray(B, Nl, nLambda);
  572 +
  573 + QProgressDialog progress("Computing distortion map...", "Stop", 0, nSteps * nSteps);
  574 + progress.setWindowModality(Qt::WindowModal);
  575 +
  576 + double D;
  577 + double e = 0.001;
  578 + int i, o;
  579 + for(i=0; i<nSteps; i++)
  580 + {
  581 + for(o=0; o<nSteps; o++)
  582 + {
  583 + //update the progress bar and check for an exit
  584 + progress.setValue(i * nSteps + o);
  585 + if (progress.wasCanceled())
  586 + break;
  587 +
  588 + //set the current optical parameters
  589 + cNAi = startNAi + i * step;
  590 + cNAo = startNAo + o * step;
  591 + //cout<<cNAi<<" "<<cNAo<<endl;
  592 +
  593 + //set the current optical parameters
  594 + //cNAi = i;
  595 + //cNAo = o;
  596 +
  597 + //compute the optical parameters
  598 + computeOpticalParameters(cAngleI, cAngleO, oAngleI, oAngleO, I0, alpha, Nl);
  599 +
  600 + //simulate the spectrum
  601 + cudaComputeSpectrum(I, (double*)B, alpha, Nl, nLambda, oAngleI, oAngleO, cAngleI, cAngleO, objectiveSamples);
  602 + updateSpectrum(I, I0, nLambda);
  603 +
  604 + if(dispSimType == AbsorbanceSpecType)
  605 + {
  606 + if(cNAi >= cNAo || cNAi >= oNAo || oNAi >= cNAo || oNAi >= oNAo)
  607 + D = -1.0;
  608 + else
  609 + D = absorbanceDistortion();
  610 + }
  611 + else
  612 + {
  613 + if(cNAi >= cNAo || oNAi >= oNAo)
  614 + D = -1.0;
  615 + else
  616 + D = intensityDistortion();
  617 + }
  618 + distortionMap[o * nSteps + i] = D;
  619 + outFile<<D<<" ";
  620 + }
  621 + outFile<<endl;
  622 + //cout<<i<<endl;
  623 + }
  624 +
  625 + progress.setValue(nSteps * nSteps);
  626 +
  627 + outFile.close();
  628 +}
... ...
bessel.h
1   -#ifndef bessH
2   -#define bessH
3   -#define _USE_MATH_DEFINES
4   -#include <math.h>
5   -#include <complex>
6   -using namespace std;
7   -#define eps 1e-15
8   -#define el 0.5772156649015329
9   -
10   -int msta1(double x,int mp);
11   -int msta2(double x,int n,int mp);
12   -int bessjy01a(double x,double &j0,double &j1,double &y0,double &y1,
13   - double &j0p,double &j1p,double &y0p,double &y1p);
14   -int bessjy01b(double x,double &j0,double &j1,double &y0,double &y1,
15   - double &j0p,double &j1p,double &y0p,double &y1p);
16   -int bessjyna(int n,double x,int &nm,double *jn,double *yn,
17   - double *jnp,double *ynp);
18   -int bessjynb(int n,double x,int &nm,double *jn,double *yn,
19   - double *jnp,double *ynp);
20   -int bessjyv(double v,double x,double &vm,double *jv,double *yv,
21   - double *jvp,double *yvp);
22   -int bessik01a(double x,double &i0,double &i1,double &k0,double &k1,
23   - double &i0p,double &i1p,double &k0p,double &k1p);
24   -int bessik01b(double x,double &i0,double &i1,double &k0,double &k1,
25   - double &i0p,double &i1p,double &k0p,double &k1p);
26   -int bessikna(int n,double x,int &nm,double *in,double *kn,
27   - double *inp,double *knp);
28   -int bessiknb(int n,double x,int &nm,double *in,double *kn,
29   - double *inp,double *knp);
30   -int bessikv(double v,double x,double &vm,double *iv,double *kv,
31   - double *ivp,double *kvp);
32   -int cbessjy01(complex<double> z,complex<double> &cj0,complex<double> &cj1,
33   - complex<double> &cy0,complex<double> &cy1,complex<double> &cj0p,
34   - complex<double> &cj1p,complex<double> &cy0p,complex<double> &cy1p);
35   -int cbessjyna(int n,complex<double> z,int &nm,complex<double> *cj,
36   - complex<double> *cy,complex<double> *cjp,complex<double> *cyp);
37   -int cbessjynb(int n,complex<double> z,int &nm,complex<double> *cj,
38   - complex<double> *cy,complex<double> *cjp,complex<double> *cyp);
39   -int cbessik01(complex<double>z,complex<double>&ci0,complex<double>&ci1,
40   - complex<double>&ck0,complex<double>&ck1,complex<double>&ci0p,
41   - complex<double>&ci1p,complex<double>&ck0p,complex<double>&ck1p);
42   -int cbessikna(int n,complex<double> z,int &nm,complex<double> *ci,
43   - complex<double> *ck,complex<double> *cip,complex<double> *ckp);
44   -int cbessiknb(int n,complex<double> z,int &nm,complex<double> *ci,
45   - complex<double> *ck,complex<double> *cip,complex<double> *ckp);
46   -int cbessjyva(double v,complex<double> z,double &vm,complex<double>*cjv,
47   - complex<double>*cyv,complex<double>*cjvp,complex<double>*cyvp);
48   -int cbessikv(double v,complex<double>z,double &vm,complex<double> *civ,
49   - complex<double> *ckv,complex<double> *civp,complex<double> *ckvp);
50   -
51   -#endif
  1 +#ifndef bessH
  2 +#define bessH
  3 +#define _USE_MATH_DEFINES
  4 +#include <math.h>
  5 +#include <complex>
  6 +using namespace std;
  7 +#define eps 1e-15
  8 +#define el 0.5772156649015329
  9 +
  10 +int msta1(double x,int mp);
  11 +int msta2(double x,int n,int mp);
  12 +int bessjy01a(double x,double &j0,double &j1,double &y0,double &y1,
  13 + double &j0p,double &j1p,double &y0p,double &y1p);
  14 +int bessjy01b(double x,double &j0,double &j1,double &y0,double &y1,
  15 + double &j0p,double &j1p,double &y0p,double &y1p);
  16 +int bessjyna(int n,double x,int &nm,double *jn,double *yn,
  17 + double *jnp,double *ynp);
  18 +int bessjynb(int n,double x,int &nm,double *jn,double *yn,
  19 + double *jnp,double *ynp);
  20 +int bessjyv(double v,double x,double &vm,double *jv,double *yv,
  21 + double *jvp,double *yvp);
  22 +int bessik01a(double x,double &i0,double &i1,double &k0,double &k1,
  23 + double &i0p,double &i1p,double &k0p,double &k1p);
  24 +int bessik01b(double x,double &i0,double &i1,double &k0,double &k1,
  25 + double &i0p,double &i1p,double &k0p,double &k1p);
  26 +int bessikna(int n,double x,int &nm,double *in,double *kn,
  27 + double *inp,double *knp);
  28 +int bessiknb(int n,double x,int &nm,double *in,double *kn,
  29 + double *inp,double *knp);
  30 +int bessikv(double v,double x,double &vm,double *iv,double *kv,
  31 + double *ivp,double *kvp);
  32 +int cbessjy01(complex<double> z,complex<double> &cj0,complex<double> &cj1,
  33 + complex<double> &cy0,complex<double> &cy1,complex<double> &cj0p,
  34 + complex<double> &cj1p,complex<double> &cy0p,complex<double> &cy1p);
  35 +int cbessjyna(int n,complex<double> z,int &nm,complex<double> *cj,
  36 + complex<double> *cy,complex<double> *cjp,complex<double> *cyp);
  37 +int cbessjynb(int n,complex<double> z,int &nm,complex<double> *cj,
  38 + complex<double> *cy,complex<double> *cjp,complex<double> *cyp);
  39 +int cbessik01(complex<double>z,complex<double>&ci0,complex<double>&ci1,
  40 + complex<double>&ck0,complex<double>&ck1,complex<double>&ci0p,
  41 + complex<double>&ci1p,complex<double>&ck0p,complex<double>&ck1p);
  42 +int cbessikna(int n,complex<double> z,int &nm,complex<double> *ci,
  43 + complex<double> *ck,complex<double> *cip,complex<double> *ckp);
  44 +int cbessiknb(int n,complex<double> z,int &nm,complex<double> *ci,
  45 + complex<double> *ck,complex<double> *cip,complex<double> *ckp);
  46 +int cbessjyva(double v,complex<double> z,double &vm,complex<double>*cjv,
  47 + complex<double>*cyv,complex<double>*cjvp,complex<double>*cyvp);
  48 +int cbessikv(double v,complex<double>z,double &vm,complex<double> *civ,
  49 + complex<double> *ckv,complex<double> *civp,complex<double> *ckvp);
  50 +
  51 +#endif
... ...
bessik.CPP
1   -// bessik.cpp -- computation of modified Bessel functions In, Kn
2   -// and their derivatives. Algorithms and coefficient values from
3   -// "Computation of Special Functions", Zhang and Jin, John
4   -// Wiley and Sons, 1996.
5   -//
6   -// (C) 2003, C. Bond. All rights reserved.
7   -//
8   -#define _USE_MATH_DEFINES
9   -#include <math.h>
10   -#include "bessel.h"
11   -
12   -double gamma(double x);
13   -
14   -int bessik01a(double x,double &i0,double &i1,double &k0,double &k1,
15   - double &i0p,double &i1p,double &k0p,double &k1p)
16   -{
17   - double r,x2,ca,cb,ct,ww,w0,xr,xr2;
18   - int k,kz;
19   - static double a[] = {
20   - 0.125,
21   - 7.03125e-2,
22   - 7.32421875e-2,
23   - 1.1215209960938e-1,
24   - 2.2710800170898e-1,
25   - 5.7250142097473e-1,
26   - 1.7277275025845,
27   - 6.0740420012735,
28   - 2.4380529699556e1,
29   - 1.1001714026925e2,
30   - 5.5133589612202e2,
31   - 3.0380905109224e3};
32   - static double b[] = {
33   - -0.375,
34   - -1.171875e-1,
35   - -1.025390625e-1,
36   - -1.4419555664063e-1,
37   - -2.7757644653320e-1,
38   - -6.7659258842468e-1,
39   - -1.9935317337513,
40   - -6.8839142681099,
41   - -2.7248827311269e1,
42   - -1.2159789187654e2,
43   - -6.0384407670507e2,
44   - -3.3022722944809e3};
45   - static double a1[] = {
46   - 0.125,
47   - 0.2109375,
48   - 1.0986328125,
49   - 1.1775970458984e1,
50   - 2.1461706161499e2,
51   - 5.9511522710323e3,
52   - 2.3347645606175e5,
53   - 1.2312234987631e7};
54   -
55   - if (x < 0.0) return 1;
56   - if (x == 0.0) {
57   - i0 = 1.0;
58   - i1 = 0.0;
59   - k0 = 1e308;
60   - k1 = 1e308;
61   - i0p = 0.0;
62   - i1p = 0.5;
63   - k0p = -1e308;
64   - k1p = -1e308;
65   - return 0;
66   - }
67   - x2 = x*x;
68   - if (x <= 18.0) {
69   - i0 = 1.0;
70   - r = 1.0;
71   - for (k=1;k<=50;k++) {
72   - r *= 0.25*x2/(k*k);
73   - i0 += r;
74   - if (fabs(r/i0) < eps) break;
75   - }
76   - i1 = 1.0;
77   - r = 1.0;
78   - for (k=1;k<=50;k++) {
79   - r *= 0.25*x2/(k*(k+1));
80   - i1 += r;
81   - if (fabs(r/i1) < eps) break;
82   - }
83   - i1 *= 0.5*x;
84   - }
85   - else {
86   - if (x >= 50.0) kz = 7;
87   - else if (x >= 35.0) kz = 9;
88   - else kz = 12;
89   - ca = exp(x)/sqrt(2.0*M_PI*x);
90   - i0 = 1.0;
91   - xr = 1.0/x;
92   - for (k=0;k<kz;k++) {
93   - i0 += a[k]*pow(xr,k+1);
94   - }
95   - i0 *= ca;
96   - i1 = 1.0;
97   - for (k=0;k<kz;k++) {
98   - i1 += b[k]*pow(xr,k+1);
99   - }
100   - i1 *= ca;
101   - }
102   - if (x <= 9.0) {
103   - ct = -(log(0.5*x)+el);
104   - k0 = 0.0;
105   - w0 = 0.0;
106   - r = 1.0;
107   - ww = 0.0;
108   - for (k=1;k<=50;k++) {
109   - w0 += 1.0/k;
110   - r *= 0.25*x2/(k*k);
111   - k0 += r*(w0+ct);
112   - if (fabs((k0-ww)/k0) < eps) break;
113   - ww = k0;
114   - }
115   - k0 += ct;
116   - }
117   - else {
118   - cb = 0.5/x;
119   - xr2 = 1.0/x2;
120   - k0 = 1.0;
121   - for (k=0;k<8;k++) {
122   - k0 += a1[k]*pow(xr2,k+1);
123   - }
124   - k0 *= cb/i0;
125   - }
126   - k1 = (1.0/x - i1*k0)/i0;
127   - i0p = i1;
128   - i1p = i0-i1/x;
129   - k0p = -k1;
130   - k1p = -k0-k1/x;
131   - return 0;
132   -}
133   -
134   -int bessik01b(double x,double &i0,double &i1,double &k0,double &k1,
135   - double &i0p,double &i1p,double &k0p,double &k1p)
136   -{
137   - double t,t2,dtmp,dtmp1;
138   -
139   - if (x < 0.0) return 1;
140   - if (x == 0.0) {
141   - i0 = 1.0;
142   - i1 = 0.0;
143   - k0 = 1e308;
144   - k1 = 1e308;
145   - i0p = 0.0;
146   - i1p = 0.5;
147   - k0p = -1e308;
148   - k1p = -1e308;
149   - return 0;
150   - }
151   - if (x < 3.75) {
152   - t = x/3.75;
153   - t2 = t*t;
154   - i0 = (((((0.0045813*t2+0.0360768)*t2+0.2659732)*t2+
155   - 1.2067492)*t2+3.0899424)*t2+3.5156229)*t2+1.0;
156   - i1 = x*(((((0.00032411*t2+0.00301532)*t2+0.02658733*t2+
157   - 0.15084934)*t2+0.51498869)*t2+0.87890594)*t2+0.5);
158   - }
159   - else {
160   - t = 3.75/x;
161   - dtmp1 = exp(x)/sqrt(x);
162   - dtmp = (((((((0.00392377*t-0.01647633)*t+0.026355537)*t-0.02057706)*t+
163   - 0.00916281)*t-0.00157565)*t+0.00225319)*t+0.01328592)*t+0.39894228;
164   - i0 = dtmp*dtmp1;
165   - dtmp = (((((((-0.00420059*t+0.01787654)*t-0.02895312)*t+0.02282967)*t-
166   - 0.01031555)*t+0.00163801)*t-0.00362018)*t-0.03988024)*t+0.39894228;
167   - i1 = dtmp*dtmp1;
168   - }
169   - if (x < 2.0) {
170   - t = 0.5*x;
171   - t2 = t*t; // already calculated above
172   - dtmp = (((((0.0000074*t2+0.0001075)*t2+0.00262698)*t2+0.0348859)*t2+
173   - 0.23069756)*t2+0.4227842)*t2-0.57721566;
174   - k0 = dtmp - i0*log(t);
175   - dtmp = (((((-0.00004686*t2-0.00110404)*t2-0.01919402)*t2-
176   - 0.18156897)*t2-0.67278578)*t2+0.15443144)*t2+1.0;
177   - k1 = dtmp/x + i1*log(t);
178   - }
179   - else {
180   - t = 2.0/x;
181   - dtmp1 = exp(-x)/sqrt(x);
182   - dtmp = (((((0.00053208*t-0.0025154)*t+0.00587872)*t-0.01062446)*t+
183   - 0.02189568)*t-0.07832358)*t+1.25331414;
184   - k0 = dtmp*dtmp1;
185   - dtmp = (((((-0.00068245*t+0.00325614)*t-0.00780353)*t+0.01504268)*t-
186   - 0.0365562)*t+0.23498619)*t+1.25331414;
187   - k1 = dtmp*dtmp1;
188   - }
189   - i0p = i1;
190   - i1p = i0 - i1/x;
191   - k0p = -k1;
192   - k1p = -k0 - k1/x;
193   - return 0;
194   -}
195   -int bessikna(int n,double x,int &nm,double *in,double *kn,
196   - double *inp,double *knp)
197   -{
198   - double bi0,bi1,bk0,bk1,g,g0,g1,f,f0,f1,h,h0,h1,s0;
199   - int k,m,ecode;
200   -
201   - if ((x < 0.0) || (n < 0)) return 1;
202   - if (x < eps) {
203   - for (k=0;k<=n;k++) {
204   - in[k] = 0.0;
205   - kn[k] = 1e308;
206   - inp[k] = 0.0;
207   - knp[k] = -1e308;
208   - }
209   - in[0] = 1.0;
210   - inp[1] = 0.5;
211   - return 0;
212   - }
213   - nm = n;
214   - ecode = bessik01a(x,in[0],in[1],kn[0],kn[1],inp[0],inp[1],knp[0],knp[1]);
215   - if (n < 2) return 0;
216   - bi0 = in[0];
217   - bi1 = in[1];
218   - bk0 = kn[0];
219   - bk1 = kn[1];
220   - if ((x > 40.0) && (n < (int)(0.25*x))) {
221   - h0 = bi0;
222   - h1 = bi1;
223   - for (k=2;k<=n;k++) {
224   - h = -2.0*(k-1.0)*h1/x+h0;
225   - in[k] = h;
226   - h0 = h1;
227   - h1 = h;
228   - }
229   - }
230   - else {
231   - m = msta1(x,200);
232   - if (m < n) nm = m;
233   - else m = msta2(x,n,15);
234   - f0 = 0.0;
235   - f1 = 1.0e-100;
236   - for (k=m;k>=0;k--) {
237   - f = 2.0*(k+1.0)*f1/x+f0;
238   - if (x <= nm) in[k] = f;
239   - f0 = f1;
240   - f1 = f;
241   - }
242   - s0 = bi0/f;
243   - for (k=0;k<=m;k++) {
244   - in[k] *= s0;
245   - }
246   - }
247   - g0 = bk0;
248   - g1 = bk1;
249   - for (k=2;k<=nm;k++) {
250   - g = 2.0*(k-1.0)*g1/x+g0;
251   - kn[k] = g;
252   - g0 = g1;
253   - g1 = g;
254   - }
255   - for (k=2;k<=nm;k++) {
256   - inp[k] = in[k-1]-k*in[k]/x;
257   - knp[k] = -kn[k-1]-k*kn[k]/x;
258   - }
259   - return 0;
260   -}
261   -int bessiknb(int n,double x,int &nm,double *in,double *kn,
262   - double *inp,double *knp)
263   -{
264   - double s0,bs,f,f0,f1,sk0,a0,bkl,vt,r,g,g0,g1;
265   - int k,kz,m,l;
266   -
267   - if ((x < 0.0) || (n < 0)) return 1;
268   - if (x < eps) {
269   - for (k=0;k<=n;k++) {
270   - in[k] = 0.0;
271   - kn[k] = 1e308;
272   - inp[k] = 0.0;
273   - knp[k] = -1e308;
274   - }
275   - in[0] = 1.0;
276   - inp[1] = 0.5;
277   - return 0;
278   - }
279   - nm = n;
280   - if (n == 0) nm = 1;
281   - m = msta1(x,200);
282   - if (m < nm) nm = m;
283   - else m = msta2(x,nm,15);
284   - bs = 0.0;
285   - sk0 = 0.0;
286   - f0 = 0.0;
287   - f1 = 1.0e-100;
288   - for (k=m;k>=0;k--) {
289   - f = 2.0*(k+1.0)*f1/x+f0;
290   - if (k <= nm) in[k] = f;
291   - if ((k != 0) && (k == 2*(int)(k/2))) {
292   - sk0 += 4.0*f/k;
293   - }
294   - bs += 2.0*f;
295   - f0 = f1;
296   - f1 = f;
297   - }
298   - s0 = exp(x)/(bs-f);
299   - for (k=0;k<=nm;k++) {
300   - in[k] *= s0;
301   - }
302   - if (x <= 8.0) {
303   - kn[0] = -(log(0.5*x)+el)*in[0]+s0*sk0;
304   - kn[1] = (1.0/x-in[1]*kn[0])/in[0];
305   - }
306   - else {
307   - a0 = sqrt(M_PI_2/x)*exp(-x);
308   - if (x >= 200.0) kz = 6;
309   - else if (x >= 80.0) kz = 8;
310   - else if (x >= 25.0) kz = 10;
311   - else kz = 16;
312   - for (l=0;l<2;l++) {
313   - bkl = 1.0;
314   - vt = 4.0*l;
315   - r = 1.0;
316   - for (k=1;k<=kz;k++) {
317   - r *= 0.125*(vt-pow(2.0*k-1.0,2))/(k*x);
318   - bkl += r;
319   - }
320   - kn[l] = a0*bkl;
321   - }
322   - }
323   - g0 = kn[0];
324   - g1 = kn[1];
325   - for (k=2;k<=nm;k++) {
326   - g = 2.0*(k-1.0)*g1/x+g0;
327   - kn[k] = g;
328   - g0 = g1;
329   - g1 = g;
330   - }
331   - inp[0] = in[1];
332   - knp[0] = -kn[1];
333   - for (k=1;k<=nm;k++) {
334   - inp[k] = in[k-1]-k*in[k]/x;
335   - knp[k] = -kn[k-1]-k*kn[k]/x;
336   - }
337   - return 0;
338   -}
339   -
340   -// The following program computes the modified Bessel functions
341   -// Iv(x) and Kv(x) for arbitrary positive order. For negative
342   -// order use:
343   -//
344   -// I-v(x) = Iv(x) + 2/pi sin(v pi) Kv(x)
345   -// K-v(x) = Kv(x)
346   -//
347   -int bessikv(double v,double x,double &vm,double *iv,double *kv,
348   - double *ivp,double *kvp)
349   -{
350   - double x2,v0,piv,vt,a1,v0p,gap,r,bi0,ca,sum;
351   - double f,f1,f2,ct,cs,wa,gan,ww,w0,v0n;
352   - double r1,r2,bk0,bk1,bk2,a2,cb;
353   - int n,k,kz,m;
354   -
355   - if ((v < 0.0) || (x < 0.0)) return 1;
356   - x2 = x*x;
357   - n = (int)v;
358   - v0 = v-n;
359   - if (n == 0) n = 1;
360   - if (x == 0.0) {
361   - for (k=0;k<=n;k++) {
362   - iv[k] = 0.0;
363   - kv[k] = -1e308;
364   - ivp[k] = 0.0;
365   - kvp[k] = 1e308;
366   - }
367   - if (v0 == 0.0) {
368   - iv[0] = 1.0;
369   - ivp[1] = 0.5;
370   - }
371   - vm = v;
372   - return 0;
373   - }
374   - piv = M_PI*v0;
375   - vt = 4.0*v0*v0;
376   - if (v0 == 0.0) {
377   - a1 = 1.0;
378   - }
379   - else {
380   - v0p = 1.0+v0;
381   - gap = gamma(v0p);
382   - a1 = pow(0.5*x,v0)/gap;
383   - }
384   - if (x >= 50.0) kz = 8;
385   - else if (x >= 35.0) kz = 10;
386   - else kz = 14;
387   - if (x <= 18.0) {
388   - bi0 = 1.0;
389   - r = 1.0;
390   - for (k=1;k<=30;k++) {
391   - r *= 0.25*x2/(k*(k+v0));
392   - bi0 += r;
393   - if (fabs(r/bi0) < eps) break;
394   - }
395   - bi0 *= a1;
396   - }
397   - else {
398   - ca = exp(x)/sqrt(2.0*M_PI*x);
399   - sum = 1.0;
400   - r = 1.0;
401   - for (k=1;k<=kz;k++) {
402   - r *= -0.125*(vt-pow(2.0*k-1.0,2.0))/(k*x);
403   - sum += r;
404   - }
405   - bi0 = ca*sum;
406   - }
407   - m = msta1(x,200);
408   - if (m < n) n = m;
409   - else m = msta2(x,n,15);
410   - f2 = 0.0;
411   - f1 = 1.0e-100;
412   - for (k=m;k>=0;k--) {
413   - f = 2.0*(v0+k+1.0)*f1/x+f2;
414   - if (k <= n) iv[k] = f;
415   - f2 = f1;
416   - f1 = f;
417   - }
418   - cs = bi0/f;
419   - for (k=0;k<=n;k++) {
420   - iv[k] *= cs;
421   - }
422   - ivp[0] = v0*iv[0]/x+iv[1];
423   - for (k=1;k<=n;k++) {
424   - ivp[k] = -(k+v0)*iv[k]/x+iv[k-1];
425   - }
426   - ww = 0.0;
427   - if (x <= 9.0) {
428   - if (v0 == 0.0) {
429   - ct = -log(0.5*x)-el;
430   - cs = 0.0;
431   - w0 = 0.0;
432   - r = 1.0;
433   - for (k=1;k<=50;k++) {
434   - w0 += 1.0/k;
435   - r *= 0.25*x2/(k*k);
436   - cs += r*(w0+ct);
437   - wa = fabs(cs);
438   - if (fabs((wa-ww)/wa) < eps) break;
439   - ww = wa;
440   - }
441   - bk0 = ct+cs;
442   - }
443   - else {
444   - v0n = 1.0-v0;
445   - gan = gamma(v0n);
446   - a2 = 1.0/(gan*pow(0.5*x,v0));
447   - a1 = pow(0.5*x,v0)/gap;
448   - sum = a2-a1;
449   - r1 = 1.0;
450   - r2 = 1.0;
451   - for (k=1;k<=120;k++) {
452   - r1 *= 0.25*x2/(k*(k-v0));
453   - r2 *= 0.25*x2/(k*(k+v0));
454   - sum += a2*r1-a1*r2;
455   - wa = fabs(sum);
456   - if (fabs((wa-ww)/wa) < eps) break;
457   - ww = wa;
458   - }
459   - bk0 = M_PI_2*sum/sin(piv);
460   - }
461   - }
462   - else {
463   - cb = exp(-x)*sqrt(M_PI_2/x);
464   - sum = 1.0;
465   - r = 1.0;
466   - for (k=1;k<=kz;k++) {
467   - r *= 0.125*(vt-pow(2.0*k-1.0,2.0))/(k*x);
468   - sum += r;
469   - }
470   - bk0 = cb*sum;
471   - }
472   - bk1 = (1.0/x-iv[1]*bk0)/iv[0];
473   - kv[0] = bk0;
474   - kv[1] = bk1;
475   - for (k=2;k<=n;k++) {
476   - bk2 = 2.0*(v0+k-1.0)*bk1/x+bk0;
477   - kv[k] = bk2;
478   - bk0 = bk1;
479   - bk1 = bk2;
480   - }
481   - kvp[0] = v0*kv[0]/x-kv[1];
482   - for (k=1;k<=n;k++) {
483   - kvp[k] = -(k+v0)*kv[k]/x-kv[k-1];
484   - }
485   - vm = n+v0;
486   - return 0;
487   -}
  1 +// bessik.cpp -- computation of modified Bessel functions In, Kn
  2 +// and their derivatives. Algorithms and coefficient values from
  3 +// "Computation of Special Functions", Zhang and Jin, John
  4 +// Wiley and Sons, 1996.
  5 +//
  6 +// (C) 2003, C. Bond. All rights reserved.
  7 +//
  8 +#define _USE_MATH_DEFINES
  9 +#include <math.h>
  10 +#include "bessel.h"
  11 +
  12 +double gamma(double x);
  13 +
  14 +int bessik01a(double x,double &i0,double &i1,double &k0,double &k1,
  15 + double &i0p,double &i1p,double &k0p,double &k1p)
  16 +{
  17 + double r,x2,ca,cb,ct,ww,w0,xr,xr2;
  18 + int k,kz;
  19 + static double a[] = {
  20 + 0.125,
  21 + 7.03125e-2,
  22 + 7.32421875e-2,
  23 + 1.1215209960938e-1,
  24 + 2.2710800170898e-1,
  25 + 5.7250142097473e-1,
  26 + 1.7277275025845,
  27 + 6.0740420012735,
  28 + 2.4380529699556e1,
  29 + 1.1001714026925e2,
  30 + 5.5133589612202e2,
  31 + 3.0380905109224e3
  32 + };
  33 + static double b[] = {
  34 + -0.375,
  35 + -1.171875e-1,
  36 + -1.025390625e-1,
  37 + -1.4419555664063e-1,
  38 + -2.7757644653320e-1,
  39 + -6.7659258842468e-1,
  40 + -1.9935317337513,
  41 + -6.8839142681099,
  42 + -2.7248827311269e1,
  43 + -1.2159789187654e2,
  44 + -6.0384407670507e2,
  45 + -3.3022722944809e3
  46 + };
  47 + static double a1[] = {
  48 + 0.125,
  49 + 0.2109375,
  50 + 1.0986328125,
  51 + 1.1775970458984e1,
  52 + 2.1461706161499e2,
  53 + 5.9511522710323e3,
  54 + 2.3347645606175e5,
  55 + 1.2312234987631e7
  56 + };
  57 +
  58 + if (x < 0.0) return 1;
  59 + if (x == 0.0) {
  60 + i0 = 1.0;
  61 + i1 = 0.0;
  62 + k0 = 1e308;
  63 + k1 = 1e308;
  64 + i0p = 0.0;
  65 + i1p = 0.5;
  66 + k0p = -1e308;
  67 + k1p = -1e308;
  68 + return 0;
  69 + }
  70 + x2 = x*x;
  71 + if (x <= 18.0) {
  72 + i0 = 1.0;
  73 + r = 1.0;
  74 + for (k=1; k<=50; k++) {
  75 + r *= 0.25*x2/(k*k);
  76 + i0 += r;
  77 + if (fabs(r/i0) < eps) break;
  78 + }
  79 + i1 = 1.0;
  80 + r = 1.0;
  81 + for (k=1; k<=50; k++) {
  82 + r *= 0.25*x2/(k*(k+1));
  83 + i1 += r;
  84 + if (fabs(r/i1) < eps) break;
  85 + }
  86 + i1 *= 0.5*x;
  87 + }
  88 + else {
  89 + if (x >= 50.0) kz = 7;
  90 + else if (x >= 35.0) kz = 9;
  91 + else kz = 12;
  92 + ca = exp(x)/sqrt(2.0*M_PI*x);
  93 + i0 = 1.0;
  94 + xr = 1.0/x;
  95 + for (k=0; k<kz; k++) {
  96 + i0 += a[k]*pow(xr,k+1);
  97 + }
  98 + i0 *= ca;
  99 + i1 = 1.0;
  100 + for (k=0; k<kz; k++) {
  101 + i1 += b[k]*pow(xr,k+1);
  102 + }
  103 + i1 *= ca;
  104 + }
  105 + if (x <= 9.0) {
  106 + ct = -(log(0.5*x)+el);
  107 + k0 = 0.0;
  108 + w0 = 0.0;
  109 + r = 1.0;
  110 + ww = 0.0;
  111 + for (k=1; k<=50; k++) {
  112 + w0 += 1.0/k;
  113 + r *= 0.25*x2/(k*k);
  114 + k0 += r*(w0+ct);
  115 + if (fabs((k0-ww)/k0) < eps) break;
  116 + ww = k0;
  117 + }
  118 + k0 += ct;
  119 + }
  120 + else {
  121 + cb = 0.5/x;
  122 + xr2 = 1.0/x2;
  123 + k0 = 1.0;
  124 + for (k=0; k<8; k++) {
  125 + k0 += a1[k]*pow(xr2,k+1);
  126 + }
  127 + k0 *= cb/i0;
  128 + }
  129 + k1 = (1.0/x - i1*k0)/i0;
  130 + i0p = i1;
  131 + i1p = i0-i1/x;
  132 + k0p = -k1;
  133 + k1p = -k0-k1/x;
  134 + return 0;
  135 +}
  136 +
  137 +int bessik01b(double x,double &i0,double &i1,double &k0,double &k1,
  138 + double &i0p,double &i1p,double &k0p,double &k1p)
  139 +{
  140 + double t,t2,dtmp,dtmp1;
  141 +
  142 + if (x < 0.0) return 1;
  143 + if (x == 0.0) {
  144 + i0 = 1.0;
  145 + i1 = 0.0;
  146 + k0 = 1e308;
  147 + k1 = 1e308;
  148 + i0p = 0.0;
  149 + i1p = 0.5;
  150 + k0p = -1e308;
  151 + k1p = -1e308;
  152 + return 0;
  153 + }
  154 + if (x < 3.75) {
  155 + t = x/3.75;
  156 + t2 = t*t;
  157 + i0 = (((((0.0045813*t2+0.0360768)*t2+0.2659732)*t2+
  158 + 1.2067492)*t2+3.0899424)*t2+3.5156229)*t2+1.0;
  159 + i1 = x*(((((0.00032411*t2+0.00301532)*t2+0.02658733*t2+
  160 + 0.15084934)*t2+0.51498869)*t2+0.87890594)*t2+0.5);
  161 + }
  162 + else {
  163 + t = 3.75/x;
  164 + dtmp1 = exp(x)/sqrt(x);
  165 + dtmp = (((((((0.00392377*t-0.01647633)*t+0.026355537)*t-0.02057706)*t+
  166 + 0.00916281)*t-0.00157565)*t+0.00225319)*t+0.01328592)*t+0.39894228;
  167 + i0 = dtmp*dtmp1;
  168 + dtmp = (((((((-0.00420059*t+0.01787654)*t-0.02895312)*t+0.02282967)*t-
  169 + 0.01031555)*t+0.00163801)*t-0.00362018)*t-0.03988024)*t+0.39894228;
  170 + i1 = dtmp*dtmp1;
  171 + }
  172 + if (x < 2.0) {
  173 + t = 0.5*x;
  174 + t2 = t*t; // already calculated above
  175 + dtmp = (((((0.0000074*t2+0.0001075)*t2+0.00262698)*t2+0.0348859)*t2+
  176 + 0.23069756)*t2+0.4227842)*t2-0.57721566;
  177 + k0 = dtmp - i0*log(t);
  178 + dtmp = (((((-0.00004686*t2-0.00110404)*t2-0.01919402)*t2-
  179 + 0.18156897)*t2-0.67278578)*t2+0.15443144)*t2+1.0;
  180 + k1 = dtmp/x + i1*log(t);
  181 + }
  182 + else {
  183 + t = 2.0/x;
  184 + dtmp1 = exp(-x)/sqrt(x);
  185 + dtmp = (((((0.00053208*t-0.0025154)*t+0.00587872)*t-0.01062446)*t+
  186 + 0.02189568)*t-0.07832358)*t+1.25331414;
  187 + k0 = dtmp*dtmp1;
  188 + dtmp = (((((-0.00068245*t+0.00325614)*t-0.00780353)*t+0.01504268)*t-
  189 + 0.0365562)*t+0.23498619)*t+1.25331414;
  190 + k1 = dtmp*dtmp1;
  191 + }
  192 + i0p = i1;
  193 + i1p = i0 - i1/x;
  194 + k0p = -k1;
  195 + k1p = -k0 - k1/x;
  196 + return 0;
  197 +}
  198 +int bessikna(int n,double x,int &nm,double *in,double *kn,
  199 + double *inp,double *knp)
  200 +{
  201 + double bi0,bi1,bk0,bk1,g,g0,g1,f,f0,f1,h,h0,h1,s0;
  202 + int k,m,ecode;
  203 +
  204 + if ((x < 0.0) || (n < 0)) return 1;
  205 + if (x < eps) {
  206 + for (k=0; k<=n; k++) {
  207 + in[k] = 0.0;
  208 + kn[k] = 1e308;
  209 + inp[k] = 0.0;
  210 + knp[k] = -1e308;
  211 + }
  212 + in[0] = 1.0;
  213 + inp[1] = 0.5;
  214 + return 0;
  215 + }
  216 + nm = n;
  217 + ecode = bessik01a(x,in[0],in[1],kn[0],kn[1],inp[0],inp[1],knp[0],knp[1]);
  218 + if (n < 2) return 0;
  219 + bi0 = in[0];
  220 + bi1 = in[1];
  221 + bk0 = kn[0];
  222 + bk1 = kn[1];
  223 + if ((x > 40.0) && (n < (int)(0.25*x))) {
  224 + h0 = bi0;
  225 + h1 = bi1;
  226 + for (k=2; k<=n; k++) {
  227 + h = -2.0*(k-1.0)*h1/x+h0;
  228 + in[k] = h;
  229 + h0 = h1;
  230 + h1 = h;
  231 + }
  232 + }
  233 + else {
  234 + m = msta1(x,200);
  235 + if (m < n) nm = m;
  236 + else m = msta2(x,n,15);
  237 + f0 = 0.0;
  238 + f1 = 1.0e-100;
  239 + for (k=m; k>=0; k--) {
  240 + f = 2.0*(k+1.0)*f1/x+f0;
  241 + if (x <= nm) in[k] = f;
  242 + f0 = f1;
  243 + f1 = f;
  244 + }
  245 + s0 = bi0/f;
  246 + for (k=0; k<=m; k++) {
  247 + in[k] *= s0;
  248 + }
  249 + }
  250 + g0 = bk0;
  251 + g1 = bk1;
  252 + for (k=2; k<=nm; k++) {
  253 + g = 2.0*(k-1.0)*g1/x+g0;
  254 + kn[k] = g;
  255 + g0 = g1;
  256 + g1 = g;
  257 + }
  258 + for (k=2; k<=nm; k++) {
  259 + inp[k] = in[k-1]-k*in[k]/x;
  260 + knp[k] = -kn[k-1]-k*kn[k]/x;
  261 + }
  262 + return 0;
  263 +}
  264 +int bessiknb(int n,double x,int &nm,double *in,double *kn,
  265 + double *inp,double *knp)
  266 +{
  267 + double s0,bs,f,f0,f1,sk0,a0,bkl,vt,r,g,g0,g1;
  268 + int k,kz,m,l;
  269 +
  270 + if ((x < 0.0) || (n < 0)) return 1;
  271 + if (x < eps) {
  272 + for (k=0; k<=n; k++) {
  273 + in[k] = 0.0;
  274 + kn[k] = 1e308;
  275 + inp[k] = 0.0;
  276 + knp[k] = -1e308;
  277 + }
  278 + in[0] = 1.0;
  279 + inp[1] = 0.5;
  280 + return 0;
  281 + }
  282 + nm = n;
  283 + if (n == 0) nm = 1;
  284 + m = msta1(x,200);
  285 + if (m < nm) nm = m;
  286 + else m = msta2(x,nm,15);
  287 + bs = 0.0;
  288 + sk0 = 0.0;
  289 + f0 = 0.0;
  290 + f1 = 1.0e-100;
  291 + for (k=m; k>=0; k--) {
  292 + f = 2.0*(k+1.0)*f1/x+f0;
  293 + if (k <= nm) in[k] = f;
  294 + if ((k != 0) && (k == 2*(int)(k/2))) {
  295 + sk0 += 4.0*f/k;
  296 + }
  297 + bs += 2.0*f;
  298 + f0 = f1;
  299 + f1 = f;
  300 + }
  301 + s0 = exp(x)/(bs-f);
  302 + for (k=0; k<=nm; k++) {
  303 + in[k] *= s0;
  304 + }
  305 + if (x <= 8.0) {
  306 + kn[0] = -(log(0.5*x)+el)*in[0]+s0*sk0;
  307 + kn[1] = (1.0/x-in[1]*kn[0])/in[0];
  308 + }
  309 + else {
  310 + a0 = sqrt(M_PI_2/x)*exp(-x);
  311 + if (x >= 200.0) kz = 6;
  312 + else if (x >= 80.0) kz = 8;
  313 + else if (x >= 25.0) kz = 10;
  314 + else kz = 16;
  315 + for (l=0; l<2; l++) {
  316 + bkl = 1.0;
  317 + vt = 4.0*l;
  318 + r = 1.0;
  319 + for (k=1; k<=kz; k++) {
  320 + r *= 0.125*(vt-pow(2.0*k-1.0,2))/(k*x);
  321 + bkl += r;
  322 + }
  323 + kn[l] = a0*bkl;
  324 + }
  325 + }
  326 + g0 = kn[0];
  327 + g1 = kn[1];
  328 + for (k=2; k<=nm; k++) {
  329 + g = 2.0*(k-1.0)*g1/x+g0;
  330 + kn[k] = g;
  331 + g0 = g1;
  332 + g1 = g;
  333 + }
  334 + inp[0] = in[1];
  335 + knp[0] = -kn[1];
  336 + for (k=1; k<=nm; k++) {
  337 + inp[k] = in[k-1]-k*in[k]/x;
  338 + knp[k] = -kn[k-1]-k*kn[k]/x;
  339 + }
  340 + return 0;
  341 +}
  342 +
  343 +// The following program computes the modified Bessel functions
  344 +// Iv(x) and Kv(x) for arbitrary positive order. For negative
  345 +// order use:
  346 +//
  347 +// I-v(x) = Iv(x) + 2/pi sin(v pi) Kv(x)
  348 +// K-v(x) = Kv(x)
  349 +//
  350 +int bessikv(double v,double x,double &vm,double *iv,double *kv,
  351 + double *ivp,double *kvp)
  352 +{
  353 + double x2,v0,piv,vt,a1,v0p,gap,r,bi0,ca,sum;
  354 + double f,f1,f2,ct,cs,wa,gan,ww,w0,v0n;
  355 + double r1,r2,bk0,bk1,bk2,a2,cb;
  356 + int n,k,kz,m;
  357 +
  358 + if ((v < 0.0) || (x < 0.0)) return 1;
  359 + x2 = x*x;
  360 + n = (int)v;
  361 + v0 = v-n;
  362 + if (n == 0) n = 1;
  363 + if (x == 0.0) {
  364 + for (k=0; k<=n; k++) {
  365 + iv[k] = 0.0;
  366 + kv[k] = -1e308;
  367 + ivp[k] = 0.0;
  368 + kvp[k] = 1e308;
  369 + }
  370 + if (v0 == 0.0) {
  371 + iv[0] = 1.0;
  372 + ivp[1] = 0.5;
  373 + }
  374 + vm = v;
  375 + return 0;
  376 + }
  377 + piv = M_PI*v0;
  378 + vt = 4.0*v0*v0;
  379 + if (v0 == 0.0) {
  380 + a1 = 1.0;
  381 + }
  382 + else {
  383 + v0p = 1.0+v0;
  384 + gap = gamma(v0p);
  385 + a1 = pow(0.5*x,v0)/gap;
  386 + }
  387 + if (x >= 50.0) kz = 8;
  388 + else if (x >= 35.0) kz = 10;
  389 + else kz = 14;
  390 + if (x <= 18.0) {
  391 + bi0 = 1.0;
  392 + r = 1.0;
  393 + for (k=1; k<=30; k++) {
  394 + r *= 0.25*x2/(k*(k+v0));
  395 + bi0 += r;
  396 + if (fabs(r/bi0) < eps) break;
  397 + }
  398 + bi0 *= a1;
  399 + }
  400 + else {
  401 + ca = exp(x)/sqrt(2.0*M_PI*x);
  402 + sum = 1.0;
  403 + r = 1.0;
  404 + for (k=1; k<=kz; k++) {
  405 + r *= -0.125*(vt-pow(2.0*k-1.0,2.0))/(k*x);
  406 + sum += r;
  407 + }
  408 + bi0 = ca*sum;
  409 + }
  410 + m = msta1(x,200);
  411 + if (m < n) n = m;
  412 + else m = msta2(x,n,15);
  413 + f2 = 0.0;
  414 + f1 = 1.0e-100;
  415 + for (k=m; k>=0; k--) {
  416 + f = 2.0*(v0+k+1.0)*f1/x+f2;
  417 + if (k <= n) iv[k] = f;
  418 + f2 = f1;
  419 + f1 = f;
  420 + }
  421 + cs = bi0/f;
  422 + for (k=0; k<=n; k++) {
  423 + iv[k] *= cs;
  424 + }
  425 + ivp[0] = v0*iv[0]/x+iv[1];
  426 + for (k=1; k<=n; k++) {
  427 + ivp[k] = -(k+v0)*iv[k]/x+iv[k-1];
  428 + }
  429 + ww = 0.0;
  430 + if (x <= 9.0) {
  431 + if (v0 == 0.0) {
  432 + ct = -log(0.5*x)-el;
  433 + cs = 0.0;
  434 + w0 = 0.0;
  435 + r = 1.0;
  436 + for (k=1; k<=50; k++) {
  437 + w0 += 1.0/k;
  438 + r *= 0.25*x2/(k*k);
  439 + cs += r*(w0+ct);
  440 + wa = fabs(cs);
  441 + if (fabs((wa-ww)/wa) < eps) break;
  442 + ww = wa;
  443 + }
  444 + bk0 = ct+cs;
  445 + }
  446 + else {
  447 + v0n = 1.0-v0;
  448 + gan = gamma(v0n);
  449 + a2 = 1.0/(gan*pow(0.5*x,v0));
  450 + a1 = pow(0.5*x,v0)/gap;
  451 + sum = a2-a1;
  452 + r1 = 1.0;
  453 + r2 = 1.0;
  454 + for (k=1; k<=120; k++) {
  455 + r1 *= 0.25*x2/(k*(k-v0));
  456 + r2 *= 0.25*x2/(k*(k+v0));
  457 + sum += a2*r1-a1*r2;
  458 + wa = fabs(sum);
  459 + if (fabs((wa-ww)/wa) < eps) break;
  460 + ww = wa;
  461 + }
  462 + bk0 = M_PI_2*sum/sin(piv);
  463 + }
  464 + }
  465 + else {
  466 + cb = exp(-x)*sqrt(M_PI_2/x);
  467 + sum = 1.0;
  468 + r = 1.0;
  469 + for (k=1; k<=kz; k++) {
  470 + r *= 0.125*(vt-pow(2.0*k-1.0,2.0))/(k*x);
  471 + sum += r;
  472 + }
  473 + bk0 = cb*sum;
  474 + }
  475 + bk1 = (1.0/x-iv[1]*bk0)/iv[0];
  476 + kv[0] = bk0;
  477 + kv[1] = bk1;
  478 + for (k=2; k<=n; k++) {
  479 + bk2 = 2.0*(v0+k-1.0)*bk1/x+bk0;
  480 + kv[k] = bk2;
  481 + bk0 = bk1;
  482 + bk1 = bk2;
  483 + }
  484 + kvp[0] = v0*kv[0]/x-kv[1];
  485 + for (k=1; k<=n; k++) {
  486 + kvp[k] = -(k+v0)*kv[k]/x-kv[k-1];
  487 + }
  488 + vm = n+v0;
  489 + return 0;
  490 +}
... ...
bessjy.cpp
1   -// bessjy.cpp -- computation of Bessel functions Jn, Yn and their
2   -// derivatives. Algorithms and coefficient values from
3   -// "Computation of Special Functions", Zhang and Jin, John
4   -// Wiley and Sons, 1996.
5   -//
6   -// (C) 2003, C. Bond. All rights reserved.
7   -//
8   -// Note that 'math.h' provides (or should provide) values for:
9   -// pi M_PI
10   -// 2/pi M_2_PI
11   -// pi/4 M_PI_4
12   -// pi/2 M_PI_2
13   -//
14   -#define _USE_MATH_DEFINES
15   -#include <math.h>
16   -#include "bessel.h"
17   -
18   -double gamma(double x);
19   -//
20   -// INPUT:
21   -// double x -- argument of Bessel function
22   -//
23   -// OUTPUT (via address pointers):
24   -// double j0 -- Bessel function of 1st kind, 0th order
25   -// double j1 -- Bessel function of 1st kind, 1st order
26   -// double y0 -- Bessel function of 2nd kind, 0th order
27   -// double y1 -- Bessel function of 2nd kind, 1st order
28   -// double j0p -- derivative of Bessel function of 1st kind, 0th order
29   -// double j1p -- derivative of Bessel function of 1st kind, 1st order
30   -// double y0p -- derivative of Bessel function of 2nd kind, 0th order
31   -// double y1p -- derivative of Bessel function of 2nd kind, 1st order
32   -//
33   -// RETURN:
34   -// int error code: 0 = OK, 1 = error
35   -//
36   -// This algorithm computes the above functions using series expansions.
37   -//
38   -int bessjy01a(double x,double &j0,double &j1,double &y0,double &y1,
39   - double &j0p,double &j1p,double &y0p,double &y1p)
40   -{
41   - double x2,r,ec,w0,w1,r0,r1,cs0,cs1;
42   - double cu,p0,q0,p1,q1,t1,t2;
43   - int k,kz;
44   - static double a[] = {
45   - -7.03125e-2,
46   - 0.112152099609375,
47   - -0.5725014209747314,
48   - 6.074042001273483,
49   - -1.100171402692467e2,
50   - 3.038090510922384e3,
51   - -1.188384262567832e5,
52   - 6.252951493434797e6,
53   - -4.259392165047669e8,
54   - 3.646840080706556e10,
55   - -3.833534661393944e12,
56   - 4.854014686852901e14,
57   - -7.286857349377656e16,
58   - 1.279721941975975e19};
59   - static double b[] = {
60   - 7.32421875e-2,
61   - -0.2271080017089844,
62   - 1.727727502584457,
63   - -2.438052969955606e1,
64   - 5.513358961220206e2,
65   - -1.825775547429318e4,
66   - 8.328593040162893e5,
67   - -5.006958953198893e7,
68   - 3.836255180230433e9,
69   - -3.649010818849833e11,
70   - 4.218971570284096e13,
71   - -5.827244631566907e15,
72   - 9.476288099260110e17,
73   - -1.792162323051699e20};
74   - static double a1[] = {
75   - 0.1171875,
76   - -0.1441955566406250,
77   - 0.6765925884246826,
78   - -6.883914268109947,
79   - 1.215978918765359e2,
80   - -3.302272294480852e3,
81   - 1.276412726461746e5,
82   - -6.656367718817688e6,
83   - 4.502786003050393e8,
84   - -3.833857520742790e10,
85   - 4.011838599133198e12,
86   - -5.060568503314727e14,
87   - 7.572616461117958e16,
88   - -1.326257285320556e19};
89   - static double b1[] = {
90   - -0.1025390625,
91   - 0.2775764465332031,
92   - -1.993531733751297,
93   - 2.724882731126854e1,
94   - -6.038440767050702e2,
95   - 1.971837591223663e4,
96   - -8.902978767070678e5,
97   - 5.310411010968522e7,
98   - -4.043620325107754e9,
99   - 3.827011346598605e11,
100   - -4.406481417852278e13,
101   - 6.065091351222699e15,
102   - -9.833883876590679e17,
103   - 1.855045211579828e20};
104   -
105   - if (x < 0.0) return 1;
106   - if (x == 0.0) {
107   - j0 = 1.0;
108   - j1 = 0.0;
109   - y0 = -1e308;
110   - y1 = -1e308;
111   - j0p = 0.0;
112   - j1p = 0.5;
113   - y0p = 1e308;
114   - y1p = 1e308;
115   - return 0;
116   - }
117   - x2 = x*x;
118   - if (x <= 12.0) {
119   - j0 = 1.0;
120   - r = 1.0;
121   - for (k=1;k<=30;k++) {
122   - r *= -0.25*x2/(k*k);
123   - j0 += r;
124   - if (fabs(r) < fabs(j0)*1e-15) break;
125   - }
126   - j1 = 1.0;
127   - r = 1.0;
128   - for (k=1;k<=30;k++) {
129   - r *= -0.25*x2/(k*(k+1));
130   - j1 += r;
131   - if (fabs(r) < fabs(j1)*1e-15) break;
132   - }
133   - j1 *= 0.5*x;
134   - ec = log(0.5*x)+el;
135   - cs0 = 0.0;
136   - w0 = 0.0;
137   - r0 = 1.0;
138   - for (k=1;k<=30;k++) {
139   - w0 += 1.0/k;
140   - r0 *= -0.25*x2/(k*k);
141   - r = r0 * w0;
142   - cs0 += r;
143   - if (fabs(r) < fabs(cs0)*1e-15) break;
144   - }
145   - y0 = M_2_PI*(ec*j0-cs0);
146   - cs1 = 1.0;
147   - w1 = 0.0;
148   - r1 = 1.0;
149   - for (k=1;k<=30;k++) {
150   - w1 += 1.0/k;
151   - r1 *= -0.25*x2/(k*(k+1));
152   - r = r1*(2.0*w1+1.0/(k+1));
153   - cs1 += r;
154   - if (fabs(r) < fabs(cs1)*1e-15) break;
155   - }
156   - y1 = M_2_PI * (ec*j1-1.0/x-0.25*x*cs1);
157   - }
158   - else {
159   - if (x >= 50.0) kz = 8; // Can be changed to 10
160   - else if (x >= 35.0) kz = 10; // " " 12
161   - else kz = 12; // " " 14
162   - t1 = x-M_PI_4;
163   - p0 = 1.0;
164   - q0 = -0.125/x;
165   - for (k=0;k<kz;k++) {
166   - p0 += a[k]*pow(x,-2*k-2);
167   - q0 += b[k]*pow(x,-2*k-3);
168   - }
169   - cu = sqrt(M_2_PI/x);
170   - j0 = cu*(p0*cos(t1)-q0*sin(t1));
171   - y0 = cu*(p0*sin(t1)+q0*cos(t1));
172   - t2 = x-0.75*M_PI;
173   - p1 = 1.0;
174   - q1 = 0.375/x;
175   - for (k=0;k<kz;k++) {
176   - p1 += a1[k]*pow(x,-2*k-2);
177   - q1 += b1[k]*pow(x,-2*k-3);
178   - }
179   - j1 = cu*(p1*cos(t2)-q1*sin(t2));
180   - y1 = cu*(p1*sin(t2)+q1*cos(t2));
181   - }
182   - j0p = -j1;
183   - j1p = j0-j1/x;
184   - y0p = -y1;
185   - y1p = y0-y1/x;
186   - return 0;
187   -}
188   -//
189   -// INPUT:
190   -// double x -- argument of Bessel function
191   -//
192   -// OUTPUT:
193   -// double j0 -- Bessel function of 1st kind, 0th order
194   -// double j1 -- Bessel function of 1st kind, 1st order
195   -// double y0 -- Bessel function of 2nd kind, 0th order
196   -// double y1 -- Bessel function of 2nd kind, 1st order
197   -// double j0p -- derivative of Bessel function of 1st kind, 0th order
198   -// double j1p -- derivative of Bessel function of 1st kind, 1st order
199   -// double y0p -- derivative of Bessel function of 2nd kind, 0th order
200   -// double y1p -- derivative of Bessel function of 2nd kind, 1st order
201   -//
202   -// RETURN:
203   -// int error code: 0 = OK, 1 = error
204   -//
205   -// This algorithm computes the functions using polynomial approximations.
206   -//
207   -int bessjy01b(double x,double &j0,double &j1,double &y0,double &y1,
208   - double &j0p,double &j1p,double &y0p,double &y1p)
209   -{
210   - double t,t2,dtmp,a0,p0,q0,p1,q1,ta0,ta1;
211   - if (x < 0.0) return 1;
212   - if (x == 0.0) {
213   - j0 = 1.0;
214   - j1 = 0.0;
215   - y0 = -1e308;
216   - y1 = -1e308;
217   - j0p = 0.0;
218   - j1p = 0.5;
219   - y0p = 1e308;
220   - y1p = 1e308;
221   - return 0;
222   - }
223   - if(x <= 4.0) {
224   - t = x/4.0;
225   - t2 = t*t;
226   - j0 = ((((((-0.5014415e-3*t2+0.76771853e-2)*t2-0.0709253492)*t2+
227   - 0.4443584263)*t2-1.7777560599)*t2+3.9999973021)*t2
228   - -3.9999998721)*t2+1.0;
229   - j1 = t*(((((((-0.1289769e-3*t2+0.22069155e-2)*t2-0.0236616773)*t2+
230   - 0.1777582922)*t2-0.8888839649)*t2+2.6666660544)*t2-
231   - 3.999999971)*t2+1.9999999998);
232   - dtmp = (((((((-0.567433e-4*t2+0.859977e-3)*t2-0.94855882e-2)*t2+
233   - 0.0772975809)*t2-0.4261737419)*t2+1.4216421221)*t2-
234   - 2.3498519931)*t2+1.0766115157)*t2+0.3674669052;
235   - y0 = M_2_PI*log(0.5*x)*j0+dtmp;
236   - dtmp = (((((((0.6535773e-3*t2-0.0108175626)*t2+0.107657607)*t2-
237   - 0.7268945577)*t2+3.1261399273)*t2-7.3980241381)*t2+
238   - 6.8529236342)*t2+0.3932562018)*t2-0.6366197726;
239   - y1 = M_2_PI*log(0.5*x)*j1+dtmp/x;
240   - }
241   - else {
242   - t = 4.0/x;
243   - t2 = t*t;
244   - a0 = sqrt(M_2_PI/x);
245   - p0 = ((((-0.9285e-5*t2+0.43506e-4)*t2-0.122226e-3)*t2+
246   - 0.434725e-3)*t2-0.4394275e-2)*t2+0.999999997;
247   - q0 = t*(((((0.8099e-5*t2-0.35614e-4)*t2+0.85844e-4)*t2-
248   - 0.218024e-3)*t2+0.1144106e-2)*t2-0.031249995);
249   - ta0 = x-M_PI_4;
250   - j0 = a0*(p0*cos(ta0)-q0*sin(ta0));
251   - y0 = a0*(p0*sin(ta0)+q0*cos(ta0));
252   - p1 = ((((0.10632e-4*t2-0.50363e-4)*t2+0.145575e-3)*t2
253   - -0.559487e-3)*t2+0.7323931e-2)*t2+1.000000004;
254   - q1 = t*(((((-0.9173e-5*t2+0.40658e-4)*t2-0.99941e-4)*t2
255   - +0.266891e-3)*t2-0.1601836e-2)*t2+0.093749994);
256   - ta1 = x-0.75*M_PI;
257   - j1 = a0*(p1*cos(ta1)-q1*sin(ta1));
258   - y1 = a0*(p1*sin(ta1)+q1*cos(ta1));
259   - }
260   - j0p = -j1;
261   - j1p = j0-j1/x;
262   - y0p = -y1;
263   - y1p = y0-y1/x;
264   - return 0;
265   -}
266   -int msta1(double x,int mp)
267   -{
268   - double a0,f0,f1,f;
269   - int i,n0,n1,nn;
270   -
271   - a0 = fabs(x);
272   - n0 = (int)(1.1*a0)+1;
273   - f0 = 0.5*log10(6.28*n0)-n0*log10(1.36*a0/n0)-mp;
274   - n1 = n0+5;
275   - f1 = 0.5*log10(6.28*n1)-n1*log10(1.36*a0/n1)-mp;
276   - for (i=0;i<20;i++) {
277   - nn = (int)(n1-(n1-n0)/(1.0-f0/f1));
278   - f = 0.5*log10(6.28*nn)-nn*log10(1.36*a0/nn)-mp;
279   - if (abs(nn-n1) < 1) break;
280   - n0 = n1;
281   - f0 = f1;
282   - n1 = nn;
283   - f1 = f;
284   - }
285   - return nn;
286   -}
287   -int msta2(double x,int n,int mp)
288   -{
289   - double a0,ejn,hmp,f0,f1,f,obj;
290   - int i,n0,n1,nn;
291   -
292   - a0 = fabs(x);
293   - hmp = 0.5*mp;
294   - ejn = 0.5*log10(6.28*n)-n*log10(1.36*a0/n);
295   - if (ejn <= hmp) {
296   - obj = mp;
297   - n0 = (int)(1.1*a0);
298   - if (n0 < 1) n0 = 1;
299   - }
300   - else {
301   - obj = hmp+ejn;
302   - n0 = n;
303   - }
304   - f0 = 0.5*log10(6.28*n0)-n0*log10(1.36*a0/n0)-obj;
305   - n1 = n0+5;
306   - f1 = 0.5*log10(6.28*n1)-n1*log10(1.36*a0/n1)-obj;
307   - for (i=0;i<20;i++) {
308   - nn = (int)(n1-(n1-n0)/(1.0-f0/f1));
309   - f = 0.5*log10(6.28*nn)-nn*log10(1.36*a0/nn)-obj;
310   - if (abs(nn-n1) < 1) break;
311   - n0 = n1;
312   - f0 = f1;
313   - n1 = nn;
314   - f1 = f;
315   - }
316   - return nn+10;
317   -}
318   -//
319   -// INPUT:
320   -// double x -- argument of Bessel function of 1st and 2nd kind.
321   -// int n -- order
322   -//
323   -// OUPUT:
324   -//
325   -// int nm -- highest order actually computed (nm <= n)
326   -// double jn[] -- Bessel function of 1st kind, orders from 0 to nm
327   -// double yn[] -- Bessel function of 2nd kind, orders from 0 to nm
328   -// double j'n[]-- derivative of Bessel function of 1st kind,
329   -// orders from 0 to nm
330   -// double y'n[]-- derivative of Bessel function of 2nd kind,
331   -// orders from 0 to nm
332   -//
333   -// Computes Bessel functions of all order up to 'n' using recurrence
334   -// relations. If 'nm' < 'n' only 'nm' orders are returned.
335   -//
336   -int bessjyna(int n,double x,int &nm,double *jn,double *yn,
337   - double *jnp,double *ynp)
338   -{
339   - double bj0,bj1,f,f0,f1,f2,cs;
340   - int i,k,m,ecode;
341   -
342   - nm = n;
343   - if ((x < 0.0) || (n < 0)) return 1;
344   - if (x < 1e-15) {
345   - for (i=0;i<=n;i++) {
346   - jn[i] = 0.0;
347   - yn[i] = -1e308;
348   - jnp[i] = 0.0;
349   - ynp[i] = 1e308;
350   - }
351   - jn[0] = 1.0;
352   - jnp[1] = 0.5;
353   - return 0;
354   - }
355   - ecode = bessjy01a(x,jn[0],jn[1],yn[0],yn[1],jnp[0],jnp[1],ynp[0],ynp[1]);
356   - if (n < 2) return 0;
357   - bj0 = jn[0];
358   - bj1 = jn[1];
359   - if (n < (int)0.9*x) {
360   - for (k=2;k<=n;k++) {
361   - jn[k] = 2.0*(k-1.0)*bj1/x-bj0;
362   - bj0 = bj1;
363   - bj1 = jn[k];
364   - }
365   - }
366   - else {
367   - m = msta1(x,200);
368   - if (m < n) nm = m;
369   - else m = msta2(x,n,15);
370   - f2 = 0.0;
371   - f1 = 1.0e-100;
372   - for (k=m;k>=0;k--) {
373   - f = 2.0*(k+1.0)/x*f1-f2;
374   - if (k <= nm) jn[k] = f;
375   - f2 = f1;
376   - f1 = f;
377   - }
378   - if (fabs(bj0) > fabs(bj1)) cs = bj0/f;
379   - else cs = bj1/f2;
380   - for (k=0;k<=nm;k++) {
381   - jn[k] *= cs;
382   - }
383   - }
384   - for (k=2;k<=nm;k++) {
385   - jnp[k] = jn[k-1]-k*jn[k]/x;
386   - }
387   - f0 = yn[0];
388   - f1 = yn[1];
389   - for (k=2;k<=nm;k++) {
390   - f = 2.0*(k-1.0)*f1/x-f0;
391   - yn[k] = f;
392   - f0 = f1;
393   - f1 = f;
394   - }
395   - for (k=2;k<=nm;k++) {
396   - ynp[k] = yn[k-1]-k*yn[k]/x;
397   - }
398   - return 0;
399   -}
400   -//
401   -// Same input and output conventions as above. Different recurrence
402   -// relations used for 'x' < 300.
403   -//
404   -int bessjynb(int n,double x,int &nm,double *jn,double *yn,
405   - double *jnp,double *ynp)
406   -{
407   - double t1,t2,f,f1,f2,bj0,bj1,bjk,by0,by1,cu,s0,su,sv;
408   - double ec,bs,byk,p0,p1,q0,q1;
409   - static double a[] = {
410   - -0.7031250000000000e-1,
411   - 0.1121520996093750,
412   - -0.5725014209747314,
413   - 6.074042001273483};
414   - static double b[] = {
415   - 0.7324218750000000e-1,
416   - -0.2271080017089844,
417   - 1.727727502584457,
418   - -2.438052969955606e1};
419   - static double a1[] = {
420   - 0.1171875,
421   - -0.1441955566406250,
422   - 0.6765925884246826,
423   - -6.883914268109947};
424   - static double b1[] = {
425   - -0.1025390625,
426   - 0.2775764465332031,
427   - -1.993531733751297,
428   - 2.724882731126854e1};
429   -
430   - int i,k,m;
431   - nm = n;
432   - if ((x < 0.0) || (n < 0)) return 1;
433   - if (x < 1e-15) {
434   - for (i=0;i<=n;i++) {
435   - jn[i] = 0.0;
436   - yn[i] = -1e308;
437   - jnp[i] = 0.0;
438   - ynp[i] = 1e308;
439   - }
440   - jn[0] = 1.0;
441   - jnp[1] = 0.5;
442   - return 0;
443   - }
444   - if (x <= 300.0 || n > (int)(0.9*x)) {
445   - if (n == 0) nm = 1;
446   - m = msta1(x,200);
447   - if (m < nm) nm = m;
448   - else m = msta2(x,nm,15);
449   - bs = 0.0;
450   - su = 0.0;
451   - sv = 0.0;
452   - f2 = 0.0;
453   - f1 = 1.0e-100;
454   - for (k = m;k>=0;k--) {
455   - f = 2.0*(k+1.0)/x*f1 - f2;
456   - if (k <= nm) jn[k] = f;
457   - if ((k == 2*(int)(k/2)) && (k != 0)) {
458   - bs += 2.0*f;
459   -// su += pow(-1,k>>1)*f/(double)k;
460   - su += (-1)*((k & 2)-1)*f/(double)k;
461   - }
462   - else if (k > 1) {
463   -// sv += pow(-1,k>>1)*k*f/(k*k-1.0);
464   - sv += (-1)*((k & 2)-1)*(double)k*f/(k*k-1.0);
465   - }
466   - f2 = f1;
467   - f1 = f;
468   - }
469   - s0 = bs+f;
470   - for (k=0;k<=nm;k++) {
471   - jn[k] /= s0;
472   - }
473   - ec = log(0.5*x) +0.5772156649015329;
474   - by0 = M_2_PI*(ec*jn[0]-4.0*su/s0);
475   - yn[0] = by0;
476   - by1 = M_2_PI*((ec-1.0)*jn[1]-jn[0]/x-4.0*sv/s0);
477   - yn[1] = by1;
478   - }
479   - else {
480   - t1 = x-M_PI_4;
481   - p0 = 1.0;
482   - q0 = -0.125/x;
483   - for (k=0;k<4;k++) {
484   - p0 += a[k]*pow(x,-2*k-2);
485   - q0 += b[k]*pow(x,-2*k-3);
486   - }
487   - cu = sqrt(M_2_PI/x);
488   - bj0 = cu*(p0*cos(t1)-q0*sin(t1));
489   - by0 = cu*(p0*sin(t1)+q0*cos(t1));
490   - jn[0] = bj0;
491   - yn[0] = by0;
492   - t2 = x-0.75*M_PI;
493   - p1 = 1.0;
494   - q1 = 0.375/x;
495   - for (k=0;k<4;k++) {
496   - p1 += a1[k]*pow(x,-2*k-2);
497   - q1 += b1[k]*pow(x,-2*k-3);
498   - }
499   - bj1 = cu*(p1*cos(t2)-q1*sin(t2));
500   - by1 = cu*(p1*sin(t2)+q1*cos(t2));
501   - jn[1] = bj1;
502   - yn[1] = by1;
503   - for (k=2;k<=nm;k++) {
504   - bjk = 2.0*(k-1.0)*bj1/x-bj0;
505   - jn[k] = bjk;
506   - bj0 = bj1;
507   - bj1 = bjk;
508   - }
509   - }
510   - jnp[0] = -jn[1];
511   - for (k=1;k<=nm;k++) {
512   - jnp[k] = jn[k-1]-k*jn[k]/x;
513   - }
514   - for (k=2;k<=nm;k++) {
515   - byk = 2.0*(k-1.0)*by1/x-by0;
516   - yn[k] = byk;
517   - by0 = by1;
518   - by1 = byk;
519   - }
520   - ynp[0] = -yn[1];
521   - for (k=1;k<=nm;k++) {
522   - ynp[k] = yn[k-1]-k*yn[k]/x;
523   - }
524   - return 0;
525   -
526   -}
527   -
528   -// The following routine computes Bessel Jv(x) and Yv(x) for
529   -// arbitrary positive order (v). For negative order, use:
530   -//
531   -// J-v(x) = Jv(x)cos(v pi) - Yv(x)sin(v pi)
532   -// Y-v(x) = Jv(x)sin(v pi) + Yv(x)cos(v pi)
533   -//
534   -int bessjyv(double v,double x,double &vm,double *jv,double *yv,
535   - double *djv,double *dyv)
536   -{
537   - double v0,vl,vg,vv,a,a0,r,x2,bjv0,bjv1,bjvl,f,f0,f1,f2;
538   - double r0,r1,ck,cs,cs0,cs1,sk,qx,px,byv0,byv1,rp,xk,rq;
539   - double b,ec,w0,w1,bju0,bju1,pv0,pv1,byvk;
540   - int j,k,l,m,n,kz;
541   -
542   - x2 = x*x;
543   - n = (int)v;
544   - v0 = v-n;
545   - if ((x < 0.0) || (v < 0.0)) return 1;
546   - if (x < 1e-15) {
547   - for (k=0;k<=n;k++) {
548   - jv[k] = 0.0;
549   - yv[k] = -1e308;
550   - djv[k] = 0.0;
551   - dyv[k] = 1e308;
552   - if (v0 == 0.0) {
553   - jv[0] = 1.0;
554   - djv[1] = 0.5;
555   - }
556   - else djv[0] = 1e308;
557   - }
558   - vm = v;
559   - return 0;
560   - }
561   - if (x <= 12.0) {
562   - for (l=0;l<2;l++) {
563   - vl = v0 + l;
564   - bjvl = 1.0;
565   - r = 1.0;
566   - for (k=1;k<=40;k++) {
567   - r *= -0.25*x2/(k*(k+vl));
568   - bjvl += r;
569   - if (fabs(r) < fabs(bjvl)*1e-15) break;
570   - }
571   - vg = 1.0 + vl;
572   - a = pow(0.5*x,vl)/gamma(vg);
573   - if (l == 0) bjv0 = bjvl*a;
574   - else bjv1 = bjvl*a;
575   - }
576   - }
577   - else {
578   - if (x >= 50.0) kz = 8;
579   - else if (x >= 35.0) kz = 10;
580   - else kz = 11;
581   - for (j=0;j<2;j++) {
582   - vv = 4.0*(j+v0)*(j+v0);
583   - px = 1.0;
584   - rp = 1.0;
585   - for (k=1;k<=kz;k++) {
586   - rp *= (-0.78125e-2)*(vv-pow(4.0*k-3.0,2.0))*
587   - (vv-pow(4.0*k-1.0,2.0))/(k*(2.0*k-1.0)*x2);
588   - px += rp;
589   - }
590   - qx = 1.0;
591   - rq = 1.0;
592   - for (k=1;k<=kz;k++) {
593   - rq *= (-0.78125e-2)*(vv-pow(4.0*k-1.0,2.0))*
594   - (vv-pow(4.0*k+1.0,2.0))/(k*(2.0*k+1.0)*x2);
595   - qx += rq;
596   - }
597   - qx *= 0.125*(vv-1.0)/x;
598   - xk = x-(0.5*(j+v0)+0.25)*M_PI;
599   - a0 = sqrt(M_2_PI/x);
600   - ck = cos(xk);
601   - sk = sin(xk);
602   -
603   - if (j == 0) {
604   - bjv0 = a0*(px*ck-qx*sk);
605   - byv0 = a0*(px*sk+qx*ck);
606   - }
607   - else if (j == 1) {
608   - bjv1 = a0*(px*ck-qx*sk);
609   - byv1 = a0*(px*sk+qx*ck);
610   - }
611   - }
612   - }
613   - jv[0] = bjv0;
614   - jv[1] = bjv1;
615   - djv[0] = v0*jv[0]/x-jv[1];
616   - djv[1] = -(1.0+v0)*jv[1]/x+jv[0];
617   - if ((n >= 2) && (n <= (int)(0.9*x))) {
618   - f0 = bjv0;
619   - f1 = bjv1;
620   - for (k=2;k<=n;k++) {
621   - f = 2.0*(k+v0-1.0)*f1/x-f0;
622   - jv[k] = f;
623   - f0 = f1;
624   - f1 = f;
625   - }
626   - }
627   - else if (n >= 2) {
628   - m = msta1(x,200);
629   - if (m < n) n = m;
630   - else m = msta2(x,n,15);
631   - f2 = 0.0;
632   - f1 = 1.0e-100;
633   - for (k=m;k>=0;k--) {
634   - f = 2.0*(v0+k+1.0)*f1/x-f2;
635   - if (k <= n) jv[k] = f;
636   - f2 = f1;
637   - f1 = f;
638   - }
639   - if (fabs(bjv0) > fabs(bjv1)) cs = bjv0/f;
640   - else cs = bjv1/f2;
641   - for (k=0;k<=n;k++) {
642   - jv[k] *= cs;
643   - }
644   - }
645   - for (k=2;k<=n;k++) {
646   - djv[k] = -(k+v0)*jv[k]/x+jv[k-1];
647   - }
648   - if (x <= 12.0) {
649   - if (v0 != 0.0) {
650   - for (l=0;l<2;l++) {
651   - vl = v0 +l;
652   - bjvl = 1.0;
653   - r = 1.0;
654   - for (k=1;k<=40;k++) {
655   - r *= -0.25*x2/(k*(k-vl));
656   - bjvl += r;
657   - if (fabs(r) < fabs(bjvl)*1e-15) break;
658   - }
659   - vg = 1.0-vl;
660   - b = pow(2.0/x,vl)/gamma(vg);
661   - if (l == 0) bju0 = bjvl*b;
662   - else bju1 = bjvl*b;
663   - }
664   - pv0 = M_PI*v0;
665   - pv1 = M_PI*(1.0+v0);
666   - byv0 = (bjv0*cos(pv0)-bju0)/sin(pv0);
667   - byv1 = (bjv1*cos(pv1)-bju1)/sin(pv1);
668   - }
669   - else {
670   - ec = log(0.5*x)+el;
671   - cs0 = 0.0;
672   - w0 = 0.0;
673   - r0 = 1.0;
674   - for (k=1;k<=30;k++) {
675   - w0 += 1.0/k;
676   - r0 *= -0.25*x2/(k*k);
677   - cs0 += r0*w0;
678   - }
679   - byv0 = M_2_PI*(ec*bjv0-cs0);
680   - cs1 = 1.0;
681   - w1 = 0.0;
682   - r1 = 1.0;
683   - for (k=1;k<=30;k++) {
684   - w1 += 1.0/k;
685   - r1 *= -0.25*x2/(k*(k+1));
686   - cs1 += r1*(2.0*w1+1.0/(k+1.0));
687   - }
688   - byv1 = M_2_PI*(ec*bjv1-1.0/x-0.25*x*cs1);
689   - }
690   - }
691   - yv[0] = byv0;
692   - yv[1] = byv1;
693   - for (k=2;k<=n;k++) {
694   - byvk = 2.0*(v0+k-1.0)*byv1/x-byv0;
695   - yv[k] = byvk;
696   - byv0 = byv1;
697   - byv1 = byvk;
698   - }
699   - dyv[0] = v0*yv[0]/x-yv[1];
700   - for (k=1;k<=n;k++) {
701   - dyv[k] = -(k+v0)*yv[k]/x+yv[k-1];
702   - }
703   - vm = n + v0;
704   - return 0;
705   -}
706   -
  1 +// bessjy.cpp -- computation of Bessel functions Jn, Yn and their
  2 +// derivatives. Algorithms and coefficient values from
  3 +// "Computation of Special Functions", Zhang and Jin, John
  4 +// Wiley and Sons, 1996.
  5 +//
  6 +// (C) 2003, C. Bond. All rights reserved.
  7 +//
  8 +// Note that 'math.h' provides (or should provide) values for:
  9 +// pi M_PI
  10 +// 2/pi M_2_PI
  11 +// pi/4 M_PI_4
  12 +// pi/2 M_PI_2
  13 +//
  14 +#define _USE_MATH_DEFINES
  15 +#include <math.h>
  16 +#include "bessel.h"
  17 +
  18 +double gamma(double x);
  19 +//
  20 +// INPUT:
  21 +// double x -- argument of Bessel function
  22 +//
  23 +// OUTPUT (via address pointers):
  24 +// double j0 -- Bessel function of 1st kind, 0th order
  25 +// double j1 -- Bessel function of 1st kind, 1st order
  26 +// double y0 -- Bessel function of 2nd kind, 0th order
  27 +// double y1 -- Bessel function of 2nd kind, 1st order
  28 +// double j0p -- derivative of Bessel function of 1st kind, 0th order
  29 +// double j1p -- derivative of Bessel function of 1st kind, 1st order
  30 +// double y0p -- derivative of Bessel function of 2nd kind, 0th order
  31 +// double y1p -- derivative of Bessel function of 2nd kind, 1st order
  32 +//
  33 +// RETURN:
  34 +// int error code: 0 = OK, 1 = error
  35 +//
  36 +// This algorithm computes the above functions using series expansions.
  37 +//
  38 +int bessjy01a(double x,double &j0,double &j1,double &y0,double &y1,
  39 + double &j0p,double &j1p,double &y0p,double &y1p)
  40 +{
  41 + double x2,r,ec,w0,w1,r0,r1,cs0,cs1;
  42 + double cu,p0,q0,p1,q1,t1,t2;
  43 + int k,kz;
  44 + static double a[] = {
  45 + -7.03125e-2,
  46 + 0.112152099609375,
  47 + -0.5725014209747314,
  48 + 6.074042001273483,
  49 + -1.100171402692467e2,
  50 + 3.038090510922384e3,
  51 + -1.188384262567832e5,
  52 + 6.252951493434797e6,
  53 + -4.259392165047669e8,
  54 + 3.646840080706556e10,
  55 + -3.833534661393944e12,
  56 + 4.854014686852901e14,
  57 + -7.286857349377656e16,
  58 + 1.279721941975975e19
  59 + };
  60 + static double b[] = {
  61 + 7.32421875e-2,
  62 + -0.2271080017089844,
  63 + 1.727727502584457,
  64 + -2.438052969955606e1,
  65 + 5.513358961220206e2,
  66 + -1.825775547429318e4,
  67 + 8.328593040162893e5,
  68 + -5.006958953198893e7,
  69 + 3.836255180230433e9,
  70 + -3.649010818849833e11,
  71 + 4.218971570284096e13,
  72 + -5.827244631566907e15,
  73 + 9.476288099260110e17,
  74 + -1.792162323051699e20
  75 + };
  76 + static double a1[] = {
  77 + 0.1171875,
  78 + -0.1441955566406250,
  79 + 0.6765925884246826,
  80 + -6.883914268109947,
  81 + 1.215978918765359e2,
  82 + -3.302272294480852e3,
  83 + 1.276412726461746e5,
  84 + -6.656367718817688e6,
  85 + 4.502786003050393e8,
  86 + -3.833857520742790e10,
  87 + 4.011838599133198e12,
  88 + -5.060568503314727e14,
  89 + 7.572616461117958e16,
  90 + -1.326257285320556e19
  91 + };
  92 + static double b1[] = {
  93 + -0.1025390625,
  94 + 0.2775764465332031,
  95 + -1.993531733751297,
  96 + 2.724882731126854e1,
  97 + -6.038440767050702e2,
  98 + 1.971837591223663e4,
  99 + -8.902978767070678e5,
  100 + 5.310411010968522e7,
  101 + -4.043620325107754e9,
  102 + 3.827011346598605e11,
  103 + -4.406481417852278e13,
  104 + 6.065091351222699e15,
  105 + -9.833883876590679e17,
  106 + 1.855045211579828e20
  107 + };
  108 +
  109 + if (x < 0.0) return 1;
  110 + if (x == 0.0) {
  111 + j0 = 1.0;
  112 + j1 = 0.0;
  113 + y0 = -1e308;
  114 + y1 = -1e308;
  115 + j0p = 0.0;
  116 + j1p = 0.5;
  117 + y0p = 1e308;
  118 + y1p = 1e308;
  119 + return 0;
  120 + }
  121 + x2 = x*x;
  122 + if (x <= 12.0) {
  123 + j0 = 1.0;
  124 + r = 1.0;
  125 + for (k=1; k<=30; k++) {
  126 + r *= -0.25*x2/(k*k);
  127 + j0 += r;
  128 + if (fabs(r) < fabs(j0)*1e-15) break;
  129 + }
  130 + j1 = 1.0;
  131 + r = 1.0;
  132 + for (k=1; k<=30; k++) {
  133 + r *= -0.25*x2/(k*(k+1));
  134 + j1 += r;
  135 + if (fabs(r) < fabs(j1)*1e-15) break;
  136 + }
  137 + j1 *= 0.5*x;
  138 + ec = log(0.5*x)+el;
  139 + cs0 = 0.0;
  140 + w0 = 0.0;
  141 + r0 = 1.0;
  142 + for (k=1; k<=30; k++) {
  143 + w0 += 1.0/k;
  144 + r0 *= -0.25*x2/(k*k);
  145 + r = r0 * w0;
  146 + cs0 += r;
  147 + if (fabs(r) < fabs(cs0)*1e-15) break;
  148 + }
  149 + y0 = M_2_PI*(ec*j0-cs0);
  150 + cs1 = 1.0;
  151 + w1 = 0.0;
  152 + r1 = 1.0;
  153 + for (k=1; k<=30; k++) {
  154 + w1 += 1.0/k;
  155 + r1 *= -0.25*x2/(k*(k+1));
  156 + r = r1*(2.0*w1+1.0/(k+1));
  157 + cs1 += r;
  158 + if (fabs(r) < fabs(cs1)*1e-15) break;
  159 + }
  160 + y1 = M_2_PI * (ec*j1-1.0/x-0.25*x*cs1);
  161 + }
  162 + else {
  163 + if (x >= 50.0) kz = 8; // Can be changed to 10
  164 + else if (x >= 35.0) kz = 10; // " " 12
  165 + else kz = 12; // " " 14
  166 + t1 = x-M_PI_4;
  167 + p0 = 1.0;
  168 + q0 = -0.125/x;
  169 + for (k=0; k<kz; k++) {
  170 + p0 += a[k]*pow(x,-2*k-2);
  171 + q0 += b[k]*pow(x,-2*k-3);
  172 + }
  173 + cu = sqrt(M_2_PI/x);
  174 + j0 = cu*(p0*cos(t1)-q0*sin(t1));
  175 + y0 = cu*(p0*sin(t1)+q0*cos(t1));
  176 + t2 = x-0.75*M_PI;
  177 + p1 = 1.0;
  178 + q1 = 0.375/x;
  179 + for (k=0; k<kz; k++) {
  180 + p1 += a1[k]*pow(x,-2*k-2);
  181 + q1 += b1[k]*pow(x,-2*k-3);
  182 + }
  183 + j1 = cu*(p1*cos(t2)-q1*sin(t2));
  184 + y1 = cu*(p1*sin(t2)+q1*cos(t2));
  185 + }
  186 + j0p = -j1;
  187 + j1p = j0-j1/x;
  188 + y0p = -y1;
  189 + y1p = y0-y1/x;
  190 + return 0;
  191 +}
  192 +//
  193 +// INPUT:
  194 +// double x -- argument of Bessel function
  195 +//
  196 +// OUTPUT:
  197 +// double j0 -- Bessel function of 1st kind, 0th order
  198 +// double j1 -- Bessel function of 1st kind, 1st order
  199 +// double y0 -- Bessel function of 2nd kind, 0th order
  200 +// double y1 -- Bessel function of 2nd kind, 1st order
  201 +// double j0p -- derivative of Bessel function of 1st kind, 0th order
  202 +// double j1p -- derivative of Bessel function of 1st kind, 1st order
  203 +// double y0p -- derivative of Bessel function of 2nd kind, 0th order
  204 +// double y1p -- derivative of Bessel function of 2nd kind, 1st order
  205 +//
  206 +// RETURN:
  207 +// int error code: 0 = OK, 1 = error
  208 +//
  209 +// This algorithm computes the functions using polynomial approximations.
  210 +//
  211 +int bessjy01b(double x,double &j0,double &j1,double &y0,double &y1,
  212 + double &j0p,double &j1p,double &y0p,double &y1p)
  213 +{
  214 + double t,t2,dtmp,a0,p0,q0,p1,q1,ta0,ta1;
  215 + if (x < 0.0) return 1;
  216 + if (x == 0.0) {
  217 + j0 = 1.0;
  218 + j1 = 0.0;
  219 + y0 = -1e308;
  220 + y1 = -1e308;
  221 + j0p = 0.0;
  222 + j1p = 0.5;
  223 + y0p = 1e308;
  224 + y1p = 1e308;
  225 + return 0;
  226 + }
  227 + if(x <= 4.0) {
  228 + t = x/4.0;
  229 + t2 = t*t;
  230 + j0 = ((((((-0.5014415e-3*t2+0.76771853e-2)*t2-0.0709253492)*t2+
  231 + 0.4443584263)*t2-1.7777560599)*t2+3.9999973021)*t2
  232 + -3.9999998721)*t2+1.0;
  233 + j1 = t*(((((((-0.1289769e-3*t2+0.22069155e-2)*t2-0.0236616773)*t2+
  234 + 0.1777582922)*t2-0.8888839649)*t2+2.6666660544)*t2-
  235 + 3.999999971)*t2+1.9999999998);
  236 + dtmp = (((((((-0.567433e-4*t2+0.859977e-3)*t2-0.94855882e-2)*t2+
  237 + 0.0772975809)*t2-0.4261737419)*t2+1.4216421221)*t2-
  238 + 2.3498519931)*t2+1.0766115157)*t2+0.3674669052;
  239 + y0 = M_2_PI*log(0.5*x)*j0+dtmp;
  240 + dtmp = (((((((0.6535773e-3*t2-0.0108175626)*t2+0.107657607)*t2-
  241 + 0.7268945577)*t2+3.1261399273)*t2-7.3980241381)*t2+
  242 + 6.8529236342)*t2+0.3932562018)*t2-0.6366197726;
  243 + y1 = M_2_PI*log(0.5*x)*j1+dtmp/x;
  244 + }
  245 + else {
  246 + t = 4.0/x;
  247 + t2 = t*t;
  248 + a0 = sqrt(M_2_PI/x);
  249 + p0 = ((((-0.9285e-5*t2+0.43506e-4)*t2-0.122226e-3)*t2+
  250 + 0.434725e-3)*t2-0.4394275e-2)*t2+0.999999997;
  251 + q0 = t*(((((0.8099e-5*t2-0.35614e-4)*t2+0.85844e-4)*t2-
  252 + 0.218024e-3)*t2+0.1144106e-2)*t2-0.031249995);
  253 + ta0 = x-M_PI_4;
  254 + j0 = a0*(p0*cos(ta0)-q0*sin(ta0));
  255 + y0 = a0*(p0*sin(ta0)+q0*cos(ta0));
  256 + p1 = ((((0.10632e-4*t2-0.50363e-4)*t2+0.145575e-3)*t2
  257 + -0.559487e-3)*t2+0.7323931e-2)*t2+1.000000004;
  258 + q1 = t*(((((-0.9173e-5*t2+0.40658e-4)*t2-0.99941e-4)*t2
  259 + +0.266891e-3)*t2-0.1601836e-2)*t2+0.093749994);
  260 + ta1 = x-0.75*M_PI;
  261 + j1 = a0*(p1*cos(ta1)-q1*sin(ta1));
  262 + y1 = a0*(p1*sin(ta1)+q1*cos(ta1));
  263 + }
  264 + j0p = -j1;
  265 + j1p = j0-j1/x;
  266 + y0p = -y1;
  267 + y1p = y0-y1/x;
  268 + return 0;
  269 +}
  270 +int msta1(double x,int mp)
  271 +{
  272 + double a0,f0,f1,f;
  273 + int i,n0,n1,nn;
  274 +
  275 + a0 = fabs(x);
  276 + n0 = (int)(1.1*a0)+1;
  277 + f0 = 0.5*log10(6.28*n0)-n0*log10(1.36*a0/n0)-mp;
  278 + n1 = n0+5;
  279 + f1 = 0.5*log10(6.28*n1)-n1*log10(1.36*a0/n1)-mp;
  280 + for (i=0; i<20; i++) {
  281 + nn = (int)(n1-(n1-n0)/(1.0-f0/f1));
  282 + f = 0.5*log10(6.28*nn)-nn*log10(1.36*a0/nn)-mp;
  283 + if (abs(nn-n1) < 1) break;
  284 + n0 = n1;
  285 + f0 = f1;
  286 + n1 = nn;
  287 + f1 = f;
  288 + }
  289 + return nn;
  290 +}
  291 +int msta2(double x,int n,int mp)
  292 +{
  293 + double a0,ejn,hmp,f0,f1,f,obj;
  294 + int i,n0,n1,nn;
  295 +
  296 + a0 = fabs(x);
  297 + hmp = 0.5*mp;
  298 + ejn = 0.5*log10(6.28*n)-n*log10(1.36*a0/n);
  299 + if (ejn <= hmp) {
  300 + obj = mp;
  301 + n0 = (int)(1.1*a0);
  302 + if (n0 < 1) n0 = 1;
  303 + }
  304 + else {
  305 + obj = hmp+ejn;
  306 + n0 = n;
  307 + }
  308 + f0 = 0.5*log10(6.28*n0)-n0*log10(1.36*a0/n0)-obj;
  309 + n1 = n0+5;
  310 + f1 = 0.5*log10(6.28*n1)-n1*log10(1.36*a0/n1)-obj;
  311 + for (i=0; i<20; i++) {
  312 + nn = (int)(n1-(n1-n0)/(1.0-f0/f1));
  313 + f = 0.5*log10(6.28*nn)-nn*log10(1.36*a0/nn)-obj;
  314 + if (abs(nn-n1) < 1) break;
  315 + n0 = n1;
  316 + f0 = f1;
  317 + n1 = nn;
  318 + f1 = f;
  319 + }
  320 + return nn+10;
  321 +}
  322 +//
  323 +// INPUT:
  324 +// double x -- argument of Bessel function of 1st and 2nd kind.
  325 +// int n -- order
  326 +//
  327 +// OUPUT:
  328 +//
  329 +// int nm -- highest order actually computed (nm <= n)
  330 +// double jn[] -- Bessel function of 1st kind, orders from 0 to nm
  331 +// double yn[] -- Bessel function of 2nd kind, orders from 0 to nm
  332 +// double j'n[]-- derivative of Bessel function of 1st kind,
  333 +// orders from 0 to nm
  334 +// double y'n[]-- derivative of Bessel function of 2nd kind,
  335 +// orders from 0 to nm
  336 +//
  337 +// Computes Bessel functions of all order up to 'n' using recurrence
  338 +// relations. If 'nm' < 'n' only 'nm' orders are returned.
  339 +//
  340 +int bessjyna(int n,double x,int &nm,double *jn,double *yn,
  341 + double *jnp,double *ynp)
  342 +{
  343 + double bj0,bj1,f,f0,f1,f2,cs;
  344 + int i,k,m,ecode;
  345 +
  346 + nm = n;
  347 + if ((x < 0.0) || (n < 0)) return 1;
  348 + if (x < 1e-15) {
  349 + for (i=0; i<=n; i++) {
  350 + jn[i] = 0.0;
  351 + yn[i] = -1e308;
  352 + jnp[i] = 0.0;
  353 + ynp[i] = 1e308;
  354 + }
  355 + jn[0] = 1.0;
  356 + jnp[1] = 0.5;
  357 + return 0;
  358 + }
  359 + ecode = bessjy01a(x,jn[0],jn[1],yn[0],yn[1],jnp[0],jnp[1],ynp[0],ynp[1]);
  360 + if (n < 2) return 0;
  361 + bj0 = jn[0];
  362 + bj1 = jn[1];
  363 + if (n < (int)0.9*x) {
  364 + for (k=2; k<=n; k++) {
  365 + jn[k] = 2.0*(k-1.0)*bj1/x-bj0;
  366 + bj0 = bj1;
  367 + bj1 = jn[k];
  368 + }
  369 + }
  370 + else {
  371 + m = msta1(x,200);
  372 + if (m < n) nm = m;
  373 + else m = msta2(x,n,15);
  374 + f2 = 0.0;
  375 + f1 = 1.0e-100;
  376 + for (k=m; k>=0; k--) {
  377 + f = 2.0*(k+1.0)/x*f1-f2;
  378 + if (k <= nm) jn[k] = f;
  379 + f2 = f1;
  380 + f1 = f;
  381 + }
  382 + if (fabs(bj0) > fabs(bj1)) cs = bj0/f;
  383 + else cs = bj1/f2;
  384 + for (k=0; k<=nm; k++) {
  385 + jn[k] *= cs;
  386 + }
  387 + }
  388 + for (k=2; k<=nm; k++) {
  389 + jnp[k] = jn[k-1]-k*jn[k]/x;
  390 + }
  391 + f0 = yn[0];
  392 + f1 = yn[1];
  393 + for (k=2; k<=nm; k++) {
  394 + f = 2.0*(k-1.0)*f1/x-f0;
  395 + yn[k] = f;
  396 + f0 = f1;
  397 + f1 = f;
  398 + }
  399 + for (k=2; k<=nm; k++) {
  400 + ynp[k] = yn[k-1]-k*yn[k]/x;
  401 + }
  402 + return 0;
  403 +}
  404 +//
  405 +// Same input and output conventions as above. Different recurrence
  406 +// relations used for 'x' < 300.
  407 +//
  408 +int bessjynb(int n,double x,int &nm,double *jn,double *yn,
  409 + double *jnp,double *ynp)
  410 +{
  411 + double t1,t2,f,f1,f2,bj0,bj1,bjk,by0,by1,cu,s0,su,sv;
  412 + double ec,bs,byk,p0,p1,q0,q1;
  413 + static double a[] = {
  414 + -0.7031250000000000e-1,
  415 + 0.1121520996093750,
  416 + -0.5725014209747314,
  417 + 6.074042001273483
  418 + };
  419 + static double b[] = {
  420 + 0.7324218750000000e-1,
  421 + -0.2271080017089844,
  422 + 1.727727502584457,
  423 + -2.438052969955606e1
  424 + };
  425 + static double a1[] = {
  426 + 0.1171875,
  427 + -0.1441955566406250,
  428 + 0.6765925884246826,
  429 + -6.883914268109947
  430 + };
  431 + static double b1[] = {
  432 + -0.1025390625,
  433 + 0.2775764465332031,
  434 + -1.993531733751297,
  435 + 2.724882731126854e1
  436 + };
  437 +
  438 + int i,k,m;
  439 + nm = n;
  440 + if ((x < 0.0) || (n < 0)) return 1;
  441 + if (x < 1e-15) {
  442 + for (i=0; i<=n; i++) {
  443 + jn[i] = 0.0;
  444 + yn[i] = -1e308;
  445 + jnp[i] = 0.0;
  446 + ynp[i] = 1e308;
  447 + }
  448 + jn[0] = 1.0;
  449 + jnp[1] = 0.5;
  450 + return 0;
  451 + }
  452 + if (x <= 300.0 || n > (int)(0.9*x)) {
  453 + if (n == 0) nm = 1;
  454 + m = msta1(x,200);
  455 + if (m < nm) nm = m;
  456 + else m = msta2(x,nm,15);
  457 + bs = 0.0;
  458 + su = 0.0;
  459 + sv = 0.0;
  460 + f2 = 0.0;
  461 + f1 = 1.0e-100;
  462 + for (k = m; k>=0; k--) {
  463 + f = 2.0*(k+1.0)/x*f1 - f2;
  464 + if (k <= nm) jn[k] = f;
  465 + if ((k == 2*(int)(k/2)) && (k != 0)) {
  466 + bs += 2.0*f;
  467 +// su += pow(-1,k>>1)*f/(double)k;
  468 + su += (-1)*((k & 2)-1)*f/(double)k;
  469 + }
  470 + else if (k > 1) {
  471 +// sv += pow(-1,k>>1)*k*f/(k*k-1.0);
  472 + sv += (-1)*((k & 2)-1)*(double)k*f/(k*k-1.0);
  473 + }
  474 + f2 = f1;
  475 + f1 = f;
  476 + }
  477 + s0 = bs+f;
  478 + for (k=0; k<=nm; k++) {
  479 + jn[k] /= s0;
  480 + }
  481 + ec = log(0.5*x) +0.5772156649015329;
  482 + by0 = M_2_PI*(ec*jn[0]-4.0*su/s0);
  483 + yn[0] = by0;
  484 + by1 = M_2_PI*((ec-1.0)*jn[1]-jn[0]/x-4.0*sv/s0);
  485 + yn[1] = by1;
  486 + }
  487 + else {
  488 + t1 = x-M_PI_4;
  489 + p0 = 1.0;
  490 + q0 = -0.125/x;
  491 + for (k=0; k<4; k++) {
  492 + p0 += a[k]*pow(x,-2*k-2);
  493 + q0 += b[k]*pow(x,-2*k-3);
  494 + }
  495 + cu = sqrt(M_2_PI/x);
  496 + bj0 = cu*(p0*cos(t1)-q0*sin(t1));
  497 + by0 = cu*(p0*sin(t1)+q0*cos(t1));
  498 + jn[0] = bj0;
  499 + yn[0] = by0;
  500 + t2 = x-0.75*M_PI;
  501 + p1 = 1.0;
  502 + q1 = 0.375/x;
  503 + for (k=0; k<4; k++) {
  504 + p1 += a1[k]*pow(x,-2*k-2);
  505 + q1 += b1[k]*pow(x,-2*k-3);
  506 + }
  507 + bj1 = cu*(p1*cos(t2)-q1*sin(t2));
  508 + by1 = cu*(p1*sin(t2)+q1*cos(t2));
  509 + jn[1] = bj1;
  510 + yn[1] = by1;
  511 + for (k=2; k<=nm; k++) {
  512 + bjk = 2.0*(k-1.0)*bj1/x-bj0;
  513 + jn[k] = bjk;
  514 + bj0 = bj1;
  515 + bj1 = bjk;
  516 + }
  517 + }
  518 + jnp[0] = -jn[1];
  519 + for (k=1; k<=nm; k++) {
  520 + jnp[k] = jn[k-1]-k*jn[k]/x;
  521 + }
  522 + for (k=2; k<=nm; k++) {
  523 + byk = 2.0*(k-1.0)*by1/x-by0;
  524 + yn[k] = byk;
  525 + by0 = by1;
  526 + by1 = byk;
  527 + }
  528 + ynp[0] = -yn[1];
  529 + for (k=1; k<=nm; k++) {
  530 + ynp[k] = yn[k-1]-k*yn[k]/x;
  531 + }
  532 + return 0;
  533 +
  534 +}
  535 +
  536 +// The following routine computes Bessel Jv(x) and Yv(x) for
  537 +// arbitrary positive order (v). For negative order, use:
  538 +//
  539 +// J-v(x) = Jv(x)cos(v pi) - Yv(x)sin(v pi)
  540 +// Y-v(x) = Jv(x)sin(v pi) + Yv(x)cos(v pi)
  541 +//
  542 +int bessjyv(double v,double x,double &vm,double *jv,double *yv,
  543 + double *djv,double *dyv)
  544 +{
  545 + double v0,vl,vg,vv,a,a0,r,x2,bjv0,bjv1,bjvl,f,f0,f1,f2;
  546 + double r0,r1,ck,cs,cs0,cs1,sk,qx,px,byv0,byv1,rp,xk,rq;
  547 + double b,ec,w0,w1,bju0,bju1,pv0,pv1,byvk;
  548 + int j,k,l,m,n,kz;
  549 +
  550 + x2 = x*x;
  551 + n = (int)v;
  552 + v0 = v-n;
  553 + if ((x < 0.0) || (v < 0.0)) return 1;
  554 + if (x < 1e-15) {
  555 + for (k=0; k<=n; k++) {
  556 + jv[k] = 0.0;
  557 + yv[k] = -1e308;
  558 + djv[k] = 0.0;
  559 + dyv[k] = 1e308;
  560 + if (v0 == 0.0) {
  561 + jv[0] = 1.0;
  562 + djv[1] = 0.5;
  563 + }
  564 + else djv[0] = 1e308;
  565 + }
  566 + vm = v;
  567 + return 0;
  568 + }
  569 + if (x <= 12.0) {
  570 + for (l=0; l<2; l++) {
  571 + vl = v0 + l;
  572 + bjvl = 1.0;
  573 + r = 1.0;
  574 + for (k=1; k<=40; k++) {
  575 + r *= -0.25*x2/(k*(k+vl));
  576 + bjvl += r;
  577 + if (fabs(r) < fabs(bjvl)*1e-15) break;
  578 + }
  579 + vg = 1.0 + vl;
  580 + a = pow(0.5*x,vl)/gamma(vg);
  581 + if (l == 0) bjv0 = bjvl*a;
  582 + else bjv1 = bjvl*a;
  583 + }
  584 + }
  585 + else {
  586 + if (x >= 50.0) kz = 8;
  587 + else if (x >= 35.0) kz = 10;
  588 + else kz = 11;
  589 + for (j=0; j<2; j++) {
  590 + vv = 4.0*(j+v0)*(j+v0);
  591 + px = 1.0;
  592 + rp = 1.0;
  593 + for (k=1; k<=kz; k++) {
  594 + rp *= (-0.78125e-2)*(vv-pow(4.0*k-3.0,2.0))*
  595 + (vv-pow(4.0*k-1.0,2.0))/(k*(2.0*k-1.0)*x2);
  596 + px += rp;
  597 + }
  598 + qx = 1.0;
  599 + rq = 1.0;
  600 + for (k=1; k<=kz; k++) {
  601 + rq *= (-0.78125e-2)*(vv-pow(4.0*k-1.0,2.0))*
  602 + (vv-pow(4.0*k+1.0,2.0))/(k*(2.0*k+1.0)*x2);
  603 + qx += rq;
  604 + }
  605 + qx *= 0.125*(vv-1.0)/x;
  606 + xk = x-(0.5*(j+v0)+0.25)*M_PI;
  607 + a0 = sqrt(M_2_PI/x);
  608 + ck = cos(xk);
  609 + sk = sin(xk);
  610 +
  611 + if (j == 0) {
  612 + bjv0 = a0*(px*ck-qx*sk);
  613 + byv0 = a0*(px*sk+qx*ck);
  614 + }
  615 + else if (j == 1) {
  616 + bjv1 = a0*(px*ck-qx*sk);
  617 + byv1 = a0*(px*sk+qx*ck);
  618 + }
  619 + }
  620 + }
  621 + jv[0] = bjv0;
  622 + jv[1] = bjv1;
  623 + djv[0] = v0*jv[0]/x-jv[1];
  624 + djv[1] = -(1.0+v0)*jv[1]/x+jv[0];
  625 + if ((n >= 2) && (n <= (int)(0.9*x))) {
  626 + f0 = bjv0;
  627 + f1 = bjv1;
  628 + for (k=2; k<=n; k++) {
  629 + f = 2.0*(k+v0-1.0)*f1/x-f0;
  630 + jv[k] = f;
  631 + f0 = f1;
  632 + f1 = f;
  633 + }
  634 + }
  635 + else if (n >= 2) {
  636 + m = msta1(x,200);
  637 + if (m < n) n = m;
  638 + else m = msta2(x,n,15);
  639 + f2 = 0.0;
  640 + f1 = 1.0e-100;
  641 + for (k=m; k>=0; k--) {
  642 + f = 2.0*(v0+k+1.0)*f1/x-f2;
  643 + if (k <= n) jv[k] = f;
  644 + f2 = f1;
  645 + f1 = f;
  646 + }
  647 + if (fabs(bjv0) > fabs(bjv1)) cs = bjv0/f;
  648 + else cs = bjv1/f2;
  649 + for (k=0; k<=n; k++) {
  650 + jv[k] *= cs;
  651 + }
  652 + }
  653 + for (k=2; k<=n; k++) {
  654 + djv[k] = -(k+v0)*jv[k]/x+jv[k-1];
  655 + }
  656 + if (x <= 12.0) {
  657 + if (v0 != 0.0) {
  658 + for (l=0; l<2; l++) {
  659 + vl = v0 +l;
  660 + bjvl = 1.0;
  661 + r = 1.0;
  662 + for (k=1; k<=40; k++) {
  663 + r *= -0.25*x2/(k*(k-vl));
  664 + bjvl += r;
  665 + if (fabs(r) < fabs(bjvl)*1e-15) break;
  666 + }
  667 + vg = 1.0-vl;
  668 + b = pow(2.0/x,vl)/gamma(vg);
  669 + if (l == 0) bju0 = bjvl*b;
  670 + else bju1 = bjvl*b;
  671 + }
  672 + pv0 = M_PI*v0;
  673 + pv1 = M_PI*(1.0+v0);
  674 + byv0 = (bjv0*cos(pv0)-bju0)/sin(pv0);
  675 + byv1 = (bjv1*cos(pv1)-bju1)/sin(pv1);
  676 + }
  677 + else {
  678 + ec = log(0.5*x)+el;
  679 + cs0 = 0.0;
  680 + w0 = 0.0;
  681 + r0 = 1.0;
  682 + for (k=1; k<=30; k++) {
  683 + w0 += 1.0/k;
  684 + r0 *= -0.25*x2/(k*k);
  685 + cs0 += r0*w0;
  686 + }
  687 + byv0 = M_2_PI*(ec*bjv0-cs0);
  688 + cs1 = 1.0;
  689 + w1 = 0.0;
  690 + r1 = 1.0;
  691 + for (k=1; k<=30; k++) {
  692 + w1 += 1.0/k;
  693 + r1 *= -0.25*x2/(k*(k+1));
  694 + cs1 += r1*(2.0*w1+1.0/(k+1.0));
  695 + }
  696 + byv1 = M_2_PI*(ec*bjv1-1.0/x-0.25*x*cs1);
  697 + }
  698 + }
  699 + yv[0] = byv0;
  700 + yv[1] = byv1;
  701 + for (k=2; k<=n; k++) {
  702 + byvk = 2.0*(v0+k-1.0)*byv1/x-byv0;
  703 + yv[k] = byvk;
  704 + byv0 = byv1;
  705 + byv1 = byvk;
  706 + }
  707 + dyv[0] = v0*yv[0]/x-yv[1];
  708 + for (k=1; k<=n; k++) {
  709 + dyv[k] = -(k+v0)*yv[k]/x+yv[k-1];
  710 + }
  711 + vm = n + v0;
  712 + return 0;
  713 +}
  714 +
... ...
cbessik.cpp
1   -// cbessik.cpp -- complex modified Bessel functions.
2   -// Algorithms and coefficient values from "Computation of Special
3   -// Functions", Zhang and Jin, John Wiley and Sons, 1996.
4   -//
5   -// (C) 2003, C. Bond. All rights reserved.
6   -//
7   -#include <complex>
8   -using namespace std;
9   -#include "bessel.h"
10   -
11   -static complex<double> cii(0.0,1.0);
12   -static complex<double> czero(0.0,0.0);
13   -static complex<double> cone(1.0,0.0);
14   -
15   -double gamma(double x);
16   -
17   -int cbessik01(complex<double>z,complex<double>&ci0,complex<double>&ci1,
18   - complex<double>&ck0,complex<double>&ck1,complex<double>&ci0p,
19   - complex<double>&ci1p,complex<double>&ck0p,complex<double>&ck1p)
20   -{
21   - complex<double> z1,z2,zr,zr2,cr,ca,cb,cs,ct,cw;
22   - double a0,w0;
23   - int k,kz;
24   - static double a[] = {
25   - 0.125,
26   - 7.03125e-2,
27   - 7.32421875e-2,
28   - 1.1215209960938e-1,
29   - 2.2710800170898e-1,
30   - 5.7250142097473e-1,
31   - 1.7277275025845,
32   - 6.0740420012735,
33   - 2.4380529699556e1,
34   - 1.1001714026925e2,
35   - 5.5133589612202e2,
36   - 3.0380905109224e3};
37   - static double b[] = {
38   - -0.375,
39   - -1.171875e-1,
40   - -1.025390625e-1,
41   - -1.4419555664063e-1,
42   - -2.7757644653320e-1,
43   - -6.7659258842468e-1,
44   - -1.9935317337513,
45   - -6.8839142681099,
46   - -2.7248827311269e1,
47   - -1.2159789187654e2,
48   - -6.0384407670507e2,
49   - -3.3022722944809e3};
50   - static double a1[] = {
51   - 0.125,
52   - 0.2109375,
53   - 1.0986328125,
54   - 1.1775970458984e1,
55   - 2.1461706161499e2,
56   - 5.9511522710323e3,
57   - 2.3347645606175e5,
58   - 1.2312234987631e7,
59   - 8.401390346421e08,
60   - 7.2031420482627e10};
61   -
62   - a0 = abs(z);
63   - z2 = z*z;
64   - z1 = z;
65   - if (a0 == 0.0) {
66   - ci0 = cone;
67   - ci1 = czero;
68   - ck0 = complex<double> (1e308,0);
69   - ck1 = complex<double> (1e308,0);
70   - ci0p = czero;
71   - ci1p = complex<double>(0.5,0.0);
72   - ck0p = complex<double>(-1e308,0);
73   - ck1p = complex<double>(-1e308,0);
74   - return 0;
75   - }
76   - if (real(z) < 0.0) z1 = -z;
77   - if (a0 <= 18.0) {
78   - ci0 = cone;
79   - cr = cone;
80   - for (k=1;k<=50;k++) {
81   - cr *= 0.25*z2/(double)(k*k);
82   - ci0 += cr;
83   - if (abs(cr/ci0) < eps) break;
84   - }
85   - ci1 = cone;
86   - cr = cone;
87   - for (k=1;k<=50;k++) {
88   - cr *= 0.25*z2/(double)(k*(k+1.0));
89   - ci1 += cr;
90   - if (abs(cr/ci1) < eps) break;
91   - }
92   - ci1 *= 0.5*z1;
93   - }
94   - else {
95   - if (a0 >= 50.0) kz = 7;
96   - else if (a0 >= 35.0) kz = 9;
97   - else kz = 12;
98   - ca = exp(z1)/sqrt(2.0*M_PI*z1);
99   - ci0 = cone;
100   - zr = 1.0/z1;
101   - for (k=0;k<kz;k++) {
102   - ci0 += a[k]*pow(zr,k+1.0);
103   - }
104   - ci0 *= ca;
105   - ci1 = cone;
106   - for (k=0;k<kz;k++) {
107   - ci1 += b[k]*pow(zr,k+1.0);
108   - }
109   - ci1 *= ca;
110   - }
111   - if (a0 <= 9.0) {
112   - cs = czero;
113   - ct = -log(0.5*z1)-el;
114   - w0 = 0.0;
115   - cr = cone;
116   - for (k=1;k<=50;k++) {
117   - w0 += 1.0/k;
118   - cr *= 0.25*z2/(double)(k*k);
119   - cs += cr*(w0+ct);
120   - if (abs((cs-cw)/cs) < eps) break;
121   - cw = cs;
122   - }
123   - ck0 = ct+cs;
124   - }
125   - else {
126   - cb = 0.5/z1;
127   - zr2 = 1.0/z2;
128   - ck0 = cone;
129   - for (k=0;k<10;k++) {
130   - ck0 += a1[k]*pow(zr2,k+1.0);
131   - }
132   - ck0 *= cb/ci0;
133   - }
134   - ck1 = (1.0/z1 - ci1*ck0)/ci0;
135   - if (real(z) < 0.0) {
136   - if (imag(z) < 0.0) {
137   - ck0 += cii*M_PI*ci0;
138   - ck1 = -ck1+cii*M_PI*ci1;
139   - }
140   - else if (imag(z) > 0.0) {
141   - ck0 -= cii*M_PI*ci0;
142   - ck1 = -ck1-cii*M_PI*ci1;
143   - }
144   - ci1 = -ci1;
145   - }
146   - ci0p = ci1;
147   - ci1p = ci0-1.0*ci1/z;
148   - ck0p = -ck1;
149   - ck1p = -ck0-1.0*ck1/z;
150   - return 0;
151   -}
152   -int cbessikna(int n,complex<double> z,int &nm,complex<double> *ci,
153   - complex<double> *ck,complex<double> *cip,complex<double> *ckp)
154   -{
155   - complex<double> ci0,ci1,ck0,ck1,ckk,cf,cf1,cf2,cs;
156   - double a0;
157   - int k,m,ecode;
158   - a0 = abs(z);
159   - nm = n;
160   - if (a0 < 1.0e-100) {
161   - for (k=0;k<=n;k++) {
162   - ci[k] = czero;
163   - ck[k] = complex<double>(-1e308,0);
164   - cip[k] = czero;
165   - ckp[k] = complex<double>(1e308,0);
166   - }
167   - ci[0] = cone;
168   - cip[1] = complex<double>(0.5,0.0);
169   - return 0;
170   - }
171   - ecode = cbessik01(z,ci[0],ci[1],ck[0],ck[1],cip[0],cip[1],ckp[0],ckp[1]);
172   - if (n < 2) return 0;
173   - ci0 = ci[0];
174   - ci1 = ci[1];
175   - ck0 = ck[0];
176   - ck1 = ck[1];
177   - m = msta1(a0,200);
178   - if (m < n) nm = m;
179   - else m = msta2(a0,n,15);
180   - cf2 = czero;
181   - cf1 = complex<double>(1.0e-100,0.0);
182   - for (k=m;k>=0;k--) {
183   - cf = 2.0*(k+1.0)*cf1/z+cf2;
184   - if (k <= nm) ci[k] = cf;
185   - cf2 = cf1;
186   - cf1 = cf;
187   - }
188   - cs = ci0/cf;
189   - for (k=0;k<=nm;k++) {
190   - ci[k] *= cs;
191   - }
192   - for (k=2;k<=nm;k++) {
193   - if (abs(ci[k-1]) > abs(ci[k-2])) {
194   - ckk = (1.0/z-ci[k]*ck[k-1])/ci[k-1];
195   - }
196   - else {
197   - ckk = (ci[k]*ck[k-2]+2.0*(k-1.0)/(z*z))/ci[k-2];
198   - }
199   - ck[k] = ckk;
200   - }
201   - for (k=2;k<=nm;k++) {
202   - cip[k] = ci[k-1]-(double)k*ci[k]/z;
203   - ckp[k] = -ck[k-1]-(double)k*ck[k]/z;
204   - }
205   - return 0;
206   -}
207   -int cbessiknb(int n,complex<double> z,int &nm,complex<double> *ci,
208   - complex<double> *ck,complex<double> *cip,complex<double> *ckp)
209   -{
210   - complex<double> z1,cbs,csk0,cf,cf0,cf1,ca0,cbkl;
211   - complex<double> cg,cg0,cg1,cs0,cs,cr;
212   - double a0,vt,fac;
213   - int k,kz,l,m;
214   -
215   - a0 = abs(z);
216   - nm = n;
217   - if (a0 < 1.0e-100) {
218   - for (k=0;k<=n;k++) {
219   - ci[k] = czero;
220   - ck[k] = complex<double>(1e308,0);
221   - cip[k] = czero;
222   - ckp[k] = complex<double>(-1e308,0);
223   - }
224   - ci[0] = complex<double>(1.0,0.0);
225   - cip[1] = complex<double>(0.5,0.0);
226   - return 0;
227   - }
228   - z1 = z;
229   - if (real(z) < 0.0) z1 = -z;
230   - if (n == 0) nm = 1;
231   - m = msta1(a0,200);
232   - if (m < nm) nm = m;
233   - else m = msta2(a0,nm,15);
234   - cbs = czero;
235   - csk0 = czero;
236   - cf0 = czero;
237   - cf1 = complex<double>(1.0e-100,0.0);
238   - for (k=m;k>=0;k--) {
239   - cf = 2.0*(k+1.0)*cf1/z1+cf0;
240   - if (k <=nm) ci[k] = cf;
241   - if ((k != 0) && (k == 2*(k>>1))) csk0 += 4.0*cf/(double)k;
242   - cbs += 2.0*cf;
243   - cf0 = cf1;
244   - cf1 = cf;
245   - }
246   - cs0 = exp(z1)/(cbs-cf);
247   - for (k=0;k<=nm;k++) {
248   - ci[k] *= cs0;
249   - }
250   - if (a0 <= 9.0) {
251   - ck[0] = -(log(0.5*z1)+el)*ci[0]+cs0*csk0;
252   - ck[1] = (1.0/z1-ci[1]*ck[0])/ci[0];
253   - }
254   - else {
255   - ca0 = sqrt(M_PI_2/z1)*exp(-z1);
256   - if (a0 >= 200.0) kz = 6;
257   - else if (a0 >= 80.0) kz = 8;
258   - else if (a0 >= 25.0) kz = 10;
259   - else kz = 16;
260   - for (l=0;l<2;l++) {
261   - cbkl = cone;
262   - vt = 4.0*l;
263   - cr = cone;
264   - for (k=1;k<=kz;k++) {
265   - cr *= 0.125*(vt-pow(2.0*k-1.0,2.0))/((double)k*z1);
266   - cbkl += cr;
267   - }
268   - ck[l] = ca0*cbkl;
269   - }
270   - }
271   - cg0 = ck[0];
272   - cg1 = ck[1];
273   - for (k=2;k<=nm;k++) {
274   - cg = 2.0*(k-1.0)*cg1/z1+cg0;
275   - ck[k] = cg;
276   - cg0 = cg1;
277   - cg1 = cg;
278   - }
279   - if (real(z) < 0.0) {
280   - fac = 1.0;
281   - for (k=0;k<=nm;k++) {
282   - if (imag(z) < 0.0) {
283   - ck[k] = fac*ck[k]+cii*M_PI*ci[k];
284   - }
285   - else {
286   - ck[k] = fac*ck[k]-cii*M_PI*ci[k];
287   - }
288   - ci[k] *= fac;
289   - fac = -fac;
290   - }
291   - }
292   - cip[0] = ci[1];
293   - ckp[0] = -ck[1];
294   - for (k=1;k<=nm;k++) {
295   - cip[k] = ci[k-1]-(double)k*ci[k]/z;
296   - ckp[k] = -ck[k-1]-(double)k*ck[k]/z;
297   - }
298   - return 0;
299   -}
300   -int cbessikv(double v,complex<double>z,double &vm,complex<double> *civ,
301   - complex<double> *ckv,complex<double> *civp,complex<double> *ckvp)
302   -{
303   - complex<double> z1,z2,ca1,ca,cs,cr,ci0,cbi0,cf,cf1,cf2;
304   - complex<double> ct,cp,cbk0,ca2,cr1,cr2,csu,cws,cb;
305   - complex<double> cg0,cg1,cgk,cbk1,cvk;
306   - double a0,v0,v0p,v0n,vt,w0,piv,gap,gan;
307   - int m,n,k,kz;
308   -
309   - a0 = abs(z);
310   - z1 = z;
311   - z2 = z*z;
312   - n = (int)v;
313   - v0 = v-n;
314   - piv = M_PI*v0;
315   - vt = 4.0*v0*v0;
316   - if (n == 0) n = 1;
317   - if (a0 < 1e-100) {
318   - for (k=0;k<=n;k++) {
319   - civ[k] = czero;
320   - ckv[k] = complex<double>(-1e308,0);
321   - civp[k] = czero;
322   - ckvp[k] = complex<double>(1e308,0);
323   - }
324   - if (v0 == 0.0) {
325   - civ[0] = cone;
326   - civp[1] = complex<double> (0.5,0.0);
327   - }
328   - vm = v;
329   - return 0;
330   - }
331   - if (a0 >= 50.0) kz = 8;
332   - else if (a0 >= 35.0) kz = 10;
333   - else kz = 14;
334   - if (real(z) <= 0.0) z1 = -z;
335   - if (a0 < 18.0) {
336   - if (v0 == 0.0) {
337   - ca1 = cone;
338   - }
339   - else {
340   - v0p = 1.0+v0;
341   - gap = gamma(v0p);
342   - ca1 = pow(0.5*z1,v0)/gap;
343   - }
344   - ci0 = cone;
345   - cr = cone;
346   - for (k=1;k<=50;k++) {
347   - cr *= 0.25*z2/(k*(k+v0));
348   - ci0 += cr;
349   - if (abs(cr/ci0) < eps) break;
350   - }
351   - cbi0 = ci0*ca1;
352   - }
353   - else {
354   - ca = exp(z1)/sqrt(2.0*M_PI*z1);
355   - cs = cone;
356   - cr = cone;
357   - for (k=1;k<=kz;k++) {
358   - cr *= -0.125*(vt-pow(2.0*k-1.0,2.0))/((double)k*z1);
359   - cs += cr;
360   - }
361   - cbi0 = ca*cs;
362   - }
363   - m = msta1(a0,200);
364   - if (m < n) n = m;
365   - else m = msta2(a0,n,15);
366   - cf2 = czero;
367   - cf1 = complex<double>(1.0e-100,0.0);
368   - for (k=m;k>=0;k--) {
369   - cf = 2.0*(v0+k+1.0)*cf1/z1+cf2;
370   - if (k <= n) civ[k] = cf;
371   - cf2 = cf1;
372   - cf1 = cf;
373   - }
374   - cs = cbi0/cf;
375   - for (k=0;k<=n;k++) {
376   - civ[k] *= cs;
377   - }
378   - if (a0 <= 9.0) {
379   - if (v0 == 0.0) {
380   - ct = -log(0.5*z1)-el;
381   - cs = czero;
382   - w0 = 0.0;
383   - cr = cone;
384   - for (k=1;k<=50;k++) {
385   - w0 += 1.0/k;
386   - cr *= 0.25*z2/(double)(k*k);
387   - cp = cr*(w0+ct);
388   - cs += cp;
389   - if ((k >= 10) && (abs(cp/cs) < eps)) break;
390   - }
391   - cbk0 = ct+cs;
392   - }
393   - else {
394   - v0n = 1.0-v0;
395   - gan = gamma(v0n);
396   - ca2 = 1.0/(gan*pow(0.5*z1,v0));
397   - ca1 = pow(0.5*z1,v0)/gap;
398   - csu = ca2-ca1;
399   - cr1 = cone;
400   - cr2 = cone;
401   - cws = czero;
402   - for (k=1;k<=50;k++) {
403   - cr1 *= 0.25*z2/(k*(k-v0));
404   - cr2 *= 0.25*z2/(k*(k+v0));
405   - csu += ca2*cr1-ca1*cr2;
406   - if ((k >= 10) && (abs((cws-csu)/csu) < eps)) break;
407   - cws = csu;
408   - }
409   - cbk0 = csu*M_PI_2/sin(piv);
410   - }
411   - }
412   - else {
413   - cb = exp(-z1)*sqrt(M_PI_2/z1);
414   - cs = cone;
415   - cr = cone;
416   - for (k=1;k<=kz;k++) {
417   - cr *= 0.125*(vt-pow(2.0*k-1.0,2.0))/((double)k*z1);
418   - cs += cr;
419   - }
420   - cbk0 = cb*cs;
421   - }
422   - cbk1 = (1.0/z1-civ[1]*cbk0)/civ[0];
423   - ckv[0] = cbk0;
424   - ckv[1] = cbk1;
425   - cg0 = cbk0;
426   - cg1 = cbk1;
427   - for (k=2;k<=n;k++) {
428   - cgk = 2.0*(v0+k-1.0)*cg1/z1+cg0;
429   - ckv[k] = cgk;
430   - cg0 = cg1;
431   - cg1 = cgk;
432   - }
433   - if (real(z) < 0.0) {
434   - for (k=0;k<=n;k++) {
435   - cvk = exp((k+v0)*M_PI*cii);
436   - if (imag(z) < 0.0) {
437   - ckv[k] = cvk*ckv[k]+M_PI*cii*civ[k];
438   - civ[k] /= cvk;
439   - }
440   - else if (imag(z) > 0.0) {
441   - ckv[k] = ckv[k]/cvk-M_PI*cii*civ[k];
442   - civ[k] *= cvk;
443   - }
444   - }
445   - }
446   - civp[0] = v0*civ[0]/z+civ[1];
447   - ckvp[0] = v0*ckv[0]/z-ckv[1];
448   - for (k=1;k<=n;k++) {
449   - civp[k] = -(k+v0)*civ[k]/z+civ[k-1];
450   - ckvp[k] = -(k+v0)*ckv[k]/z-ckv[k-1];
451   - }
452   - vm = n+v0;
453   - return 0;
454   -}
  1 +// cbessik.cpp -- complex modified Bessel functions.
  2 +// Algorithms and coefficient values from "Computation of Special
  3 +// Functions", Zhang and Jin, John Wiley and Sons, 1996.
  4 +//
  5 +// (C) 2003, C. Bond. All rights reserved.
  6 +//
  7 +#include <complex>
  8 +using namespace std;
  9 +#include "bessel.h"
  10 +
  11 +static complex<double> cii(0.0,1.0);
  12 +static complex<double> czero(0.0,0.0);
  13 +static complex<double> cone(1.0,0.0);
  14 +
  15 +double gamma(double x);
  16 +
  17 +int cbessik01(complex<double>z,complex<double>&ci0,complex<double>&ci1,
  18 + complex<double>&ck0,complex<double>&ck1,complex<double>&ci0p,
  19 + complex<double>&ci1p,complex<double>&ck0p,complex<double>&ck1p)
  20 +{
  21 + complex<double> z1,z2,zr,zr2,cr,ca,cb,cs,ct,cw;
  22 + double a0,w0;
  23 + int k,kz;
  24 + static double a[] = {
  25 + 0.125,
  26 + 7.03125e-2,
  27 + 7.32421875e-2,
  28 + 1.1215209960938e-1,
  29 + 2.2710800170898e-1,
  30 + 5.7250142097473e-1,
  31 + 1.7277275025845,
  32 + 6.0740420012735,
  33 + 2.4380529699556e1,
  34 + 1.1001714026925e2,
  35 + 5.5133589612202e2,
  36 + 3.0380905109224e3
  37 + };
  38 + static double b[] = {
  39 + -0.375,
  40 + -1.171875e-1,
  41 + -1.025390625e-1,
  42 + -1.4419555664063e-1,
  43 + -2.7757644653320e-1,
  44 + -6.7659258842468e-1,
  45 + -1.9935317337513,
  46 + -6.8839142681099,
  47 + -2.7248827311269e1,
  48 + -1.2159789187654e2,
  49 + -6.0384407670507e2,
  50 + -3.3022722944809e3
  51 + };
  52 + static double a1[] = {
  53 + 0.125,
  54 + 0.2109375,
  55 + 1.0986328125,
  56 + 1.1775970458984e1,
  57 + 2.1461706161499e2,
  58 + 5.9511522710323e3,
  59 + 2.3347645606175e5,
  60 + 1.2312234987631e7,
  61 + 8.401390346421e08,
  62 + 7.2031420482627e10
  63 + };
  64 +
  65 + a0 = abs(z);
  66 + z2 = z*z;
  67 + z1 = z;
  68 + if (a0 == 0.0) {
  69 + ci0 = cone;
  70 + ci1 = czero;
  71 + ck0 = complex<double> (1e308,0);
  72 + ck1 = complex<double> (1e308,0);
  73 + ci0p = czero;
  74 + ci1p = complex<double>(0.5,0.0);
  75 + ck0p = complex<double>(-1e308,0);
  76 + ck1p = complex<double>(-1e308,0);
  77 + return 0;
  78 + }
  79 + if (real(z) < 0.0) z1 = -z;
  80 + if (a0 <= 18.0) {
  81 + ci0 = cone;
  82 + cr = cone;
  83 + for (k=1; k<=50; k++) {
  84 + cr *= 0.25*z2/(double)(k*k);
  85 + ci0 += cr;
  86 + if (abs(cr/ci0) < eps) break;
  87 + }
  88 + ci1 = cone;
  89 + cr = cone;
  90 + for (k=1; k<=50; k++) {
  91 + cr *= 0.25*z2/(double)(k*(k+1.0));
  92 + ci1 += cr;
  93 + if (abs(cr/ci1) < eps) break;
  94 + }
  95 + ci1 *= 0.5*z1;
  96 + }
  97 + else {
  98 + if (a0 >= 50.0) kz = 7;
  99 + else if (a0 >= 35.0) kz = 9;
  100 + else kz = 12;
  101 + ca = exp(z1)/sqrt(2.0*M_PI*z1);
  102 + ci0 = cone;
  103 + zr = 1.0/z1;
  104 + for (k=0; k<kz; k++) {
  105 + ci0 += a[k]*pow(zr,k+1.0);
  106 + }
  107 + ci0 *= ca;
  108 + ci1 = cone;
  109 + for (k=0; k<kz; k++) {
  110 + ci1 += b[k]*pow(zr,k+1.0);
  111 + }
  112 + ci1 *= ca;
  113 + }
  114 + if (a0 <= 9.0) {
  115 + cs = czero;
  116 + ct = -log(0.5*z1)-el;
  117 + w0 = 0.0;
  118 + cr = cone;
  119 + for (k=1; k<=50; k++) {
  120 + w0 += 1.0/k;
  121 + cr *= 0.25*z2/(double)(k*k);
  122 + cs += cr*(w0+ct);
  123 + if (abs((cs-cw)/cs) < eps) break;
  124 + cw = cs;
  125 + }
  126 + ck0 = ct+cs;
  127 + }
  128 + else {
  129 + cb = 0.5/z1;
  130 + zr2 = 1.0/z2;
  131 + ck0 = cone;
  132 + for (k=0; k<10; k++) {
  133 + ck0 += a1[k]*pow(zr2,k+1.0);
  134 + }
  135 + ck0 *= cb/ci0;
  136 + }
  137 + ck1 = (1.0/z1 - ci1*ck0)/ci0;
  138 + if (real(z) < 0.0) {
  139 + if (imag(z) < 0.0) {
  140 + ck0 += cii*M_PI*ci0;
  141 + ck1 = -ck1+cii*M_PI*ci1;
  142 + }
  143 + else if (imag(z) > 0.0) {
  144 + ck0 -= cii*M_PI*ci0;
  145 + ck1 = -ck1-cii*M_PI*ci1;
  146 + }
  147 + ci1 = -ci1;
  148 + }
  149 + ci0p = ci1;
  150 + ci1p = ci0-1.0*ci1/z;
  151 + ck0p = -ck1;
  152 + ck1p = -ck0-1.0*ck1/z;
  153 + return 0;
  154 +}
  155 +int cbessikna(int n,complex<double> z,int &nm,complex<double> *ci,
  156 + complex<double> *ck,complex<double> *cip,complex<double> *ckp)
  157 +{
  158 + complex<double> ci0,ci1,ck0,ck1,ckk,cf,cf1,cf2,cs;
  159 + double a0;
  160 + int k,m,ecode;
  161 + a0 = abs(z);
  162 + nm = n;
  163 + if (a0 < 1.0e-100) {
  164 + for (k=0; k<=n; k++) {
  165 + ci[k] = czero;
  166 + ck[k] = complex<double>(-1e308,0);
  167 + cip[k] = czero;
  168 + ckp[k] = complex<double>(1e308,0);
  169 + }
  170 + ci[0] = cone;
  171 + cip[1] = complex<double>(0.5,0.0);
  172 + return 0;
  173 + }
  174 + ecode = cbessik01(z,ci[0],ci[1],ck[0],ck[1],cip[0],cip[1],ckp[0],ckp[1]);
  175 + if (n < 2) return 0;
  176 + ci0 = ci[0];
  177 + ci1 = ci[1];
  178 + ck0 = ck[0];
  179 + ck1 = ck[1];
  180 + m = msta1(a0,200);
  181 + if (m < n) nm = m;
  182 + else m = msta2(a0,n,15);
  183 + cf2 = czero;
  184 + cf1 = complex<double>(1.0e-100,0.0);
  185 + for (k=m; k>=0; k--) {
  186 + cf = 2.0*(k+1.0)*cf1/z+cf2;
  187 + if (k <= nm) ci[k] = cf;
  188 + cf2 = cf1;
  189 + cf1 = cf;
  190 + }
  191 + cs = ci0/cf;
  192 + for (k=0; k<=nm; k++) {
  193 + ci[k] *= cs;
  194 + }
  195 + for (k=2; k<=nm; k++) {
  196 + if (abs(ci[k-1]) > abs(ci[k-2])) {
  197 + ckk = (1.0/z-ci[k]*ck[k-1])/ci[k-1];
  198 + }
  199 + else {
  200 + ckk = (ci[k]*ck[k-2]+2.0*(k-1.0)/(z*z))/ci[k-2];
  201 + }
  202 + ck[k] = ckk;
  203 + }
  204 + for (k=2; k<=nm; k++) {
  205 + cip[k] = ci[k-1]-(double)k*ci[k]/z;
  206 + ckp[k] = -ck[k-1]-(double)k*ck[k]/z;
  207 + }
  208 + return 0;
  209 +}
  210 +int cbessiknb(int n,complex<double> z,int &nm,complex<double> *ci,
  211 + complex<double> *ck,complex<double> *cip,complex<double> *ckp)
  212 +{
  213 + complex<double> z1,cbs,csk0,cf,cf0,cf1,ca0,cbkl;
  214 + complex<double> cg,cg0,cg1,cs0,cs,cr;
  215 + double a0,vt,fac;
  216 + int k,kz,l,m;
  217 +
  218 + a0 = abs(z);
  219 + nm = n;
  220 + if (a0 < 1.0e-100) {
  221 + for (k=0; k<=n; k++) {
  222 + ci[k] = czero;
  223 + ck[k] = complex<double>(1e308,0);
  224 + cip[k] = czero;
  225 + ckp[k] = complex<double>(-1e308,0);
  226 + }
  227 + ci[0] = complex<double>(1.0,0.0);
  228 + cip[1] = complex<double>(0.5,0.0);
  229 + return 0;
  230 + }
  231 + z1 = z;
  232 + if (real(z) < 0.0) z1 = -z;
  233 + if (n == 0) nm = 1;
  234 + m = msta1(a0,200);
  235 + if (m < nm) nm = m;
  236 + else m = msta2(a0,nm,15);
  237 + cbs = czero;
  238 + csk0 = czero;
  239 + cf0 = czero;
  240 + cf1 = complex<double>(1.0e-100,0.0);
  241 + for (k=m; k>=0; k--) {
  242 + cf = 2.0*(k+1.0)*cf1/z1+cf0;
  243 + if (k <=nm) ci[k] = cf;
  244 + if ((k != 0) && (k == 2*(k>>1))) csk0 += 4.0*cf/(double)k;
  245 + cbs += 2.0*cf;
  246 + cf0 = cf1;
  247 + cf1 = cf;
  248 + }
  249 + cs0 = exp(z1)/(cbs-cf);
  250 + for (k=0; k<=nm; k++) {
  251 + ci[k] *= cs0;
  252 + }
  253 + if (a0 <= 9.0) {
  254 + ck[0] = -(log(0.5*z1)+el)*ci[0]+cs0*csk0;
  255 + ck[1] = (1.0/z1-ci[1]*ck[0])/ci[0];
  256 + }
  257 + else {
  258 + ca0 = sqrt(M_PI_2/z1)*exp(-z1);
  259 + if (a0 >= 200.0) kz = 6;
  260 + else if (a0 >= 80.0) kz = 8;
  261 + else if (a0 >= 25.0) kz = 10;
  262 + else kz = 16;
  263 + for (l=0; l<2; l++) {
  264 + cbkl = cone;
  265 + vt = 4.0*l;
  266 + cr = cone;
  267 + for (k=1; k<=kz; k++) {
  268 + cr *= 0.125*(vt-pow(2.0*k-1.0,2.0))/((double)k*z1);
  269 + cbkl += cr;
  270 + }
  271 + ck[l] = ca0*cbkl;
  272 + }
  273 + }
  274 + cg0 = ck[0];
  275 + cg1 = ck[1];
  276 + for (k=2; k<=nm; k++) {
  277 + cg = 2.0*(k-1.0)*cg1/z1+cg0;
  278 + ck[k] = cg;
  279 + cg0 = cg1;
  280 + cg1 = cg;
  281 + }
  282 + if (real(z) < 0.0) {
  283 + fac = 1.0;
  284 + for (k=0; k<=nm; k++) {
  285 + if (imag(z) < 0.0) {
  286 + ck[k] = fac*ck[k]+cii*M_PI*ci[k];
  287 + }
  288 + else {
  289 + ck[k] = fac*ck[k]-cii*M_PI*ci[k];
  290 + }
  291 + ci[k] *= fac;
  292 + fac = -fac;
  293 + }
  294 + }
  295 + cip[0] = ci[1];
  296 + ckp[0] = -ck[1];
  297 + for (k=1; k<=nm; k++) {
  298 + cip[k] = ci[k-1]-(double)k*ci[k]/z;
  299 + ckp[k] = -ck[k-1]-(double)k*ck[k]/z;
  300 + }
  301 + return 0;
  302 +}
  303 +int cbessikv(double v,complex<double>z,double &vm,complex<double> *civ,
  304 + complex<double> *ckv,complex<double> *civp,complex<double> *ckvp)
  305 +{
  306 + complex<double> z1,z2,ca1,ca,cs,cr,ci0,cbi0,cf,cf1,cf2;
  307 + complex<double> ct,cp,cbk0,ca2,cr1,cr2,csu,cws,cb;
  308 + complex<double> cg0,cg1,cgk,cbk1,cvk;
  309 + double a0,v0,v0p,v0n,vt,w0,piv,gap,gan;
  310 + int m,n,k,kz;
  311 +
  312 + a0 = abs(z);
  313 + z1 = z;
  314 + z2 = z*z;
  315 + n = (int)v;
  316 + v0 = v-n;
  317 + piv = M_PI*v0;
  318 + vt = 4.0*v0*v0;
  319 + if (n == 0) n = 1;
  320 + if (a0 < 1e-100) {
  321 + for (k=0; k<=n; k++) {
  322 + civ[k] = czero;
  323 + ckv[k] = complex<double>(-1e308,0);
  324 + civp[k] = czero;
  325 + ckvp[k] = complex<double>(1e308,0);
  326 + }
  327 + if (v0 == 0.0) {
  328 + civ[0] = cone;
  329 + civp[1] = complex<double> (0.5,0.0);
  330 + }
  331 + vm = v;
  332 + return 0;
  333 + }
  334 + if (a0 >= 50.0) kz = 8;
  335 + else if (a0 >= 35.0) kz = 10;
  336 + else kz = 14;
  337 + if (real(z) <= 0.0) z1 = -z;
  338 + if (a0 < 18.0) {
  339 + if (v0 == 0.0) {
  340 + ca1 = cone;
  341 + }
  342 + else {
  343 + v0p = 1.0+v0;
  344 + gap = gamma(v0p);
  345 + ca1 = pow(0.5*z1,v0)/gap;
  346 + }
  347 + ci0 = cone;
  348 + cr = cone;
  349 + for (k=1; k<=50; k++) {
  350 + cr *= 0.25*z2/(k*(k+v0));
  351 + ci0 += cr;
  352 + if (abs(cr/ci0) < eps) break;
  353 + }
  354 + cbi0 = ci0*ca1;
  355 + }
  356 + else {
  357 + ca = exp(z1)/sqrt(2.0*M_PI*z1);
  358 + cs = cone;
  359 + cr = cone;
  360 + for (k=1; k<=kz; k++) {
  361 + cr *= -0.125*(vt-pow(2.0*k-1.0,2.0))/((double)k*z1);
  362 + cs += cr;
  363 + }
  364 + cbi0 = ca*cs;
  365 + }
  366 + m = msta1(a0,200);
  367 + if (m < n) n = m;
  368 + else m = msta2(a0,n,15);
  369 + cf2 = czero;
  370 + cf1 = complex<double>(1.0e-100,0.0);
  371 + for (k=m; k>=0; k--) {
  372 + cf = 2.0*(v0+k+1.0)*cf1/z1+cf2;
  373 + if (k <= n) civ[k] = cf;
  374 + cf2 = cf1;
  375 + cf1 = cf;
  376 + }
  377 + cs = cbi0/cf;
  378 + for (k=0; k<=n; k++) {
  379 + civ[k] *= cs;
  380 + }
  381 + if (a0 <= 9.0) {
  382 + if (v0 == 0.0) {
  383 + ct = -log(0.5*z1)-el;
  384 + cs = czero;
  385 + w0 = 0.0;
  386 + cr = cone;
  387 + for (k=1; k<=50; k++) {
  388 + w0 += 1.0/k;
  389 + cr *= 0.25*z2/(double)(k*k);
  390 + cp = cr*(w0+ct);
  391 + cs += cp;
  392 + if ((k >= 10) && (abs(cp/cs) < eps)) break;
  393 + }
  394 + cbk0 = ct+cs;
  395 + }
  396 + else {
  397 + v0n = 1.0-v0;
  398 + gan = gamma(v0n);
  399 + ca2 = 1.0/(gan*pow(0.5*z1,v0));
  400 + ca1 = pow(0.5*z1,v0)/gap;
  401 + csu = ca2-ca1;
  402 + cr1 = cone;
  403 + cr2 = cone;
  404 + cws = czero;
  405 + for (k=1; k<=50; k++) {
  406 + cr1 *= 0.25*z2/(k*(k-v0));
  407 + cr2 *= 0.25*z2/(k*(k+v0));
  408 + csu += ca2*cr1-ca1*cr2;
  409 + if ((k >= 10) && (abs((cws-csu)/csu) < eps)) break;
  410 + cws = csu;
  411 + }
  412 + cbk0 = csu*M_PI_2/sin(piv);
  413 + }
  414 + }
  415 + else {
  416 + cb = exp(-z1)*sqrt(M_PI_2/z1);
  417 + cs = cone;
  418 + cr = cone;
  419 + for (k=1; k<=kz; k++) {
  420 + cr *= 0.125*(vt-pow(2.0*k-1.0,2.0))/((double)k*z1);
  421 + cs += cr;
  422 + }
  423 + cbk0 = cb*cs;
  424 + }
  425 + cbk1 = (1.0/z1-civ[1]*cbk0)/civ[0];
  426 + ckv[0] = cbk0;
  427 + ckv[1] = cbk1;
  428 + cg0 = cbk0;
  429 + cg1 = cbk1;
  430 + for (k=2; k<=n; k++) {
  431 + cgk = 2.0*(v0+k-1.0)*cg1/z1+cg0;
  432 + ckv[k] = cgk;
  433 + cg0 = cg1;
  434 + cg1 = cgk;
  435 + }
  436 + if (real(z) < 0.0) {
  437 + for (k=0; k<=n; k++) {
  438 + cvk = exp((k+v0)*M_PI*cii);
  439 + if (imag(z) < 0.0) {
  440 + ckv[k] = cvk*ckv[k]+M_PI*cii*civ[k];
  441 + civ[k] /= cvk;
  442 + }
  443 + else if (imag(z) > 0.0) {
  444 + ckv[k] = ckv[k]/cvk-M_PI*cii*civ[k];
  445 + civ[k] *= cvk;
  446 + }
  447 + }
  448 + }
  449 + civp[0] = v0*civ[0]/z+civ[1];
  450 + ckvp[0] = v0*ckv[0]/z-ckv[1];
  451 + for (k=1; k<=n; k++) {
  452 + civp[k] = -(k+v0)*civ[k]/z+civ[k-1];
  453 + ckvp[k] = -(k+v0)*ckv[k]/z-ckv[k-1];
  454 + }
  455 + vm = n+v0;
  456 + return 0;
  457 +}
... ...
cbessjy.cpp
1   -// cbessjy.cpp -- complex Bessel functions.
2   -// Algorithms and coefficient values from "Computation of Special
3   -// Functions", Zhang and Jin, John Wiley and Sons, 1996.
4   -//
5   -// (C) 2003, C. Bond. All rights reserved.
6   -//
7   -#include <complex>
8   -using namespace std;
9   -#include "bessel.h"
10   -double gamma(double);
11   -
12   -static complex<double> cii(0.0,1.0);
13   -static complex<double> cone(1.0,0.0);
14   -static complex<double> czero(0.0,0.0);
15   -
16   -int cbessjy01(complex<double> z,complex<double> &cj0,complex<double> &cj1,
17   - complex<double> &cy0,complex<double> &cy1,complex<double> &cj0p,
18   - complex<double> &cj1p,complex<double> &cy0p,complex<double> &cy1p)
19   -{
20   - complex<double> z1,z2,cr,cp,cs,cp0,cq0,cp1,cq1,ct1,ct2,cu;
21   - double a0,w0,w1;
22   - int k,kz;
23   -
24   - static double a[] = {
25   - -7.03125e-2,
26   - 0.112152099609375,
27   - -0.5725014209747314,
28   - 6.074042001273483,
29   - -1.100171402692467e2,
30   - 3.038090510922384e3,
31   - -1.188384262567832e5,
32   - 6.252951493434797e6,
33   - -4.259392165047669e8,
34   - 3.646840080706556e10,
35   - -3.833534661393944e12,
36   - 4.854014686852901e14,
37   - -7.286857349377656e16,
38   - 1.279721941975975e19};
39   - static double b[] = {
40   - 7.32421875e-2,
41   - -0.2271080017089844,
42   - 1.727727502584457,
43   - -2.438052969955606e1,
44   - 5.513358961220206e2,
45   - -1.825775547429318e4,
46   - 8.328593040162893e5,
47   - -5.006958953198893e7,
48   - 3.836255180230433e9,
49   - -3.649010818849833e11,
50   - 4.218971570284096e13,
51   - -5.827244631566907e15,
52   - 9.476288099260110e17,
53   - -1.792162323051699e20};
54   - static double a1[] = {
55   - 0.1171875,
56   - -0.1441955566406250,
57   - 0.6765925884246826,
58   - -6.883914268109947,
59   - 1.215978918765359e2,
60   - -3.302272294480852e3,
61   - 1.276412726461746e5,
62   - -6.656367718817688e6,
63   - 4.502786003050393e8,
64   - -3.833857520742790e10,
65   - 4.011838599133198e12,
66   - -5.060568503314727e14,
67   - 7.572616461117958e16,
68   - -1.326257285320556e19};
69   - static double b1[] = {
70   - -0.1025390625,
71   - 0.2775764465332031,
72   - -1.993531733751297,
73   - 2.724882731126854e1,
74   - -6.038440767050702e2,
75   - 1.971837591223663e4,
76   - -8.902978767070678e5,
77   - 5.310411010968522e7,
78   - -4.043620325107754e9,
79   - 3.827011346598605e11,
80   - -4.406481417852278e13,
81   - 6.065091351222699e15,
82   - -9.833883876590679e17,
83   - 1.855045211579828e20};
84   -
85   - a0 = abs(z);
86   - z2 = z*z;
87   - z1 = z;
88   - if (a0 == 0.0) {
89   - cj0 = cone;
90   - cj1 = czero;
91   - cy0 = complex<double>(-1e308,0);
92   - cy1 = complex<double>(-1e308,0);
93   - cj0p = czero;
94   - cj1p = complex<double>(0.5,0.0);
95   - cy0p = complex<double>(1e308,0);
96   - cy1p = complex<double>(1e308,0);
97   - return 0;
98   - }
99   - if (real(z) < 0.0) z1 = -z;
100   - if (a0 <= 12.0) {
101   - cj0 = cone;
102   - cr = cone;
103   - for (k=1;k<=40;k++) {
104   - cr *= -0.25*z2/(double)(k*k);
105   - cj0 += cr;
106   - if (abs(cr) < abs(cj0)*eps) break;
107   - }
108   - cj1 = cone;
109   - cr = cone;
110   - for (k=1;k<=40;k++) {
111   - cr *= -0.25*z2/(k*(k+1.0));
112   - cj1 += cr;
113   - if (abs(cr) < abs(cj1)*eps) break;
114   - }
115   - cj1 *= 0.5*z1;
116   - w0 = 0.0;
117   - cr = cone;
118   - cs = czero;
119   - for (k=1;k<=40;k++) {
120   - w0 += 1.0/k;
121   - cr *= -0.25*z2/(double)(k*k);
122   - cp = cr*w0;
123   - cs += cp;
124   - if (abs(cp) < abs(cs)*eps) break;
125   - }
126   - cy0 = M_2_PI*((log(0.5*z1)+el)*cj0-cs);
127   - w1 = 0.0;
128   - cr = cone;
129   - cs = cone;
130   - for (k=1;k<=40;k++) {
131   - w1 += 1.0/k;
132   - cr *= -0.25*z2/(k*(k+1.0));
133   - cp = cr*(2.0*w1+1.0/(k+1.0));
134   - cs += cp;
135   - if (abs(cp) < abs(cs)*eps) break;
136   - }
137   - cy1 = M_2_PI*((log(0.5*z1)+el)*cj1-1.0/z1-0.25*z1*cs);
138   - }
139   - else {
140   - if (a0 >= 50.0) kz = 8; // can be changed to 10
141   - else if (a0 >= 35.0) kz = 10; // " " " 12
142   - else kz = 12; // " " " 14
143   - ct1 = z1 - M_PI_4;
144   - cp0 = cone;
145   - for (k=0;k<kz;k++) {
146   - cp0 += a[k]*pow(z1,-2.0*k-2.0);
147   - }
148   - cq0 = -0.125/z1;
149   - for (k=0;k<kz;k++) {
150   - cq0 += b[k]*pow(z1,-2.0*k-3.0);
151   - }
152   - cu = sqrt(M_2_PI/z1);
153   - cj0 = cu*(cp0*cos(ct1)-cq0*sin(ct1));
154   - cy0 = cu*(cp0*sin(ct1)+cq0*cos(ct1));
155   - ct2 = z1 - 0.75*M_PI;
156   - cp1 = cone;
157   - for (k=0;k<kz;k++) {
158   - cp1 += a1[k]*pow(z1,-2.0*k-2.0);
159   - }
160   - cq1 = 0.375/z1;
161   - for (k=0;k<kz;k++) {
162   - cq1 += b1[k]*pow(z1,-2.0*k-3.0);
163   - }
164   - cj1 = cu*(cp1*cos(ct2)-cq1*sin(ct2));
165   - cy1 = cu*(cp1*sin(ct2)+cq1*cos(ct2));
166   - }
167   - if (real(z) < 0.0) {
168   - if (imag(z) < 0.0) {
169   - cy0 -= 2.0*cii*cj0;
170   - cy1 = -(cy1-2.0*cii*cj1);
171   - }
172   - else if (imag(z) > 0.0) {
173   - cy0 += 2.0*cii*cj0;
174   - cy1 = -(cy1+2.0*cii*cj1);
175   - }
176   - cj1 = -cj1;
177   - }
178   - cj0p = -cj1;
179   - cj1p = cj0-cj1/z;
180   - cy0p = -cy1;
181   - cy1p = cy0-cy1/z;
182   - return 0;
183   -}
184   -
185   -int cbessjyna(int n,complex<double> z,int &nm,complex<double> *cj,
186   - complex<double> *cy,complex<double> *cjp,complex<double> *cyp)
187   -{
188   - complex<double> cbj0,cbj1,cby0,cby1,cj0,cjk,cj1,cf,cf1,cf2;
189   - complex<double> cs,cg0,cg1,cyk,cyl1,cyl2,cylk,cp11,cp12,cp21,cp22;
190   - complex<double> ch0,ch1,ch2;
191   - double a0,yak,ya1,ya0,wa;
192   - int m,k,lb,lb0;
193   -
194   - if (n < 0) return 1;
195   - a0 = abs(z);
196   - nm = n;
197   - if (a0 < 1.0e-100) {
198   - for (k=0;k<=n;k++) {
199   - cj[k] = czero;
200   - cy[k] = complex<double> (-1e308,0);
201   - cjp[k] = czero;
202   - cyp[k] = complex<double>(1e308,0);
203   - }
204   - cj[0] = cone;
205   - cjp[1] = complex<double>(0.5,0.0);
206   - return 0;
207   - }
208   - cbessjy01(z,cj[0],cj[1],cy[0],cy[1],cjp[0],cjp[1],cyp[0],cyp[1]);
209   - cbj0 = cj[0];
210   - cbj1 = cj[1];
211   - cby0 = cy[0];
212   - cby1 = cy[1];
213   - if (n <= 1) return 0;
214   - if (n < (int)0.25*a0) {
215   - cj0 = cbj0;
216   - cj1 = cbj1;
217   - for (k=2;k<=n;k++) {
218   - cjk = 2.0*(k-1.0)*cj1/z-cj0;
219   - cj[k] = cjk;
220   - cj0 = cj1;
221   - cj1 = cjk;
222   - }
223   - }
224   - else {
225   - m = msta1(a0,200);
226   - if (m < n) nm = m;
227   - else m = msta2(a0,n,15);
228   - cf2 = czero;
229   - cf1 = complex<double> (1.0e-100,0.0);
230   - for (k=m;k>=0;k--) {
231   - cf = 2.0*(k+1.0)*cf1/z-cf2;
232   - if (k <=nm) cj[k] = cf;
233   - cf2 = cf1;
234   - cf1 = cf;
235   - }
236   - if (abs(cbj0) > abs(cbj1)) cs = cbj0/cf;
237   - else cs = cbj1/cf2;
238   - for (k=0;k<=nm;k++) {
239   - cj[k] *= cs;
240   - }
241   - }
242   - for (k=2;k<=nm;k++) {
243   - cjp[k] = cj[k-1]-(double)k*cj[k]/z;
244   - }
245   - ya0 = abs(cby0);
246   - lb = 0;
247   - cg0 = cby0;
248   - cg1 = cby1;
249   - for (k=2;k<=nm;k++) {
250   - cyk = 2.0*(k-1.0)*cg1/z-cg0;
251   - yak = abs(cyk);
252   - ya1 = abs(cg0);
253   - if ((yak < ya0) && (yak < ya1)) lb = k;
254   - cy[k] = cyk;
255   - cg0 = cg1;
256   - cg1 = cyk;
257   - }
258   - lb0 = 0;
259   - if ((lb > 4) && (imag(z) != 0.0)) {
260   - while (lb != lb0) {
261   - ch2 = cone;
262   - ch1 = czero;
263   - lb0 = lb;
264   - for (k=lb;k>=1;k--) {
265   - ch0 = 2.0*k*ch1/z-ch2;
266   - ch2 = ch1;
267   - ch1 = ch0;
268   - }
269   - cp12 = ch0;
270   - cp22 = ch2;
271   - ch2 = czero;
272   - ch1 = cone;
273   - for (k=lb;k>=1;k--) {
274   - ch0 = 2.0*k*ch1/z-ch2;
275   - ch2 = ch1;
276   - ch1 = ch0;
277   - }
278   - cp11 = ch0;
279   - cp21 = ch2;
280   - if (lb == nm)
281   - cj[lb+1] = 2.0*lb*cj[lb]/z-cj[lb-1];
282   - if (abs(cj[0]) > abs(cj[1])) {
283   - cy[lb+1] = (cj[lb+1]*cby0-2.0*cp11/(M_PI*z))/cj[0];
284   - cy[lb] = (cj[lb]*cby0+2.0*cp12/(M_PI*z))/cj[0];
285   - }
286   - else {
287   - cy[lb+1] = (cj[lb+1]*cby1-2.0*cp21/(M_PI*z))/cj[1];
288   - cy[lb] = (cj[lb]*cby1+2.0*cp22/(M_PI*z))/cj[1];
289   - }
290   - cyl2 = cy[lb+1];
291   - cyl1 = cy[lb];
292   - for (k=lb-1;k>=0;k--) {
293   - cylk = 2.0*(k+1.0)*cyl1/z-cyl2;
294   - cy[k] = cylk;
295   - cyl2 = cyl1;
296   - cyl1 = cylk;
297   - }
298   - cyl1 = cy[lb];
299   - cyl2 = cy[lb+1];
300   - for (k=lb+1;k<n;k++) {
301   - cylk = 2.0*k*cyl2/z-cyl1;
302   - cy[k+1] = cylk;
303   - cyl1 = cyl2;
304   - cyl2 = cylk;
305   - }
306   - for (k=2;k<=nm;k++) {
307   - wa = abs(cy[k]);
308   - if (wa < abs(cy[k-1])) lb = k;
309   - }
310   - }
311   - }
312   - for (k=2;k<=nm;k++) {
313   - cyp[k] = cy[k-1]-(double)k*cy[k]/z;
314   - }
315   - return 0;
316   -}
317   -
318   -int cbessjynb(int n,complex<double> z,int &nm,complex<double> *cj,
319   - complex<double> *cy,complex<double> *cjp,complex<double> *cyp)
320   -{
321   - complex<double> cf,cf0,cf1,cf2,cbs,csu,csv,cs0,ce;
322   - complex<double> ct1,cp0,cq0,cp1,cq1,cu,cbj0,cby0,cbj1,cby1;
323   - complex<double> cyy,cbjk,ct2;
324   - double a0,y0;
325   - int k,m;
326   - static double a[] = {
327   - -0.7031250000000000e-1,
328   - 0.1121520996093750,
329   - -0.5725014209747314,
330   - 6.074042001273483};
331   - static double b[] = {
332   - 0.7324218750000000e-1,
333   - -0.2271080017089844,
334   - 1.727727502584457,
335   - -2.438052969955606e1};
336   - static double a1[] = {
337   - 0.1171875,
338   - -0.1441955566406250,
339   - 0.6765925884246826,
340   - -6.883914268109947};
341   - static double b1[] = {
342   - -0.1025390625,
343   - 0.2775764465332031,
344   - -1.993531733751297,
345   - 2.724882731126854e1};
346   -
347   - y0 = abs(imag(z));
348   - a0 = abs(z);
349   - nm = n;
350   - if (a0 < 1.0e-100) {
351   - for (k=0;k<=n;k++) {
352   - cj[k] = czero;
353   - cy[k] = complex<double> (-1e308,0);
354   - cjp[k] = czero;
355   - cyp[k] = complex<double>(1e308,0);
356   - }
357   - cj[0] = cone;
358   - cjp[1] = complex<double>(0.5,0.0);
359   - return 0;
360   - }
361   - if ((a0 <= 300.0) || (n > (int)(0.25*a0))) {
362   - if (n == 0) nm = 1;
363   - m = msta1(a0,200);
364   - if (m < nm) nm = m;
365   - else m = msta2(a0,nm,15);
366   - cbs = czero;
367   - csu = czero;
368   - csv = czero;
369   - cf2 = czero;
370   - cf1 = complex<double> (1.0e-100,0.0);
371   - for (k=m;k>=0;k--) {
372   - cf = 2.0*(k+1.0)*cf1/z-cf2;
373   - if (k <= nm) cj[k] = cf;
374   - if (((k & 1) == 0) && (k != 0)) {
375   - if (y0 <= 1.0) {
376   - cbs += 2.0*cf;
377   - }
378   - else {
379   - cbs += (-1)*((k & 2)-1)*2.0*cf;
380   - }
381   - csu += (double)((-1)*((k & 2)-1))*cf/(double)k;
382   - }
383   - else if (k > 1) {
384   - csv += (double)((-1)*((k & 2)-1)*k)*cf/(double)(k*k-1.0);
385   - }
386   - cf2 = cf1;
387   - cf1 = cf;
388   - }
389   - if (y0 <= 1.0) cs0 = cbs+cf;
390   - else cs0 = (cbs+cf)/cos(z);
391   - for (k=0;k<=nm;k++) {
392   - cj[k] /= cs0;
393   - }
394   - ce = log(0.5*z)+el;
395   - cy[0] = M_2_PI*(ce*cj[0]-4.0*csu/cs0);
396   - cy[1] = M_2_PI*(-cj[0]/z+(ce-1.0)*cj[1]-4.0*csv/cs0);
397   - }
398   - else {
399   - ct1 = z-M_PI_4;
400   - cp0 = cone;
401   - for (k=0;k<4;k++) {
402   - cp0 += a[k]*pow(z,-2.0*k-2.0);
403   - }
404   - cq0 = -0.125/z;
405   - for (k=0;k<4;k++) {
406   - cq0 += b[k] *pow(z,-2.0*k-3.0);
407   - }
408   - cu = sqrt(M_2_PI/z);
409   - cbj0 = cu*(cp0*cos(ct1)-cq0*sin(ct1));
410   - cby0 = cu*(cp0*sin(ct1)+cq0*cos(ct1));
411   - cj[0] = cbj0;
412   - cy[0] = cby0;
413   - ct2 = z-0.75*M_PI;
414   - cp1 = cone;
415   - for (k=0;k<4;k++) {
416   - cp1 += a1[k]*pow(z,-2.0*k-2.0);
417   - }
418   - cq1 = 0.375/z;
419   - for (k=0;k<4;k++) {
420   - cq1 += b1[k]*pow(z,-2.0*k-3.0);
421   - }
422   - cbj1 = cu*(cp1*cos(ct2)-cq1*sin(ct2));
423   - cby1 = cu*(cp1*sin(ct2)+cq1*cos(ct2));
424   - cj[1] = cbj1;
425   - cy[1] = cby1;
426   - for (k=2;k<=n;k++) {
427   - cbjk = 2.0*(k-1.0)*cbj1/z-cbj0;
428   - cj[k] = cbjk;
429   - cbj0 = cbj1;
430   - cbj1 = cbjk;
431   - }
432   - }
433   - cjp[0] = -cj[1];
434   - for (k=1;k<=nm;k++) {
435   - cjp[k] = cj[k-1]-(double)k*cj[k]/z;
436   - }
437   - if (abs(cj[0]) > 1.0)
438   - cy[1] = (cj[1]*cy[0]-2.0/(M_PI*z))/cj[0];
439   - for (k=2;k<=nm;k++) {
440   - if (abs(cj[k-1]) >= abs(cj[k-2]))
441   - cyy = (cj[k]*cy[k-1]-2.0/(M_PI*z))/cj[k-1];
442   - else
443   - cyy = (cj[k]*cy[k-2]-4.0*(k-1.0)/(M_PI*z*z))/cj[k-2];
444   - cy[k] = cyy;
445   - }
446   - cyp[0] = -cy[1];
447   - for (k=1;k<=nm;k++) {
448   - cyp[k] = cy[k-1]-(double)k*cy[k]/z;
449   - }
450   -
451   - return 0;
452   -}
453   -
454   -int cbessjyva(double v,complex<double> z,double &vm,complex<double>*cjv,
455   - complex<double>*cyv,complex<double>*cjvp,complex<double>*cyvp)
456   -{
457   - complex<double> z1,z2,zk,cjvl,cr,ca,cjv0,cjv1,cpz,crp;
458   - complex<double> cqz,crq,ca0,cck,csk,cyv0,cyv1,cju0,cju1,cb;
459   - complex<double> cs,cs0,cr0,cs1,cr1,cec,cf,cf0,cf1,cf2;
460   - complex<double> cfac0,cfac1,cg0,cg1,cyk,cp11,cp12,cp21,cp22;
461   - complex<double> ch0,ch1,ch2,cyl1,cyl2,cylk;
462   -
463   - double a0,v0,pv0,pv1,vl,ga,gb,vg,vv,w0,w1,ya0,yak,ya1,wa;
464   - int j,n,k,kz,l,lb,lb0,m;
465   -
466   - a0 = abs(z);
467   - z1 = z;
468   - z2 = z*z;
469   - n = (int)v;
470   -
471   -
472   - v0 = v-n;
473   -
474   - pv0 = M_PI*v0;
475   - pv1 = M_PI*(1.0+v0);
476   - if (a0 < 1.0e-100) {
477   - for (k=0;k<=n;k++) {
478   - cjv[k] = czero;
479   - cyv[k] = complex<double> (-1e308,0);
480   - cjvp[k] = czero;
481   - cyvp[k] = complex<double> (1e308,0);
482   -
483   - }
484   - if (v0 == 0.0) {
485   - cjv[0] = cone;
486   - cjvp[1] = complex<double> (0.5,0.0);
487   - }
488   - else {
489   - cjvp[0] = complex<double> (1e308,0);
490   - }
491   - vm = v;
492   - return 0;
493   - }
494   - if (real(z1) < 0.0) z1 = -z;
495   - if (a0 <= 12.0) {
496   - for (l=0;l<2;l++) {
497   - vl = v0+l;
498   - cjvl = cone;
499   - cr = cone;
500   - for (k=1;k<=40;k++) {
501   - cr *= -0.25*z2/(k*(k+vl));
502   - cjvl += cr;
503   - if (abs(cr) < abs(cjvl)*eps) break;
504   - }
505   - vg = 1.0 + vl;
506   - ga = gamma(vg);
507   - ca = pow(0.5*z1,vl)/ga;
508   - if (l == 0) cjv0 = cjvl*ca;
509   - else cjv1 = cjvl*ca;
510   - }
511   - }
512   - else {
513   - if (a0 >= 50.0) kz = 8;
514   - else if (a0 >= 35.0) kz = 10;
515   - else kz = 11;
516   - for (j=0;j<2;j++) {
517   - vv = 4.0*(j+v0)*(j+v0);
518   - cpz = cone;
519   - crp = cone;
520   - for (k=1;k<=kz;k++) {
521   - crp = -0.78125e-2*crp*(vv-pow(4.0*k-3.0,2.0))*
522   - (vv-pow(4.0*k-1.0,2.0))/(k*(2.0*k-1.0)*z2);
523   - cpz += crp;
524   - }
525   - cqz = cone;
526   - crq = cone;
527   - for (k=1;k<=kz;k++) {
528   - crq = -0.78125e-2*crq*(vv-pow(4.0*k-1.0,2.0))*
529   - (vv-pow(4.0*k+1.0,2.0))/(k*(2.0*k+1.0)*z2);
530   - cqz += crq;
531   - }
532   - cqz *= 0.125*(vv-1.0)/z1;
533   - zk = z1-(0.5*(j+v0)+0.25)*M_PI;
534   - ca0 = sqrt(M_2_PI/z1);
535   - cck = cos(zk);
536   - csk = sin(zk);
537   - if (j == 0) {
538   - cjv0 = ca0*(cpz*cck-cqz*csk);
539   - cyv0 = ca0*(cpz*csk+cqz+cck);
540   - }
541   - else {
542   - cjv1 = ca0*(cpz*cck-cqz*csk);
543   - cyv1 = ca0*(cpz*csk+cqz*cck);
544   - }
545   - }
546   - }
547   - if (a0 <= 12.0) {
548   - if (v0 != 0.0) {
549   - for (l=0;l<2;l++) {
550   - vl = v0+l;
551   - cjvl = cone;
552   - cr = cone;
553   - for (k=1;k<=40;k++) {
554   - cr *= -0.25*z2/(k*(k-vl));
555   - cjvl += cr;
556   - if (abs(cr) < abs(cjvl)*eps) break;
557   - }
558   - vg = 1.0-vl;
559   - gb = gamma(vg);
560   - cb = pow(2.0/z1,vl)/gb;
561   - if (l == 0) cju0 = cjvl*cb;
562   - else cju1 = cjvl*cb;
563   - }
564   - cyv0 = (cjv0*cos(pv0)-cju0)/sin(pv0);
565   - cyv1 = (cjv1*cos(pv1)-cju1)/sin(pv1);
566   - }
567   - else {
568   - cec = log(0.5*z1)+el;
569   - cs0 = czero;
570   - w0 = 0.0;
571   - cr0 = cone;
572   - for (k=1;k<=30;k++) {
573   - w0 += 1.0/k;
574   - cr0 *= -0.25*z2/(double)(k*k);
575   - cs0 += cr0*w0;
576   - }
577   - cyv0 = M_2_PI*(cec*cjv0-cs0);
578   - cs1 = cone;
579   - w1 = 0.0;
580   - cr1 = cone;
581   - for (k=1;k<=30;k++) {
582   - w1 += 1.0/k;
583   - cr1 *= -0.25*z2/(k*(k+1.0));
584   - cs1 += cr1*(2.0*w1+1.0/(k+1.0));
585   - }
586   - cyv1 = M_2_PI*(cec*cjv1-1.0/z1-0.25*z1*cs1);
587   - }
588   - }
589   - if (real(z) < 0.0) {
590   - cfac0 = exp(pv0*cii);
591   - cfac1 = exp(pv1*cii);
592   - if (imag(z) < 0.0) {
593   - cyv0 = cfac0*cyv0-2.0*cii*cos(pv0)*cjv0;
594   - cyv1 = cfac1*cyv1-2.0*cii*cos(pv1)*cjv1;
595   - cjv0 /= cfac0;
596   - cjv1 /= cfac1;
597   - }
598   - else if (imag(z) > 0.0) {
599   - cyv0 = cyv0/cfac0+2.0*cii*cos(pv0)*cjv0;
600   - cyv1 = cyv1/cfac1+2.0*cii*cos(pv1)*cjv1;
601   - cjv0 *= cfac0;
602   - cjv1 *= cfac1;
603   - }
604   - }
605   - cjv[0] = cjv0;
606   - cjv[1] = cjv1;
607   - if ((n >= 2) && (n <= (int)(0.25*a0))) {
608   - cf0 = cjv0;
609   - cf1 = cjv1;
610   - for (k=2;k<= n;k++) {
611   - cf = 2.0*(k+v0-1.0)*cf1/z-cf0;
612   - cjv[k] = cf;
613   - cf0 = cf1;
614   - cf1 = cf;
615   - }
616   - }
617   - else if (n >= 2) {
618   - m = msta1(a0,200);
619   - if (m < n) n = m;
620   - else m = msta2(a0,n,15);
621   - cf2 = czero;
622   - cf1 = complex<double>(1.0e-100,0.0);
623   - for (k=m;k>=0;k--) {
624   - cf = 2.0*(v0+k+1.0)*cf1/z-cf2;
625   - if (k <= n) cjv[k] = cf;
626   - cf2 = cf1;
627   - cf1 = cf;
628   - }
629   - if (abs(cjv0) > abs(cjv1)) cs = cjv0/cf;
630   - else cs = cjv1/cf2;
631   - for (k=0;k<=n;k++) {
632   - cjv[k] *= cs;
633   - }
634   - }
635   - cjvp[0] = v0*cjv[0]/z-cjv[1];
636   - for (k=1;k<=n;k++) {
637   - cjvp[k] = -(k+v0)*cjv[k]/z+cjv[k-1];
638   - }
639   - cyv[0] = cyv0;
640   - cyv[1] = cyv1;
641   - ya0 = abs(cyv0);
642   - lb = 0;
643   - cg0 = cyv0;
644   - cg1 = cyv1;
645   - for (k=2;k<=n;k++) {
646   - cyk = 2.0*(v0+k-1.0)*cg1/z-cg0;
647   - yak = abs(cyk);
648   - ya1 = abs(cg0);
649   - if ((yak < ya0) && (yak< ya1)) lb = k;
650   - cyv[k] = cyk;
651   - cg0 = cg1;
652   - cg1 = cyk;
653   - }
654   - lb0 = 0;
655   - if ((lb > 4) && (imag(z) != 0.0)) {
656   - while(lb != lb0) {
657   - ch2 = cone;
658   - ch1 = czero;
659   - lb0 = lb;
660   - for (k=lb;k>=1;k--) {
661   - ch0 = 2.0*(k+v0)*ch1/z-ch2;
662   - ch2 = ch1;
663   - ch1 = ch0;
664   - }
665   - cp12 = ch0;
666   - cp22 = ch2;
667   - ch2 = czero;
668   - ch1 = cone;
669   - for (k=lb;k>=1;k--) {
670   - ch0 = 2.0*(k+v0)*ch1/z-ch2;
671   - ch2 = ch1;
672   - ch1 = ch0;
673   - }
674   - cp11 = ch0;
675   - cp21 = ch2;
676   - if (lb == n)
677   - cjv[lb+1] = 2.0*(lb+v0)*cjv[lb]/z-cjv[lb-1];
678   - if (abs(cjv[0]) > abs(cjv[1])) {
679   - cyv[lb+1] = (cjv[lb+1]*cyv0-2.0*cp11/(M_PI*z))/cjv[0];
680   - cyv[lb] = (cjv[lb]*cyv0+2.0*cp12/(M_PI*z))/cjv[0];
681   - }
682   - else {
683   - cyv[lb+1] = (cjv[lb+1]*cyv1-2.0*cp21/(M_PI*z))/cjv[1];
684   - cyv[lb] = (cjv[lb]*cyv1+2.0*cp22/(M_PI*z))/cjv[1];
685   - }
686   - cyl2 = cyv[lb+1];
687   - cyl1 = cyv[lb];
688   - for (k=lb-1;k>=0;k--) {
689   - cylk = 2.0*(k+v0+1.0)*cyl1/z-cyl2;
690   - cyv[k] = cylk;
691   - cyl2 = cyl1;
692   - cyl1 = cylk;
693   - }
694   - cyl1 = cyv[lb];
695   - cyl2 = cyv[lb+1];
696   - for (k=lb+1;k<n;k++) {
697   - cylk = 2.0*(k+v0)*cyl2/z-cyl1;
698   - cyv[k+1] = cylk;
699   - cyl1 = cyl2;
700   - cyl2 = cylk;
701   - }
702   - for (k=2;k<=n;k++) {
703   - wa = abs(cyv[k]);
704   - if (wa < abs(cyv[k-1])) lb = k;
705   - }
706   - }
707   - }
708   - cyvp[0] = v0*cyv[0]/z-cyv[1];
709   - for (k=1;k<=n;k++) {
710   - cyvp[k] = cyv[k-1]-(k+v0)*cyv[k]/z;
711   - }
712   - vm = n+v0;
713   - return 0;
714   -}
715   -
716   -
  1 +// cbessjy.cpp -- complex Bessel functions.
  2 +// Algorithms and coefficient values from "Computation of Special
  3 +// Functions", Zhang and Jin, John Wiley and Sons, 1996.
  4 +//
  5 +// (C) 2003, C. Bond. All rights reserved.
  6 +//
  7 +#include <complex>
  8 +using namespace std;
  9 +#include "bessel.h"
  10 +double gamma(double);
  11 +
  12 +static complex<double> cii(0.0,1.0);
  13 +static complex<double> cone(1.0,0.0);
  14 +static complex<double> czero(0.0,0.0);
  15 +
  16 +int cbessjy01(complex<double> z,complex<double> &cj0,complex<double> &cj1,
  17 + complex<double> &cy0,complex<double> &cy1,complex<double> &cj0p,
  18 + complex<double> &cj1p,complex<double> &cy0p,complex<double> &cy1p)
  19 +{
  20 + complex<double> z1,z2,cr,cp,cs,cp0,cq0,cp1,cq1,ct1,ct2,cu;
  21 + double a0,w0,w1;
  22 + int k,kz;
  23 +
  24 + static double a[] = {
  25 + -7.03125e-2,
  26 + 0.112152099609375,
  27 + -0.5725014209747314,
  28 + 6.074042001273483,
  29 + -1.100171402692467e2,
  30 + 3.038090510922384e3,
  31 + -1.188384262567832e5,
  32 + 6.252951493434797e6,
  33 + -4.259392165047669e8,
  34 + 3.646840080706556e10,
  35 + -3.833534661393944e12,
  36 + 4.854014686852901e14,
  37 + -7.286857349377656e16,
  38 + 1.279721941975975e19
  39 + };
  40 + static double b[] = {
  41 + 7.32421875e-2,
  42 + -0.2271080017089844,
  43 + 1.727727502584457,
  44 + -2.438052969955606e1,
  45 + 5.513358961220206e2,
  46 + -1.825775547429318e4,
  47 + 8.328593040162893e5,
  48 + -5.006958953198893e7,
  49 + 3.836255180230433e9,
  50 + -3.649010818849833e11,
  51 + 4.218971570284096e13,
  52 + -5.827244631566907e15,
  53 + 9.476288099260110e17,
  54 + -1.792162323051699e20
  55 + };
  56 + static double a1[] = {
  57 + 0.1171875,
  58 + -0.1441955566406250,
  59 + 0.6765925884246826,
  60 + -6.883914268109947,
  61 + 1.215978918765359e2,
  62 + -3.302272294480852e3,
  63 + 1.276412726461746e5,
  64 + -6.656367718817688e6,
  65 + 4.502786003050393e8,
  66 + -3.833857520742790e10,
  67 + 4.011838599133198e12,
  68 + -5.060568503314727e14,
  69 + 7.572616461117958e16,
  70 + -1.326257285320556e19
  71 + };
  72 + static double b1[] = {
  73 + -0.1025390625,
  74 + 0.2775764465332031,
  75 + -1.993531733751297,
  76 + 2.724882731126854e1,
  77 + -6.038440767050702e2,
  78 + 1.971837591223663e4,
  79 + -8.902978767070678e5,
  80 + 5.310411010968522e7,
  81 + -4.043620325107754e9,
  82 + 3.827011346598605e11,
  83 + -4.406481417852278e13,
  84 + 6.065091351222699e15,
  85 + -9.833883876590679e17,
  86 + 1.855045211579828e20
  87 + };
  88 +
  89 + a0 = abs(z);
  90 + z2 = z*z;
  91 + z1 = z;
  92 + if (a0 == 0.0) {
  93 + cj0 = cone;
  94 + cj1 = czero;
  95 + cy0 = complex<double>(-1e308,0);
  96 + cy1 = complex<double>(-1e308,0);
  97 + cj0p = czero;
  98 + cj1p = complex<double>(0.5,0.0);
  99 + cy0p = complex<double>(1e308,0);
  100 + cy1p = complex<double>(1e308,0);
  101 + return 0;
  102 + }
  103 + if (real(z) < 0.0) z1 = -z;
  104 + if (a0 <= 12.0) {
  105 + cj0 = cone;
  106 + cr = cone;
  107 + for (k=1; k<=40; k++) {
  108 + cr *= -0.25*z2/(double)(k*k);
  109 + cj0 += cr;
  110 + if (abs(cr) < abs(cj0)*eps) break;
  111 + }
  112 + cj1 = cone;
  113 + cr = cone;
  114 + for (k=1; k<=40; k++) {
  115 + cr *= -0.25*z2/(k*(k+1.0));
  116 + cj1 += cr;
  117 + if (abs(cr) < abs(cj1)*eps) break;
  118 + }
  119 + cj1 *= 0.5*z1;
  120 + w0 = 0.0;
  121 + cr = cone;
  122 + cs = czero;
  123 + for (k=1; k<=40; k++) {
  124 + w0 += 1.0/k;
  125 + cr *= -0.25*z2/(double)(k*k);
  126 + cp = cr*w0;
  127 + cs += cp;
  128 + if (abs(cp) < abs(cs)*eps) break;
  129 + }
  130 + cy0 = M_2_PI*((log(0.5*z1)+el)*cj0-cs);
  131 + w1 = 0.0;
  132 + cr = cone;
  133 + cs = cone;
  134 + for (k=1; k<=40; k++) {
  135 + w1 += 1.0/k;
  136 + cr *= -0.25*z2/(k*(k+1.0));
  137 + cp = cr*(2.0*w1+1.0/(k+1.0));
  138 + cs += cp;
  139 + if (abs(cp) < abs(cs)*eps) break;
  140 + }
  141 + cy1 = M_2_PI*((log(0.5*z1)+el)*cj1-1.0/z1-0.25*z1*cs);
  142 + }
  143 + else {
  144 + if (a0 >= 50.0) kz = 8; // can be changed to 10
  145 + else if (a0 >= 35.0) kz = 10; // " " " 12
  146 + else kz = 12; // " " " 14
  147 + ct1 = z1 - M_PI_4;
  148 + cp0 = cone;
  149 + for (k=0; k<kz; k++) {
  150 + cp0 += a[k]*pow(z1,-2.0*k-2.0);
  151 + }
  152 + cq0 = -0.125/z1;
  153 + for (k=0; k<kz; k++) {
  154 + cq0 += b[k]*pow(z1,-2.0*k-3.0);
  155 + }
  156 + cu = sqrt(M_2_PI/z1);
  157 + cj0 = cu*(cp0*cos(ct1)-cq0*sin(ct1));
  158 + cy0 = cu*(cp0*sin(ct1)+cq0*cos(ct1));
  159 + ct2 = z1 - 0.75*M_PI;
  160 + cp1 = cone;
  161 + for (k=0; k<kz; k++) {
  162 + cp1 += a1[k]*pow(z1,-2.0*k-2.0);
  163 + }
  164 + cq1 = 0.375/z1;
  165 + for (k=0; k<kz; k++) {
  166 + cq1 += b1[k]*pow(z1,-2.0*k-3.0);
  167 + }
  168 + cj1 = cu*(cp1*cos(ct2)-cq1*sin(ct2));
  169 + cy1 = cu*(cp1*sin(ct2)+cq1*cos(ct2));
  170 + }
  171 + if (real(z) < 0.0) {
  172 + if (imag(z) < 0.0) {
  173 + cy0 -= 2.0*cii*cj0;
  174 + cy1 = -(cy1-2.0*cii*cj1);
  175 + }
  176 + else if (imag(z) > 0.0) {
  177 + cy0 += 2.0*cii*cj0;
  178 + cy1 = -(cy1+2.0*cii*cj1);
  179 + }
  180 + cj1 = -cj1;
  181 + }
  182 + cj0p = -cj1;
  183 + cj1p = cj0-cj1/z;
  184 + cy0p = -cy1;
  185 + cy1p = cy0-cy1/z;
  186 + return 0;
  187 +}
  188 +
  189 +int cbessjyna(int n,complex<double> z,int &nm,complex<double> *cj,
  190 + complex<double> *cy,complex<double> *cjp,complex<double> *cyp)
  191 +{
  192 + complex<double> cbj0,cbj1,cby0,cby1,cj0,cjk,cj1,cf,cf1,cf2;
  193 + complex<double> cs,cg0,cg1,cyk,cyl1,cyl2,cylk,cp11,cp12,cp21,cp22;
  194 + complex<double> ch0,ch1,ch2;
  195 + double a0,yak,ya1,ya0,wa;
  196 + int m,k,lb,lb0;
  197 +
  198 + if (n < 0) return 1;
  199 + a0 = abs(z);
  200 + nm = n;
  201 + if (a0 < 1.0e-100) {
  202 + for (k=0; k<=n; k++) {
  203 + cj[k] = czero;
  204 + cy[k] = complex<double> (-1e308,0);
  205 + cjp[k] = czero;
  206 + cyp[k] = complex<double>(1e308,0);
  207 + }
  208 + cj[0] = cone;
  209 + cjp[1] = complex<double>(0.5,0.0);
  210 + return 0;
  211 + }
  212 + cbessjy01(z,cj[0],cj[1],cy[0],cy[1],cjp[0],cjp[1],cyp[0],cyp[1]);
  213 + cbj0 = cj[0];
  214 + cbj1 = cj[1];
  215 + cby0 = cy[0];
  216 + cby1 = cy[1];
  217 + if (n <= 1) return 0;
  218 + if (n < (int)0.25*a0) {
  219 + cj0 = cbj0;
  220 + cj1 = cbj1;
  221 + for (k=2; k<=n; k++) {
  222 + cjk = 2.0*(k-1.0)*cj1/z-cj0;
  223 + cj[k] = cjk;
  224 + cj0 = cj1;
  225 + cj1 = cjk;
  226 + }
  227 + }
  228 + else {
  229 + m = msta1(a0,200);
  230 + if (m < n) nm = m;
  231 + else m = msta2(a0,n,15);
  232 + cf2 = czero;
  233 + cf1 = complex<double> (1.0e-100,0.0);
  234 + for (k=m; k>=0; k--) {
  235 + cf = 2.0*(k+1.0)*cf1/z-cf2;
  236 + if (k <=nm) cj[k] = cf;
  237 + cf2 = cf1;
  238 + cf1 = cf;
  239 + }
  240 + if (abs(cbj0) > abs(cbj1)) cs = cbj0/cf;
  241 + else cs = cbj1/cf2;
  242 + for (k=0; k<=nm; k++) {
  243 + cj[k] *= cs;
  244 + }
  245 + }
  246 + for (k=2; k<=nm; k++) {
  247 + cjp[k] = cj[k-1]-(double)k*cj[k]/z;
  248 + }
  249 + ya0 = abs(cby0);
  250 + lb = 0;
  251 + cg0 = cby0;
  252 + cg1 = cby1;
  253 + for (k=2; k<=nm; k++) {
  254 + cyk = 2.0*(k-1.0)*cg1/z-cg0;
  255 + yak = abs(cyk);
  256 + ya1 = abs(cg0);
  257 + if ((yak < ya0) && (yak < ya1)) lb = k;
  258 + cy[k] = cyk;
  259 + cg0 = cg1;
  260 + cg1 = cyk;
  261 + }
  262 + lb0 = 0;
  263 + if ((lb > 4) && (imag(z) != 0.0)) {
  264 + while (lb != lb0) {
  265 + ch2 = cone;
  266 + ch1 = czero;
  267 + lb0 = lb;
  268 + for (k=lb; k>=1; k--) {
  269 + ch0 = 2.0*k*ch1/z-ch2;
  270 + ch2 = ch1;
  271 + ch1 = ch0;
  272 + }
  273 + cp12 = ch0;
  274 + cp22 = ch2;
  275 + ch2 = czero;
  276 + ch1 = cone;
  277 + for (k=lb; k>=1; k--) {
  278 + ch0 = 2.0*k*ch1/z-ch2;
  279 + ch2 = ch1;
  280 + ch1 = ch0;
  281 + }
  282 + cp11 = ch0;
  283 + cp21 = ch2;
  284 + if (lb == nm)
  285 + cj[lb+1] = 2.0*lb*cj[lb]/z-cj[lb-1];
  286 + if (abs(cj[0]) > abs(cj[1])) {
  287 + cy[lb+1] = (cj[lb+1]*cby0-2.0*cp11/(M_PI*z))/cj[0];
  288 + cy[lb] = (cj[lb]*cby0+2.0*cp12/(M_PI*z))/cj[0];
  289 + }
  290 + else {
  291 + cy[lb+1] = (cj[lb+1]*cby1-2.0*cp21/(M_PI*z))/cj[1];
  292 + cy[lb] = (cj[lb]*cby1+2.0*cp22/(M_PI*z))/cj[1];
  293 + }
  294 + cyl2 = cy[lb+1];
  295 + cyl1 = cy[lb];
  296 + for (k=lb-1; k>=0; k--) {
  297 + cylk = 2.0*(k+1.0)*cyl1/z-cyl2;
  298 + cy[k] = cylk;
  299 + cyl2 = cyl1;
  300 + cyl1 = cylk;
  301 + }
  302 + cyl1 = cy[lb];
  303 + cyl2 = cy[lb+1];
  304 + for (k=lb+1; k<n; k++) {
  305 + cylk = 2.0*k*cyl2/z-cyl1;
  306 + cy[k+1] = cylk;
  307 + cyl1 = cyl2;
  308 + cyl2 = cylk;
  309 + }
  310 + for (k=2; k<=nm; k++) {
  311 + wa = abs(cy[k]);
  312 + if (wa < abs(cy[k-1])) lb = k;
  313 + }
  314 + }
  315 + }
  316 + for (k=2; k<=nm; k++) {
  317 + cyp[k] = cy[k-1]-(double)k*cy[k]/z;
  318 + }
  319 + return 0;
  320 +}
  321 +
  322 +int cbessjynb(int n,complex<double> z,int &nm,complex<double> *cj,
  323 + complex<double> *cy,complex<double> *cjp,complex<double> *cyp)
  324 +{
  325 + complex<double> cf,cf0,cf1,cf2,cbs,csu,csv,cs0,ce;
  326 + complex<double> ct1,cp0,cq0,cp1,cq1,cu,cbj0,cby0,cbj1,cby1;
  327 + complex<double> cyy,cbjk,ct2;
  328 + double a0,y0;
  329 + int k,m;
  330 + static double a[] = {
  331 + -0.7031250000000000e-1,
  332 + 0.1121520996093750,
  333 + -0.5725014209747314,
  334 + 6.074042001273483
  335 + };
  336 + static double b[] = {
  337 + 0.7324218750000000e-1,
  338 + -0.2271080017089844,
  339 + 1.727727502584457,
  340 + -2.438052969955606e1
  341 + };
  342 + static double a1[] = {
  343 + 0.1171875,
  344 + -0.1441955566406250,
  345 + 0.6765925884246826,
  346 + -6.883914268109947
  347 + };
  348 + static double b1[] = {
  349 + -0.1025390625,
  350 + 0.2775764465332031,
  351 + -1.993531733751297,
  352 + 2.724882731126854e1
  353 + };
  354 +
  355 + y0 = abs(imag(z));
  356 + a0 = abs(z);
  357 + nm = n;
  358 + if (a0 < 1.0e-100) {
  359 + for (k=0; k<=n; k++) {
  360 + cj[k] = czero;
  361 + cy[k] = complex<double> (-1e308,0);
  362 + cjp[k] = czero;
  363 + cyp[k] = complex<double>(1e308,0);
  364 + }
  365 + cj[0] = cone;
  366 + cjp[1] = complex<double>(0.5,0.0);
  367 + return 0;
  368 + }
  369 + if ((a0 <= 300.0) || (n > (int)(0.25*a0))) {
  370 + if (n == 0) nm = 1;
  371 + m = msta1(a0,200);
  372 + if (m < nm) nm = m;
  373 + else m = msta2(a0,nm,15);
  374 + cbs = czero;
  375 + csu = czero;
  376 + csv = czero;
  377 + cf2 = czero;
  378 + cf1 = complex<double> (1.0e-100,0.0);
  379 + for (k=m; k>=0; k--) {
  380 + cf = 2.0*(k+1.0)*cf1/z-cf2;
  381 + if (k <= nm) cj[k] = cf;
  382 + if (((k & 1) == 0) && (k != 0)) {
  383 + if (y0 <= 1.0) {
  384 + cbs += 2.0*cf;
  385 + }
  386 + else {
  387 + cbs += (-1)*((k & 2)-1)*2.0*cf;
  388 + }
  389 + csu += (double)((-1)*((k & 2)-1))*cf/(double)k;
  390 + }
  391 + else if (k > 1) {
  392 + csv += (double)((-1)*((k & 2)-1)*k)*cf/(double)(k*k-1.0);
  393 + }
  394 + cf2 = cf1;
  395 + cf1 = cf;
  396 + }
  397 + if (y0 <= 1.0) cs0 = cbs+cf;
  398 + else cs0 = (cbs+cf)/cos(z);
  399 + for (k=0; k<=nm; k++) {
  400 + cj[k] /= cs0;
  401 + }
  402 + ce = log(0.5*z)+el;
  403 + cy[0] = M_2_PI*(ce*cj[0]-4.0*csu/cs0);
  404 + cy[1] = M_2_PI*(-cj[0]/z+(ce-1.0)*cj[1]-4.0*csv/cs0);
  405 + }
  406 + else {
  407 + ct1 = z-M_PI_4;
  408 + cp0 = cone;
  409 + for (k=0; k<4; k++) {
  410 + cp0 += a[k]*pow(z,-2.0*k-2.0);
  411 + }
  412 + cq0 = -0.125/z;
  413 + for (k=0; k<4; k++) {
  414 + cq0 += b[k] *pow(z,-2.0*k-3.0);
  415 + }
  416 + cu = sqrt(M_2_PI/z);
  417 + cbj0 = cu*(cp0*cos(ct1)-cq0*sin(ct1));
  418 + cby0 = cu*(cp0*sin(ct1)+cq0*cos(ct1));
  419 + cj[0] = cbj0;
  420 + cy[0] = cby0;
  421 + ct2 = z-0.75*M_PI;
  422 + cp1 = cone;
  423 + for (k=0; k<4; k++) {
  424 + cp1 += a1[k]*pow(z,-2.0*k-2.0);
  425 + }
  426 + cq1 = 0.375/z;
  427 + for (k=0; k<4; k++) {
  428 + cq1 += b1[k]*pow(z,-2.0*k-3.0);
  429 + }
  430 + cbj1 = cu*(cp1*cos(ct2)-cq1*sin(ct2));
  431 + cby1 = cu*(cp1*sin(ct2)+cq1*cos(ct2));
  432 + cj[1] = cbj1;
  433 + cy[1] = cby1;
  434 + for (k=2; k<=n; k++) {
  435 + cbjk = 2.0*(k-1.0)*cbj1/z-cbj0;
  436 + cj[k] = cbjk;
  437 + cbj0 = cbj1;
  438 + cbj1 = cbjk;
  439 + }
  440 + }
  441 + cjp[0] = -cj[1];
  442 + for (k=1; k<=nm; k++) {
  443 + cjp[k] = cj[k-1]-(double)k*cj[k]/z;
  444 + }
  445 + if (abs(cj[0]) > 1.0)
  446 + cy[1] = (cj[1]*cy[0]-2.0/(M_PI*z))/cj[0];
  447 + for (k=2; k<=nm; k++) {
  448 + if (abs(cj[k-1]) >= abs(cj[k-2]))
  449 + cyy = (cj[k]*cy[k-1]-2.0/(M_PI*z))/cj[k-1];
  450 + else
  451 + cyy = (cj[k]*cy[k-2]-4.0*(k-1.0)/(M_PI*z*z))/cj[k-2];
  452 + cy[k] = cyy;
  453 + }
  454 + cyp[0] = -cy[1];
  455 + for (k=1; k<=nm; k++) {
  456 + cyp[k] = cy[k-1]-(double)k*cy[k]/z;
  457 + }
  458 +
  459 + return 0;
  460 +}
  461 +
  462 +int cbessjyva(double v,complex<double> z,double &vm,complex<double>*cjv,
  463 + complex<double>*cyv,complex<double>*cjvp,complex<double>*cyvp)
  464 +{
  465 + complex<double> z1,z2,zk,cjvl,cr,ca,cjv0,cjv1,cpz,crp;
  466 + complex<double> cqz,crq,ca0,cck,csk,cyv0,cyv1,cju0,cju1,cb;
  467 + complex<double> cs,cs0,cr0,cs1,cr1,cec,cf,cf0,cf1,cf2;
  468 + complex<double> cfac0,cfac1,cg0,cg1,cyk,cp11,cp12,cp21,cp22;
  469 + complex<double> ch0,ch1,ch2,cyl1,cyl2,cylk;
  470 +
  471 + double a0,v0,pv0,pv1,vl,ga,gb,vg,vv,w0,w1,ya0,yak,ya1,wa;
  472 + int j,n,k,kz,l,lb,lb0,m;
  473 +
  474 + a0 = abs(z);
  475 + z1 = z;
  476 + z2 = z*z;
  477 + n = (int)v;
  478 +
  479 +
  480 + v0 = v-n;
  481 +
  482 + pv0 = M_PI*v0;
  483 + pv1 = M_PI*(1.0+v0);
  484 + if (a0 < 1.0e-100) {
  485 + for (k=0; k<=n; k++) {
  486 + cjv[k] = czero;
  487 + cyv[k] = complex<double> (-1e308,0);
  488 + cjvp[k] = czero;
  489 + cyvp[k] = complex<double> (1e308,0);
  490 +
  491 + }
  492 + if (v0 == 0.0) {
  493 + cjv[0] = cone;
  494 + cjvp[1] = complex<double> (0.5,0.0);
  495 + }
  496 + else {
  497 + cjvp[0] = complex<double> (1e308,0);
  498 + }
  499 + vm = v;
  500 + return 0;
  501 + }
  502 + if (real(z1) < 0.0) z1 = -z;
  503 + if (a0 <= 12.0) {
  504 + for (l=0; l<2; l++) {
  505 + vl = v0+l;
  506 + cjvl = cone;
  507 + cr = cone;
  508 + for (k=1; k<=40; k++) {
  509 + cr *= -0.25*z2/(k*(k+vl));
  510 + cjvl += cr;
  511 + if (abs(cr) < abs(cjvl)*eps) break;
  512 + }
  513 + vg = 1.0 + vl;
  514 + ga = gamma(vg);
  515 + ca = pow(0.5*z1,vl)/ga;
  516 + if (l == 0) cjv0 = cjvl*ca;
  517 + else cjv1 = cjvl*ca;
  518 + }
  519 + }
  520 + else {
  521 + if (a0 >= 50.0) kz = 8;
  522 + else if (a0 >= 35.0) kz = 10;
  523 + else kz = 11;
  524 + for (j=0; j<2; j++) {
  525 + vv = 4.0*(j+v0)*(j+v0);
  526 + cpz = cone;
  527 + crp = cone;
  528 + for (k=1; k<=kz; k++) {
  529 + crp = -0.78125e-2*crp*(vv-pow(4.0*k-3.0,2.0))*
  530 + (vv-pow(4.0*k-1.0,2.0))/(k*(2.0*k-1.0)*z2);
  531 + cpz += crp;
  532 + }
  533 + cqz = cone;
  534 + crq = cone;
  535 + for (k=1; k<=kz; k++) {
  536 + crq = -0.78125e-2*crq*(vv-pow(4.0*k-1.0,2.0))*
  537 + (vv-pow(4.0*k+1.0,2.0))/(k*(2.0*k+1.0)*z2);
  538 + cqz += crq;
  539 + }
  540 + cqz *= 0.125*(vv-1.0)/z1;
  541 + zk = z1-(0.5*(j+v0)+0.25)*M_PI;
  542 + ca0 = sqrt(M_2_PI/z1);
  543 + cck = cos(zk);
  544 + csk = sin(zk);
  545 + if (j == 0) {
  546 + cjv0 = ca0*(cpz*cck-cqz*csk);
  547 + cyv0 = ca0*(cpz*csk+cqz+cck);
  548 + }
  549 + else {
  550 + cjv1 = ca0*(cpz*cck-cqz*csk);
  551 + cyv1 = ca0*(cpz*csk+cqz*cck);
  552 + }
  553 + }
  554 + }
  555 + if (a0 <= 12.0) {
  556 + if (v0 != 0.0) {
  557 + for (l=0; l<2; l++) {
  558 + vl = v0+l;
  559 + cjvl = cone;
  560 + cr = cone;
  561 + for (k=1; k<=40; k++) {
  562 + cr *= -0.25*z2/(k*(k-vl));
  563 + cjvl += cr;
  564 + if (abs(cr) < abs(cjvl)*eps) break;
  565 + }
  566 + vg = 1.0-vl;
  567 + gb = gamma(vg);
  568 + cb = pow(2.0/z1,vl)/gb;
  569 + if (l == 0) cju0 = cjvl*cb;
  570 + else cju1 = cjvl*cb;
  571 + }
  572 + cyv0 = (cjv0*cos(pv0)-cju0)/sin(pv0);
  573 + cyv1 = (cjv1*cos(pv1)-cju1)/sin(pv1);
  574 + }
  575 + else {
  576 + cec = log(0.5*z1)+el;
  577 + cs0 = czero;
  578 + w0 = 0.0;
  579 + cr0 = cone;
  580 + for (k=1; k<=30; k++) {
  581 + w0 += 1.0/k;
  582 + cr0 *= -0.25*z2/(double)(k*k);
  583 + cs0 += cr0*w0;
  584 + }
  585 + cyv0 = M_2_PI*(cec*cjv0-cs0);
  586 + cs1 = cone;
  587 + w1 = 0.0;
  588 + cr1 = cone;
  589 + for (k=1; k<=30; k++) {
  590 + w1 += 1.0/k;
  591 + cr1 *= -0.25*z2/(k*(k+1.0));
  592 + cs1 += cr1*(2.0*w1+1.0/(k+1.0));
  593 + }
  594 + cyv1 = M_2_PI*(cec*cjv1-1.0/z1-0.25*z1*cs1);
  595 + }
  596 + }
  597 + if (real(z) < 0.0) {
  598 + cfac0 = exp(pv0*cii);
  599 + cfac1 = exp(pv1*cii);
  600 + if (imag(z) < 0.0) {
  601 + cyv0 = cfac0*cyv0-2.0*cii*cos(pv0)*cjv0;
  602 + cyv1 = cfac1*cyv1-2.0*cii*cos(pv1)*cjv1;
  603 + cjv0 /= cfac0;
  604 + cjv1 /= cfac1;
  605 + }
  606 + else if (imag(z) > 0.0) {
  607 + cyv0 = cyv0/cfac0+2.0*cii*cos(pv0)*cjv0;
  608 + cyv1 = cyv1/cfac1+2.0*cii*cos(pv1)*cjv1;
  609 + cjv0 *= cfac0;
  610 + cjv1 *= cfac1;
  611 + }
  612 + }
  613 + cjv[0] = cjv0;
  614 + cjv[1] = cjv1;
  615 + if ((n >= 2) && (n <= (int)(0.25*a0))) {
  616 + cf0 = cjv0;
  617 + cf1 = cjv1;
  618 + for (k=2; k<= n; k++) {
  619 + cf = 2.0*(k+v0-1.0)*cf1/z-cf0;
  620 + cjv[k] = cf;
  621 + cf0 = cf1;
  622 + cf1 = cf;
  623 + }
  624 + }
  625 + else if (n >= 2) {
  626 + m = msta1(a0,200);
  627 + if (m < n) n = m;
  628 + else m = msta2(a0,n,15);
  629 + cf2 = czero;
  630 + cf1 = complex<double>(1.0e-100,0.0);
  631 + for (k=m; k>=0; k--) {
  632 + cf = 2.0*(v0+k+1.0)*cf1/z-cf2;
  633 + if (k <= n) cjv[k] = cf;
  634 + cf2 = cf1;
  635 + cf1 = cf;
  636 + }
  637 + if (abs(cjv0) > abs(cjv1)) cs = cjv0/cf;
  638 + else cs = cjv1/cf2;
  639 + for (k=0; k<=n; k++) {
  640 + cjv[k] *= cs;
  641 + }
  642 + }
  643 + cjvp[0] = v0*cjv[0]/z-cjv[1];
  644 + for (k=1; k<=n; k++) {
  645 + cjvp[k] = -(k+v0)*cjv[k]/z+cjv[k-1];
  646 + }
  647 + cyv[0] = cyv0;
  648 + cyv[1] = cyv1;
  649 + ya0 = abs(cyv0);
  650 + lb = 0;
  651 + cg0 = cyv0;
  652 + cg1 = cyv1;
  653 + for (k=2; k<=n; k++) {
  654 + cyk = 2.0*(v0+k-1.0)*cg1/z-cg0;
  655 + yak = abs(cyk);
  656 + ya1 = abs(cg0);
  657 + if ((yak < ya0) && (yak< ya1)) lb = k;
  658 + cyv[k] = cyk;
  659 + cg0 = cg1;
  660 + cg1 = cyk;
  661 + }
  662 + lb0 = 0;
  663 + if ((lb > 4) && (imag(z) != 0.0)) {
  664 + while(lb != lb0) {
  665 + ch2 = cone;
  666 + ch1 = czero;
  667 + lb0 = lb;
  668 + for (k=lb; k>=1; k--) {
  669 + ch0 = 2.0*(k+v0)*ch1/z-ch2;
  670 + ch2 = ch1;
  671 + ch1 = ch0;
  672 + }
  673 + cp12 = ch0;
  674 + cp22 = ch2;
  675 + ch2 = czero;
  676 + ch1 = cone;
  677 + for (k=lb; k>=1; k--) {
  678 + ch0 = 2.0*(k+v0)*ch1/z-ch2;
  679 + ch2 = ch1;
  680 + ch1 = ch0;
  681 + }
  682 + cp11 = ch0;
  683 + cp21 = ch2;
  684 + if (lb == n)
  685 + cjv[lb+1] = 2.0*(lb+v0)*cjv[lb]/z-cjv[lb-1];
  686 + if (abs(cjv[0]) > abs(cjv[1])) {
  687 + cyv[lb+1] = (cjv[lb+1]*cyv0-2.0*cp11/(M_PI*z))/cjv[0];
  688 + cyv[lb] = (cjv[lb]*cyv0+2.0*cp12/(M_PI*z))/cjv[0];
  689 + }
  690 + else {
  691 + cyv[lb+1] = (cjv[lb+1]*cyv1-2.0*cp21/(M_PI*z))/cjv[1];
  692 + cyv[lb] = (cjv[lb]*cyv1+2.0*cp22/(M_PI*z))/cjv[1];
  693 + }
  694 + cyl2 = cyv[lb+1];
  695 + cyl1 = cyv[lb];
  696 + for (k=lb-1; k>=0; k--) {
  697 + cylk = 2.0*(k+v0+1.0)*cyl1/z-cyl2;
  698 + cyv[k] = cylk;
  699 + cyl2 = cyl1;
  700 + cyl1 = cylk;
  701 + }
  702 + cyl1 = cyv[lb];
  703 + cyl2 = cyv[lb+1];
  704 + for (k=lb+1; k<n; k++) {
  705 + cylk = 2.0*(k+v0)*cyl2/z-cyl1;
  706 + cyv[k+1] = cylk;
  707 + cyl1 = cyl2;
  708 + cyl2 = cylk;
  709 + }
  710 + for (k=2; k<=n; k++) {
  711 + wa = abs(cyv[k]);
  712 + if (wa < abs(cyv[k-1])) lb = k;
  713 + }
  714 + }
  715 + }
  716 + cyvp[0] = v0*cyv[0]/z-cyv[1];
  717 + for (k=1; k<=n; k++) {
  718 + cyvp[k] = cyv[k-1]-(k+v0)*cyv[k]/z;
  719 + }
  720 + vm = n+v0;
  721 + return 0;
  722 +}
  723 +
  724 +
... ...
cudaKK.h
1   -__device__ double g(double v0, double v1)
2   -{
3   - return (v0 + v1)*log(abs(v0+v1)) + (v0-v1)*log(abs(v0-v1));
4   -}
5   -
6   -__device__ double hfin(double v0, double v1, double dv)
7   -{
8   - double e = 0.001;
9   - double t0 = g(v0+e, v1-dv)/dv;
10   - double t1 = 2*g(v0+e, v1)/dv;
11   - double t2 = g(v0+e, v1+dv)/dv;
12   -
13   - return -1.0/PI * (t0 - t1 + t2);
14   -}
15   -
16   -__global__ void devKramersKronig(double* gpuN, double* gpuK, int numVals, double nuStart, double nuEnd, double nOffset)
17   -{
18   - int i = blockIdx.x * blockDim.x + threadIdx.x;
19   -
20   - if(i >= numVals) return;
21   - double nuDelta = (nuEnd - nuStart)/(numVals - 1);
22   -
23   - double nu = nuStart + i*nuDelta;
24   - double n = 0.0;
25   - double jNu;
26   - double jK;
27   - for(int j=1; j<numVals-1; j++)
28   - {
29   - jNu = nuStart + j*nuDelta;
30   - jK = gpuK[j];
31   - n += hfin(nu, jNu, nuDelta) * jK;
32   - }
33   - gpuN[i] = n + nOffset;
34   -
35   -
36   -}
37   -
38   -void cudaKramersKronig(double* cpuN, double* cpuK, int nVals, double nuStart, double nuEnd, double nOffset)
39   -{
40   - double* gpuK;
41   - HANDLE_ERROR(cudaMalloc(&gpuK, sizeof(double)*nVals));
42   - HANDLE_ERROR(cudaMemcpy(gpuK, cpuK, sizeof(double)*nVals, cudaMemcpyHostToDevice));
43   - double* gpuN;
44   - HANDLE_ERROR(cudaMalloc(&gpuN, sizeof(double)*nVals));
45   -
46   - dim3 block(BLOCK_SIZE*BLOCK_SIZE);
47   - dim3 grid(nVals/block.x + 1);
48   - devKramersKronig<<<grid, block>>>(gpuN, gpuK, nVals, nuStart, nuEnd, nOffset);
49   -
50   - HANDLE_ERROR(cudaMemcpy(cpuN, gpuN, sizeof(double)*nVals, cudaMemcpyDeviceToHost));
51   -
52   - //free resources
53   - HANDLE_ERROR(cudaFree(gpuK));
54   - HANDLE_ERROR(cudaFree(gpuN));
55   -}
56   -
57   -__global__ void devComputeSpectrum(double* I, double2* B, double* alpha, int Nl,
58   - int nSamples, int nLambda, double oThetaI, double oThetaO, double cThetaI, double cThetaO)
59   -{
60   - int i = blockIdx.x * blockDim.x + threadIdx.x;
61   - if(i >= nLambda)
62   - return;
63   -
64   - //compute the delta-theta value
65   - double dTheta = (oThetaO - oThetaI)/nSamples;
66   -
67   - //allocate space for the Legendre polynomials
68   - double Ptheta[2];
69   -
70   - double cosTheta, theta;
71   - cuDoubleComplex Us;
72   - cuDoubleComplex UsSample;
73   - cuDoubleComplex U;
74   - //cuComplex Ui;
75   - //Ui.x = 2*PI;
76   - //Ui.y = 0.0;
77   - cuDoubleComplex numer;
78   - numer.x = 0.0;
79   - cuDoubleComplex exp_numer;
80   - cuDoubleComplex iL;
81   - cuDoubleComplex imag;
82   - imag.x = 0.0; imag.y = 1.0;
83   - double realFac;
84   - cuDoubleComplex complexFac;
85   - double PlTheta;
86   - double Isum = 0.0;
87   - //float maxVal = 0;
88   - //float val;
89   - for(int iTheta = 0; iTheta < nSamples; iTheta++)
90   - {
91   - //calculate theta
92   - theta = iTheta * dTheta + oThetaI;
93   - cosTheta = cos(theta);
94   -
95   - //initialize the theta Legendre polynomial
96   - Ptheta[0] = 1.0;
97   - Ptheta[1] = cosTheta;
98   -
99   - //initialize the scattered field
100   - Us.x = Us.y = 0.0;
101   - iL.x = 1.0;
102   - iL.y = 0.0;
103   - for(int l = 0; l<Nl; l++)
104   - {
105   - //compute the theta legendre polynomial
106   - if(l == 0)
107   - PlTheta = Ptheta[0];
108   - else if(l == 1)
109   - PlTheta = Ptheta[1];
110   - else
111   - {
112   - PlTheta = ((2*l - 1)*cosTheta*Ptheta[1] - (l - 1)*Ptheta[0])/l;
113   - Ptheta[0] = Ptheta[1];
114   - Ptheta[1] = PlTheta;
115   - }
116   -
117   - //compute the real components of the scattered field
118   - realFac = alpha[l] * PlTheta;
119   -
120   - //compute the complex components of the scattered field
121   - numer.x = 0.0;
122   - numer.y = -(l*PI)/2.0;
123   - exp_numer = cExp(numer);
124   -
125   - complexFac = cMult(B[Nl * i + l], exp_numer);
126   - complexFac = cMult(complexFac, iL);
127   -
128   -
129   - //combine the real and complex components
130   - UsSample = cMult(complexFac, realFac);
131   - Us = cAdd(Us, UsSample);
132   -
133   - //increment the imaginary exponent i^l
134   - iL = cMult(iL, imag);
135   -
136   -
137   - }
138   -
139   - //sum the scattered and incident fields
140   - if(theta >= cThetaI && theta <= cThetaO)
141   - U = cAdd(Us, 2*PI);
142   - else
143   - U = Us;
144   - Isum += (U.x*U.x + U.y*U.y) * sin(theta) * 2 * PI * dTheta;
145   - }
146   -
147   - I[i] = Isum;
148   -}
149   -
150   -void cudaComputeSpectrum(double* cpuI, double* cpuB, double* cpuAlpha,
151   - int Nl, int nLambda, double oThetaI, double oThetaO, double cThetaI, double cThetaO, int nSamples)
152   -{
153   - //copy everything to the GPU
154   - double2* gpuB;
155   - HANDLE_ERROR(cudaMalloc(&gpuB, sizeof(double2) * nLambda * Nl));
156   - HANDLE_ERROR(cudaMemcpy(gpuB, cpuB, sizeof(double2) * nLambda * Nl, cudaMemcpyHostToDevice));
157   -
158   -
159   - double* gpuAlpha;
160   - HANDLE_ERROR(cudaMalloc(&gpuAlpha, sizeof(double) * Nl));
161   - HANDLE_ERROR(cudaMemcpy(gpuAlpha, cpuAlpha, sizeof(double) * Nl, cudaMemcpyHostToDevice));
162   -
163   - double* gpuI;
164   - HANDLE_ERROR(cudaMalloc(&gpuI, sizeof(double) * nLambda));
165   - HANDLE_ERROR(cudaMemset(gpuI, 0, sizeof(double) * nLambda));
166   -
167   -
168   - //call the kernel to compute the spectrum
169   - dim3 block(BLOCK_SIZE*BLOCK_SIZE);
170   - dim3 grid(nLambda/block.x + 1);
171   -
172   - //devComputeSpectrum
173   - devComputeSpectrum<<<grid, block>>>(gpuI, (double2*)gpuB, gpuAlpha, Nl,
174   - nSamples, nLambda, oThetaI, oThetaO, cThetaI, cThetaO);
175   -
176   - HANDLE_ERROR(cudaMemcpy(cpuI, gpuI, sizeof(double) * nLambda, cudaMemcpyDeviceToHost));
177   -
178   - //printf("Final array value: %f\n", cpuI[nLambda-1]);
179   -
180   - HANDLE_ERROR(cudaFree(gpuB));
181   - HANDLE_ERROR(cudaFree(gpuAlpha));
182   - HANDLE_ERROR(cudaFree(gpuI));
183   -
184   -
185   -
186   -
  1 +#include <iostream>
  2 +using namespace std;
  3 +
  4 +__device__ double g(double v0, double v1)
  5 +{
  6 + return (v0 + v1)*log(abs(v0+v1)) + (v0-v1)*log(abs(v0-v1));
  7 +}
  8 +
  9 +__device__ double hfin(double v0, double v1, double dv)
  10 +{
  11 + double e = 0.001;
  12 + double t0 = g(v0+e, v1-dv)/dv;
  13 + double t1 = 2*g(v0+e, v1)/dv;
  14 + double t2 = g(v0+e, v1+dv)/dv;
  15 +
  16 + return -1.0/PI * (t0 - t1 + t2);
  17 +}
  18 +
  19 +__global__ void devKramersKronig(double* gpuN, double* gpuK, int numVals, double nuStart, double nuEnd, double nOffset)
  20 +{
  21 + int i = blockIdx.x * blockDim.x + threadIdx.x;
  22 +
  23 + if(i >= numVals) return;
  24 + double nuDelta = (nuEnd - nuStart)/(numVals - 1);
  25 +
  26 + double nu = nuStart + i*nuDelta;
  27 + double n = 0.0;
  28 + double jNu;
  29 + double jK;
  30 + for(int j=1; j<numVals-1; j++)
  31 + {
  32 + jNu = nuStart + j*nuDelta;
  33 + jK = gpuK[j];
  34 + n += hfin(nu, jNu, nuDelta) * jK;
  35 + }
  36 + gpuN[i] = n + nOffset;
  37 +
  38 +
  39 +}
  40 +
  41 +void cudaKramersKronig(double* cpuN, double* cpuK, int nVals, double nuStart, double nuEnd, double nOffset)
  42 +{
  43 + cout<<"Computing Kramers Kronig."<<endl;
  44 + //This function computes n given k
  45 +
  46 + double* gpuK;
  47 + HANDLE_ERROR(cudaMalloc(&gpuK, sizeof(double)*nVals));
  48 + HANDLE_ERROR(cudaMemcpy(gpuK, cpuK, sizeof(double)*nVals, cudaMemcpyHostToDevice));
  49 + double* gpuN;
  50 + HANDLE_ERROR(cudaMalloc(&gpuN, sizeof(double)*nVals));
  51 +
  52 + dim3 block(BLOCK_SIZE*BLOCK_SIZE);
  53 + dim3 grid(nVals/block.x + 1);
  54 + devKramersKronig<<<grid, block>>>(gpuN, gpuK, nVals, nuStart, nuEnd, nOffset);
  55 +
  56 + HANDLE_ERROR(cudaMemcpy(cpuN, gpuN, sizeof(double)*nVals, cudaMemcpyDeviceToHost));
  57 +
  58 + //free resources
  59 + HANDLE_ERROR(cudaFree(gpuK));
  60 + HANDLE_ERROR(cudaFree(gpuN));
  61 +}
  62 +
  63 +__global__ void devComputeSpectrum(double* I, double2* B, double* alpha, int Nl,
  64 + int nSamples, int nLambda, double oThetaI, double oThetaO, double cThetaI, double cThetaO)
  65 +{
  66 + int i = blockIdx.x * blockDim.x + threadIdx.x;
  67 + if(i >= nLambda)
  68 + return;
  69 +
  70 + //compute the delta-theta value
  71 + double dTheta = (oThetaO - oThetaI)/nSamples;
  72 +
  73 + //allocate space for the Legendre polynomials
  74 + double Ptheta[2];
  75 +
  76 + double cosTheta, theta;
  77 + cuDoubleComplex Us;
  78 + cuDoubleComplex UsSample;
  79 + cuDoubleComplex U;
  80 + //cuComplex Ui;
  81 + //Ui.x = 2*PI;
  82 + //Ui.y = 0.0;
  83 + cuDoubleComplex numer;
  84 + numer.x = 0.0;
  85 + cuDoubleComplex exp_numer;
  86 + cuDoubleComplex iL;
  87 + cuDoubleComplex imag;
  88 + imag.x = 0.0;
  89 + imag.y = 1.0;
  90 + double realFac;
  91 + cuDoubleComplex complexFac;
  92 + double PlTheta;
  93 + double Isum = 0.0;
  94 + //float maxVal = 0;
  95 + //float val;
  96 + for(int iTheta = 0; iTheta < nSamples; iTheta++)
  97 + {
  98 + //calculate theta
  99 + theta = iTheta * dTheta + oThetaI;
  100 + cosTheta = cos(theta);
  101 +
  102 + //initialize the theta Legendre polynomial
  103 + Ptheta[0] = 1.0;
  104 + Ptheta[1] = cosTheta;
  105 +
  106 + //initialize the scattered field
  107 + Us.x = Us.y = 0.0;
  108 + iL.x = 1.0;
  109 + iL.y = 0.0;
  110 + for(int l = 0; l<Nl; l++)
  111 + {
  112 + //compute the theta legendre polynomial
  113 + if(l == 0)
  114 + PlTheta = Ptheta[0];
  115 + else if(l == 1)
  116 + PlTheta = Ptheta[1];
  117 + else
  118 + {
  119 + PlTheta = ((2*l - 1)*cosTheta*Ptheta[1] - (l - 1)*Ptheta[0])/l;
  120 + Ptheta[0] = Ptheta[1];
  121 + Ptheta[1] = PlTheta;
  122 + }
  123 +
  124 + //compute the real components of the scattered field
  125 + realFac = alpha[l] * PlTheta;
  126 +
  127 + //compute the complex components of the scattered field
  128 + numer.x = 0.0;
  129 + numer.y = -(l*PI)/2.0;
  130 + exp_numer = cExp(numer);
  131 +
  132 + complexFac = cMult(B[Nl * i + l], exp_numer);
  133 + complexFac = cMult(complexFac, iL);
  134 +
  135 +
  136 + //combine the real and complex components
  137 + UsSample = cMult(complexFac, realFac);
  138 + Us = cAdd(Us, UsSample);
  139 +
  140 + //increment the imaginary exponent i^l
  141 + iL = cMult(iL, imag);
  142 +
  143 +
  144 + }
  145 +
  146 + //sum the scattered and incident fields
  147 + if(theta >= cThetaI && theta <= cThetaO)
  148 + U = cAdd(Us, 2*PI);
  149 + else
  150 + U = Us;
  151 + Isum += (U.x*U.x + U.y*U.y) * sin(theta) * 2 * PI * dTheta;
  152 + }
  153 +
  154 + I[i] = Isum;
  155 +}
  156 +
  157 +void cudaComputeSpectrum(double* cpuI, double* cpuB, double* cpuAlpha,
  158 + int Nl, int nLambda, double oThetaI, double oThetaO, double cThetaI, double cThetaO, int nSamples)
  159 +{
  160 + //copy everything to the GPU
  161 + double2* gpuB;
  162 + HANDLE_ERROR(cudaMalloc(&gpuB, sizeof(double2) * nLambda * Nl));
  163 + HANDLE_ERROR(cudaMemcpy(gpuB, cpuB, sizeof(double2) * nLambda * Nl, cudaMemcpyHostToDevice));
  164 +
  165 +
  166 + double* gpuAlpha;
  167 + HANDLE_ERROR(cudaMalloc(&gpuAlpha, sizeof(double) * Nl));
  168 + HANDLE_ERROR(cudaMemcpy(gpuAlpha, cpuAlpha, sizeof(double) * Nl, cudaMemcpyHostToDevice));
  169 +
  170 + double* gpuI;
  171 + HANDLE_ERROR(cudaMalloc(&gpuI, sizeof(double) * nLambda));
  172 + HANDLE_ERROR(cudaMemset(gpuI, 0, sizeof(double) * nLambda));
  173 +
  174 +
  175 + //call the kernel to compute the spectrum
  176 + dim3 block(BLOCK_SIZE*BLOCK_SIZE);
  177 + dim3 grid(nLambda/block.x + 1);
  178 +
  179 + //devComputeSpectrum
  180 + devComputeSpectrum<<<grid, block>>>(gpuI, (double2*)gpuB, gpuAlpha, Nl,
  181 + nSamples, nLambda, oThetaI, oThetaO, cThetaI, cThetaO);
  182 +
  183 + HANDLE_ERROR(cudaMemcpy(cpuI, gpuI, sizeof(double) * nLambda, cudaMemcpyDeviceToHost));
  184 +
  185 + //printf("Final array value: %f\n", cpuI[nLambda-1]);
  186 +
  187 + HANDLE_ERROR(cudaFree(gpuB));
  188 + HANDLE_ERROR(cudaFree(gpuAlpha));
  189 + HANDLE_ERROR(cudaFree(gpuI));
  190 +
  191 +
  192 +
  193 +
187 194 }
... ...
cudaMain.cu
1   -#include "cuComplex.h"
2   -#include "cudaHandleError.h"
3   -
4   -
5   -#define PI 3.14159
6   -#define BLOCK_SIZE 16
7   -
8   -__device__ cuDoubleComplex cMult(cuDoubleComplex a, cuDoubleComplex b)
9   -{
10   - cuDoubleComplex result;
11   - result.x = a.x * b.x - a.y * b.y;
12   - result.y = a.x * b.y + a.y * b.x;
13   -
14   - return result;
15   -}
16   -
17   -__device__ cuDoubleComplex cMult(cuDoubleComplex a, float b)
18   -{
19   - cuDoubleComplex result;
20   - result.x = a.x * b;
21   - result.y = a.y * b;
22   -
23   - return result;
24   -}
25   -
26   -__device__ cuDoubleComplex cAdd(cuDoubleComplex a, cuDoubleComplex b)
27   -{
28   - cuDoubleComplex r;
29   - r.x = a.x + b.x;
30   - r.y = a.y + b.y;
31   -
32   - return r;
33   -}
34   -
35   -__device__ cuDoubleComplex cAdd(cuDoubleComplex a, float b)
36   -{
37   - cuDoubleComplex r;
38   - r.x = a.x + b;
39   - r.y = a.y;
40   -
41   - return r;
42   -}
43   -
44   -__device__ cuDoubleComplex cExp(cuDoubleComplex a)
45   -{
46   - cuDoubleComplex r;
47   -
48   - r.x = exp(a.x) * cos(a.y);
49   - r.y = exp(a.x) * sin(a.y);
50   -
51   - return r;
52   -}
53   -
54   -__device__ double cMag(cuDoubleComplex a)
55   -{
56   - double r = sqrt(a.x * a.x + a.y * a.y);
57   - return r;
58   -}
59   -
60   -#include "cudaKK.h"
61   -
  1 +#include "cuComplex.h"
  2 +#include "cudaHandleError.h"
  3 +
  4 +
  5 +#define PI 3.14159
  6 +#define BLOCK_SIZE 16
  7 +
  8 +__device__ cuDoubleComplex cMult(cuDoubleComplex a, cuDoubleComplex b)
  9 +{
  10 + cuDoubleComplex result;
  11 + result.x = a.x * b.x - a.y * b.y;
  12 + result.y = a.x * b.y + a.y * b.x;
  13 +
  14 + return result;
  15 +}
  16 +
  17 +__device__ cuDoubleComplex cMult(cuDoubleComplex a, float b)
  18 +{
  19 + cuDoubleComplex result;
  20 + result.x = a.x * b;
  21 + result.y = a.y * b;
  22 +
  23 + return result;
  24 +}
  25 +
  26 +__device__ cuDoubleComplex cAdd(cuDoubleComplex a, cuDoubleComplex b)
  27 +{
  28 + cuDoubleComplex r;
  29 + r.x = a.x + b.x;
  30 + r.y = a.y + b.y;
  31 +
  32 + return r;
  33 +}
  34 +
  35 +__device__ cuDoubleComplex cAdd(cuDoubleComplex a, float b)
  36 +{
  37 + cuDoubleComplex r;
  38 + r.x = a.x + b;
  39 + r.y = a.y;
  40 +
  41 + return r;
  42 +}
  43 +
  44 +__device__ cuDoubleComplex cExp(cuDoubleComplex a)
  45 +{
  46 + cuDoubleComplex r;
  47 +
  48 + r.x = exp(a.x) * cos(a.y);
  49 + r.y = exp(a.x) * sin(a.y);
  50 +
  51 + return r;
  52 +}
  53 +
  54 +__device__ double cMag(cuDoubleComplex a)
  55 +{
  56 + double r = sqrt(a.x * a.x + a.y * a.y);
  57 + return r;
  58 +}
  59 +
  60 +#include "cudaKK.h"
  61 +
... ...
etaToluene.txt 0 โ†’ 100644
  1 +nu n k
  2 +800 1.441201025 0.002370971
  3 +802 1.442449524 0.002279499
  4 +804 1.443622415 0.002218164
  5 +806 1.444731575 0.00217471
  6 +808 1.445769313 0.002154818
  7 +810 1.446735153 0.002133884
  8 +812 1.447631537 0.002093632
  9 +814 1.448499976 0.002020828
  10 +816 1.449371594 0.001935851
  11 +818 1.450245111 0.001882509
  12 +820 1.451098381 0.001845384
  13 +822 1.451931801 0.001835367
  14 +824 1.452743077 0.001859742
  15 +826 1.453538627 0.001906472
  16 +828 1.454316144 0.001993264
  17 +830 1.455057831 0.002134999
  18 +832 1.455752574 0.002332258
  19 +834 1.456373935 0.00257594
  20 +836 1.45689904 0.00287502
  21 +838 1.457307689 0.003187541
  22 +840 1.457541056 0.00349171
  23 +842 1.457622779 0.003661082
  24 +844 1.45763705 0.003626834
  25 +846 1.457709742 0.003400597
  26 +848 1.457929984 0.003056081
  27 +850 1.458311946 0.002701293
  28 +852 1.458792141 0.002396757
  29 +854 1.459332546 0.002178644
  30 +856 1.459889834 0.002030216
  31 +858 1.460439885 0.001936861
  32 +860 1.460982928 0.001877498
  33 +862 1.461517236 0.00185772
  34 +864 1.462038725 0.001889109
  35 +866 1.462531922 0.001950935
  36 +868 1.462978568 0.00204692
  37 +870 1.463376438 0.002155221
  38 +872 1.463691463 0.002260164
  39 +874 1.463946436 0.002246045
  40 +876 1.46431344 0.002102302
  41 +878 1.464835949 0.001997437
  42 +880 1.465438552 0.001992183
  43 +882 1.46608463 0.002084809
  44 +884 1.466770232 0.002282701
  45 +886 1.467508982 0.002620306
  46 +888 1.468317634 0.00319353
  47 +890 1.469128024 0.004219724
  48 +892 1.46954514 0.006023859
  49 +894 1.468393318 0.00840405
  50 +896 1.465223625 0.009006755
  51 +898 1.463241024 0.006966132
  52 +900 1.463248052 0.004995548
  53 +902 1.463894773 0.003838499
  54 +904 1.464602858 0.003205237
  55 +906 1.465241891 0.00285555
  56 +908 1.465786159 0.002664765
  57 +910 1.466248706 0.002546277
  58 +912 1.466651178 0.002453415
  59 +914 1.467032669 0.002364593
  60 +916 1.467407655 0.002292823
  61 +918 1.46779669 0.00223036
  62 +920 1.468201898 0.002212279
  63 +922 1.468611417 0.002242387
  64 +924 1.469017595 0.002350077
  65 +926 1.469359926 0.002567263
  66 +928 1.469513165 0.00284644
  67 +930 1.469451982 0.00294228
  68 +932 1.469507737 0.002759167
  69 +934 1.469802525 0.00258731
  70 +936 1.47016397 0.002557196
  71 +938 1.470505278 0.002621533
  72 +940 1.470798022 0.002738964
  73 +942 1.471029562 0.002875389
  74 +944 1.471215597 0.002997329
  75 +946 1.471371939 0.003096987
  76 +948 1.471520088 0.003166052
  77 +950 1.471676729 0.003204709
  78 +952 1.471870413 0.003234913
  79 +954 1.472084483 0.003296926
  80 +956 1.472297379 0.003385829
  81 +958 1.472502688 0.003503316
  82 +960 1.472670115 0.003659948
  83 +962 1.472776059 0.00382798
  84 +964 1.472810962 0.003950488
  85 +966 1.472833778 0.003999093
  86 +968 1.472885211 0.003977479
  87 +970 1.473006806 0.003933385
  88 +972 1.473183366 0.003915274
  89 +974 1.473380818 0.003937115
  90 +976 1.473579696 0.004020582
  91 +978 1.47371821 0.004148016
  92 +980 1.473755273 0.004260284
  93 +982 1.473742435 0.004243433
  94 +984 1.473813229 0.004119949
  95 +986 1.473984876 0.003998672
  96 +988 1.474206293 0.003886511
  97 +990 1.474481309 0.003799505
  98 +992 1.474815078 0.00373978
  99 +994 1.475182296 0.003738812
  100 +996 1.475570232 0.003799565
  101 +998 1.475963266 0.003936431
  102 +1000 1.476300807 0.004184267
  103 +1002 1.476368232 0.004483668
  104 +1004 1.476369967 0.004213951
  105 +1006 1.476895249 0.004008063
  106 +1008 1.477500322 0.003959639
  107 +1010 1.478191588 0.003995866
  108 +1012 1.478975059 0.004124533
  109 +1014 1.479861671 0.004356501
  110 +1016 1.480895138 0.004708233
  111 +1018 1.482142712 0.005256522
  112 +1020 1.48362439 0.006200346
  113 +1022 1.48502768 0.007610747
  114 +1024 1.48723564 0.009048626
  115 +1026 1.490922897 0.012842061
  116 +1028 1.49396376 0.023205465
  117 +1030 1.478739354 0.040107032
  118 +1032 1.461784885 0.023766251
  119 +1034 1.466147284 0.015090077
  120 +1036 1.469449728 0.01362093
  121 +1038 1.470761398 0.01407228
  122 +1040 1.470518602 0.014852004
  123 +1042 1.469251081 0.015041876
  124 +1044 1.467778886 0.01427413
  125 +1046 1.466770622 0.01279836
  126 +1048 1.466441044 0.011102025
  127 +1050 1.466660858 0.009538868
  128 +1052 1.467249956 0.008235735
  129 +1054 1.46804819 0.007220159
  130 +1056 1.468976816 0.006471992
  131 +1058 1.469955855 0.005954506
  132 +1060 1.470985909 0.00562082
  133 +1062 1.472067145 0.005471556
  134 +1064 1.47321735 0.005511631
  135 +1066 1.474451756 0.005773786
  136 +1068 1.475791945 0.006332171
  137 +1070 1.477216814 0.007315265
  138 +1072 1.478635789 0.008889418
  139 +1074 1.479890364 0.011193667
  140 +1076 1.480860176 0.014562718
  141 +1078 1.480694748 0.019882054
  142 +1080 1.476167315 0.027210144
  143 +1082 1.463907719 0.0294764
  144 +1084 1.455702239 0.02070909
  145 +1086 1.455979715 0.012765529
  146 +1088 1.458369419 0.008540043
  147 +1090 1.460662356 0.006355266
  148 +1092 1.462558732 0.005181408
  149 +1094 1.464110518 0.00455405
  150 +1096 1.465407938 0.00426269
  151 +1098 1.466512044 0.004235102
  152 +1100 1.46743002 0.00446506
  153 +1102 1.468108911 0.004966537
  154 +1104 1.468358263 0.005807079
  155 +1106 1.467623162 0.006667401
  156 +1108 1.466185738 0.006247327
  157 +1110 1.465723585 0.004799082
  158 +1112 1.466149203 0.003611219
  159 +1114 1.466844726 0.002879426
  160 +1116 1.467543668 0.002461487
  161 +1118 1.468167662 0.002227789
  162 +1120 1.468718605 0.002096505
  163 +1122 1.469207707 0.002021218
  164 +1124 1.469650731 0.00199324
  165 +1126 1.4700526 0.002007979
  166 +1128 1.470402126 0.002048125
  167 +1130 1.470687738 0.002094174
  168 +1132 1.470960018 0.002098497
  169 +1134 1.471252614 0.00210954
  170 +1136 1.471548918 0.002149273
  171 +1138 1.471836992 0.002217813
  172 +1140 1.47209801 0.002316543
  173 +1142 1.472334568 0.002417003
  174 +1144 1.472575735 0.002520905
  175 +1146 1.472833567 0.002659262
  176 +1148 1.473072594 0.002866525
  177 +1150 1.473263818 0.003136477
  178 +1152 1.473369962 0.003474161
  179 +1154 1.473307105 0.003876619
  180 +1156 1.472935095 0.004100433
  181 +1158 1.472665948 0.003948862
  182 +1160 1.472597073 0.003731488
  183 +1162 1.472679826 0.003504946
  184 +1164 1.47288582 0.003340222
  185 +1166 1.473175646 0.003240538
  186 +1168 1.473557613 0.003237282
  187 +1170 1.474022096 0.003370304
  188 +1172 1.474591972 0.003703318
  189 +1174 1.475290735 0.004468614
  190 +1176 1.47579202 0.006270984
  191 +1178 1.473894528 0.009310786
  192 +1180 1.46944889 0.007950277
  193 +1182 1.46919538 0.005056482
  194 +1184 1.469937066 0.003777164
  195 +1186 1.47058585 0.003191365
  196 +1188 1.47109418 0.002901376
  197 +1190 1.47148385 0.002757916
  198 +1192 1.471773562 0.002692267
  199 +1194 1.47196611 0.00266088
  200 +1196 1.472077286 0.002588178
  201 +1198 1.472200969 0.002417009
  202 +1200 1.472450427 0.00221559
  203 +1202 1.472836622 0.002112174
  204 +1204 1.473304311 0.002201829
  205 +1206 1.473753424 0.002612947
  206 +1208 1.47385318 0.003479745
  207 +1210 1.472800275 0.004379301
  208 +1212 1.47140252 0.003426489
  209 +1214 1.471594891 0.002272601
  210 +1216 1.472055163 0.001782587
  211 +1218 1.4724316 0.001543926
  212 +1220 1.472739169 0.001396985
  213 +1222 1.47301273 0.001292807
  214 +1224 1.473263934 0.001219469
  215 +1226 1.473498895 0.001171845
  216 +1228 1.473716592 0.00113723
  217 +1230 1.473930592 0.001119123
  218 +1232 1.474133787 0.00111391
  219 +1234 1.4743347 0.001124438
  220 +1236 1.474530392 0.001156601
  221 +1238 1.474716479 0.001210456
  222 +1240 1.47488492 0.001292746
  223 +1242 1.475028515 0.001403963
  224 +1244 1.475124956 0.001544106
  225 +1246 1.475144089 0.001698604
  226 +1248 1.475058922 0.001808401
  227 +1250 1.474899721 0.00177689
  228 +1252 1.474841067 0.001576011
  229 +1254 1.474939237 0.001381063
  230 +1256 1.475098463 0.001256209
  231 +1258 1.475265678 0.001187172
  232 +1260 1.475420572 0.001144965
  233 +1262 1.475574395 0.001114299
  234 +1264 1.47572117 0.001097405
  235 +1266 1.475867451 0.001089675
  236 +1268 1.476011473 0.001093157
  237 +1270 1.476147019 0.001107013
  238 +1272 1.476270154 0.001125473
  239 +1274 1.47638091 0.001144171
  240 +1276 1.476483619 0.001155498
  241 +1278 1.476581834 0.001158617
  242 +1280 1.476683135 0.001145768
  243 +1282 1.476799599 0.001123074
  244 +1284 1.476932611 0.001108033
  245 +1286 1.477072975 0.001097907
  246 +1288 1.477222834 0.001097104
  247 +1290 1.477380706 0.001106987
  248 +1292 1.477543374 0.001132459
  249 +1294 1.477707163 0.001175521
  250 +1296 1.477860282 0.001242672
  251 +1298 1.477988876 0.001322776
  252 +1300 1.478089342 0.00139218
  253 +1302 1.478182431 0.001429737
  254 +1304 1.478308272 0.001441882
  255 +1306 1.478493641 0.001475415
  256 +1308 1.478712211 0.001599567
  257 +1310 1.478858087 0.001868439
  258 +1312 1.478730102 0.002164861
  259 +1314 1.478458036 0.002117289
  260 +1316 1.478449306 0.001875076
  261 +1318 1.478611792 0.001716774
  262 +1320 1.478814603 0.001648375
  263 +1322 1.479022917 0.001638998
  264 +1324 1.479220666 0.001664106
  265 +1326 1.479414128 0.001717646
  266 +1328 1.479592108 0.001804795
  267 +1330 1.479731678 0.001942749
  268 +1332 1.479726919 0.002060225
  269 +1334 1.479751059 0.001962173
  270 +1336 1.479935123 0.001884928
  271 +1338 1.480148376 0.001871222
  272 +1340 1.480373607 0.001889214
  273 +1342 1.480600388 0.001937007
  274 +1344 1.480827533 0.002003134
  275 +1346 1.481049681 0.002087781
  276 +1348 1.481265532 0.002180662
  277 +1350 1.481487164 0.002265881
  278 +1352 1.481736476 0.002362769
  279 +1354 1.482004468 0.002489159
  280 +1356 1.482275995 0.002655474
  281 +1358 1.48252792 0.002848203
  282 +1360 1.482763249 0.003032115
  283 +1362 1.483034583 0.003195386
  284 +1364 1.483382233 0.003380113
  285 +1366 1.483799025 0.003639964
  286 +1368 1.484272236 0.004002658
  287 +1370 1.484829603 0.00448977
  288 +1372 1.48552802 0.005257737
  289 +1374 1.486275464 0.006620297
  290 +1376 1.486517001 0.009083761
  291 +1378 1.484325992 0.012303151
  292 +1380 1.47977969 0.012167198
  293 +1382 1.478003551 0.009400075
  294 +1384 1.478053165 0.007543182
  295 +1386 1.478421432 0.006403564
  296 +1388 1.478900248 0.005632571
  297 +1390 1.479406516 0.005110109
  298 +1392 1.479917129 0.004757894
  299 +1394 1.480417549 0.004528335
  300 +1396 1.480897509 0.004401862
  301 +1398 1.481351587 0.004336878
  302 +1400 1.481797711 0.004323178
  303 +1402 1.482240699 0.004361754
  304 +1404 1.482665796 0.004446542
  305 +1406 1.483059442 0.004580452
  306 +1408 1.483422987 0.004720702
  307 +1410 1.483790308 0.004847301
  308 +1412 1.484190359 0.004991696
  309 +1414 1.484613428 0.005175265
  310 +1416 1.485051641 0.005408562
  311 +1418 1.485480056 0.00569302
  312 +1420 1.485885882 0.006036094
  313 +1422 1.486260365 0.006398155
  314 +1424 1.486596633 0.006767043
  315 +1426 1.486908375 0.007097025
  316 +1428 1.487267526 0.007352865
  317 +1430 1.487756499 0.007589461
  318 +1432 1.488416197 0.007867817
  319 +1434 1.489247587 0.00830203
  320 +1436 1.49022965 0.00898232
  321 +1438 1.491261092 0.010019784
  322 +1440 1.492201579 0.011509506
  323 +1442 1.492747862 0.013398599
  324 +1444 1.492754368 0.015376887
  325 +1446 1.492440408 0.017176535
  326 +1448 1.492035068 0.01893611
  327 +1450 1.49142868 0.020824529
  328 +1452 1.490404699 0.022803925
  329 +1454 1.488886984 0.024681051
  330 +1456 1.486877843 0.026261841
  331 +1458 1.484428504 0.027360806
  332 +1460 1.481747232 0.027793093
  333 +1462 1.479066932 0.027470624
  334 +1464 1.476679553 0.026421119
  335 +1466 1.47482397 0.024798079
  336 +1468 1.473644256 0.022829656
  337 +1470 1.473199283 0.020783461
  338 +1472 1.473390477 0.018872465
  339 +1474 1.474116298 0.017180199
  340 +1476 1.475333747 0.015792075
  341 +1478 1.47696196 0.014728301
  342 +1480 1.479085272 0.014003049
  343 +1482 1.481808665 0.013756925
  344 +1484 1.48531764 0.01418798
  345 +1486 1.489949287 0.015922624
  346 +1488 1.494990654 0.020194058
  347 +1490 1.501195156 0.026083679
  348 +1492 1.509903786 0.040120276
  349 +1494 1.511966946 0.076178677
  350 +1496 1.445607958 0.108223079
  351 +1498 1.414560032 0.052724926
  352 +1500 1.425687258 0.027163552
  353 +1502 1.435092428 0.017332219
  354 +1504 1.441798717 0.012488921
  355 +1506 1.446695961 0.009921313
  356 +1508 1.450331767 0.008397527
  357 +1510 1.453186827 0.007451763
  358 +1512 1.45545228 0.006880209
  359 +1514 1.457319215 0.006485335
  360 +1516 1.458949324 0.006281002
  361 +1518 1.460412276 0.006293795
  362 +1520 1.461761735 0.006700333
  363 +1522 1.462443847 0.007864531
  364 +1524 1.461222896 0.008610001
  365 +1526 1.460432858 0.006970267
  366 +1528 1.461281615 0.005652274
  367 +1530 1.462269708 0.00510003
  368 +1532 1.463067013 0.004873301
  369 +1534 1.463664 0.004776434
  370 +1536 1.464094179 0.004671773
  371 +1538 1.464441095 0.004490224
  372 +1540 1.464777048 0.004239347
  373 +1542 1.465191657 0.00393426
  374 +1544 1.465688526 0.003656601
  375 +1546 1.466238893 0.003489234
  376 +1548 1.46677633 0.003427108
  377 +1550 1.467191673 0.003468987
  378 +1552 1.467477728 0.003382955
  379 +1554 1.467919322 0.003213785
  380 +1556 1.468447563 0.003134306
  381 +1558 1.468982556 0.003169074
  382 +1560 1.46952197 0.003304817
  383 +1562 1.469996105 0.00356172
  384 +1564 1.470387926 0.003888984
  385 +1566 1.470664197 0.004296389
  386 +1568 1.47075697 0.004721133
  387 +1570 1.470675807 0.005049292
  388 +1572 1.470472242 0.005192861
  389 +1574 1.470309764 0.005092022
  390 +1576 1.470330922 0.004817698
  391 +1578 1.470574897 0.004555438
  392 +1580 1.470999073 0.00435936
  393 +1582 1.471583642 0.004339902
  394 +1584 1.4721379 0.004607263
  395 +1586 1.472404549 0.004920037
  396 +1588 1.472734555 0.00490704
  397 +1590 1.473437241 0.004927535
  398 +1592 1.474460918 0.005185889
  399 +1594 1.475741944 0.005925432
  400 +1596 1.477051732 0.00720758
  401 +1598 1.478673359 0.009128905
  402 +1600 1.480620288 0.013029368
  403 +1602 1.480361683 0.020680995
  404 +1604 1.471342992 0.029995359
  405 +1606 1.455082768 0.024815734
  406 +1608 1.45359592 0.012735845
  407 +1610 1.456936261 0.007467836
  408 +1612 1.459649264 0.005372098
  409 +1614 1.461565353 0.004451296
  410 +1616 1.462944851 0.004053293
  411 +1618 1.463933847 0.003991463
  412 +1620 1.464541591 0.004096596
  413 +1622 1.464785362 0.004250861
  414 +1624 1.464675723 0.004253062
  415 +1626 1.464436751 0.003880135
  416 +1628 1.464428733 0.003227653
  417 +1630 1.464682454 0.002598051
  418 +1632 1.46507305 0.002086572
  419 +1634 1.465510023 0.001698439
  420 +1636 1.465976195 0.001417854
  421 +1638 1.46639465 0.00123235
  422 +1640 1.466777147 0.001097643
  423 +1642 1.467133507 0.000997096
  424 +1644 1.467460665 0.000923944
  425 +1646 1.467776889 0.000867695
  426 +1648 1.468072302 0.00085799
  427 +1650 1.468323132 0.000876926
  428 +1652 1.468535355 0.000900484
  429 +1654 1.468711262 0.000924599
  430 +1656 1.46886442 0.000943403
  431 +1658 1.468977178 0.00095719
  432 +1660 1.469060193 0.000919302
  433 +1662 1.469173361 0.000829981
  434 +1664 1.46933993 0.00074192
  435 +1666 1.469532185 0.000684455
  436 +1668 1.469734587 0.000660487
  437 +1670 1.46993137 0.00067733
  438 +1672 1.47010973 0.000733664
  439 +1674 1.470235927 0.000829672
  440 +1676 1.470261895 0.000923202
  441 +1678 1.470230428 0.000900896
  442 +1680 1.470268242 0.000787132
  443 +1682 1.470391952 0.000676996
  444 +1684 1.470558163 0.000611701
  445 +1686 1.47072223 0.000595044
  446 +1688 1.470881225 0.000601913
  447 +1690 1.471020294 0.000631185
  448 +1692 1.471140847 0.000675094
  449 +1694 1.4712396 0.000731422
  450 +1696 1.471287792 0.000808376
  451 +1698 1.471263994 0.00079428
  452 +1700 1.471328964 0.000709355
  453 +1702 1.471436818 0.000657251
  454 +1704 1.471559458 0.000631084
  455 +1706 1.471675566 0.00062063
  456 +1708 1.471789402 0.000614805
  457 +1710 1.471906048 0.000610379
  458 +1712 1.472029443 0.000608366
  459 +1714 1.472165687 0.000610178
  460 +1716 1.472315399 0.000628061
  461 +1718 1.472483869 0.000671391
  462 +1720 1.472654475 0.000748671
  463 +1722 1.472817311 0.000874314
  464 +1724 1.472950429 0.001041238
  465 +1726 1.473046007 0.001237492
  466 +1728 1.473093759 0.001471848
  467 +1730 1.473059395 0.001732234
  468 +1732 1.472917418 0.001975823
  469 +1734 1.47267689 0.002155434
  470 +1736 1.472355338 0.002204526
  471 +1738 1.472048818 0.002091193
  472 +1740 1.47183344 0.001857001
  473 +1742 1.471742434 0.00156446
  474 +1744 1.471768805 0.001278243
  475 +1746 1.471881629 0.001038306
  476 +1748 1.472046322 0.000858083
  477 +1750 1.472232414 0.000736721
  478 +1752 1.47242316 0.000665836
  479 +1754 1.472608674 0.000633015
  480 +1756 1.472783278 0.000636204
  481 +1758 1.472932588 0.000664561
  482 +1760 1.473060858 0.000700854
  483 +1762 1.47317848 0.00073825
  484 +1764 1.473290453 0.000779473
  485 +1766 1.473395502 0.000831333
  486 +1768 1.473491455 0.000887484
  487 +1770 1.473578175 0.000943101
  488 +1772 1.473667126 0.00100856
  489 +1774 1.473739298 0.001088156
  490 +1776 1.473785511 0.001173368
  491 +1778 1.47379002 0.001227206
  492 +1780 1.473813896 0.001208673
  493 +1782 1.473923549 0.001173465
  494 +1784 1.4740917 0.001193719
  495 +1786 1.474271982 0.001285337
  496 +1788 1.474426157 0.001425909
  497 +1790 1.474572919 0.001580549
  498 +1792 1.474748784 0.001798508
  499 +1794 1.474893485 0.002133319
  500 +1796 1.474934899 0.002583712
  501 +1798 1.474781105 0.003106518
  502 +1800 1.474370814 0.003584561
  503 +1802 1.473736221 0.003845351
  504 +1804 1.473045883 0.003772087
  505 +1806 1.472512227 0.003409507
  506 +1808 1.472234727 0.002925899
  507 +1810 1.472178211 0.002462305
  508 +1812 1.472272365 0.002095033
  509 +1814 1.4724386 0.001852627
  510 +1816 1.472597486 0.001717021
  511 +1818 1.472717182 0.001638864
  512 +1820 1.472795358 0.001577308
  513 +1822 1.472849206 0.001496792
  514 +1824 1.472912356 0.001388637
  515 +1826 1.473013974 0.001277435
  516 +1828 1.47314853 0.001184564
  517 +1830 1.473293302 0.001129054
  518 +1832 1.473425437 0.001086064
  519 +1834 1.473570566 0.001030861
  520 +1836 1.473758736 0.00098496
  521 +1838 1.473981581 0.000979289
  522 +1840 1.474224453 0.001022886
  523 +1842 1.474480777 0.001120679
  524 +1844 1.474745868 0.001283946
  525 +1846 1.475006131 0.001527239
  526 +1848 1.475247239 0.001888266
  527 +1850 1.475396699 0.002392276
  528 +1852 1.475351258 0.003009719
  529 +1854 1.475042175 0.003640594
  530 +1856 1.474423945 0.004145277
  531 +1858 1.473584937 0.004284184
  532 +1860 1.47284787 0.003973418
  533 +1862 1.4724611 0.003434379
  534 +1864 1.472411327 0.002946984
  535 +1866 1.472536164 0.002656852
  536 +1868 1.472665029 0.002575548
  537 +1870 1.472679666 0.002623622
  538 +1872 1.472529231 0.002673206
  539 +1874 1.472271964 0.002596706
  540 +1876 1.472035096 0.002353418
  541 +1878 1.471921073 0.002013524
  542 +1880 1.471942987 0.001671625
  543 +1882 1.472053638 0.001387567
  544 +1884 1.472207083 0.00117033
  545 +1886 1.472370953 0.001011206
  546 +1888 1.472530627 0.000892343
  547 +1890 1.472681675 0.000799798
  548 +1892 1.472830389 0.000722584
  549 +1894 1.472985008 0.000668206
  550 +1896 1.473131098 0.000645564
  551 +1898 1.473247692 0.000645768
  552 +1900 1.473331292 0.000633984
  553 +1902 1.473415571 0.000588098
  554 +1904 1.473530879 0.000535949
  555 +1906 1.473665341 0.00050098
  556 +1908 1.47380841 0.000480504
  557 +1910 1.473958285 0.000475813
  558 +1912 1.474113403 0.000486824
  559 +1914 1.474274 0.000515196
  560 +1916 1.47443781 0.000562568
  561 +1918 1.474605934 0.000630428
  562 +1920 1.474775821 0.00072361
  563 +1922 1.474938799 0.000847642
  564 +1924 1.475084387 0.00099279
  565 +1926 1.475226982 0.001144293
  566 +1928 1.475392648 0.001317285
  567 +1930 1.475582607 0.001558937
  568 +1932 1.475762194 0.001903731
  569 +1934 1.475876407 0.002375566
  570 +1936 1.475839086 0.002980401
  571 +1938 1.475530609 0.003642932
  572 +1940 1.474891504 0.004165896
  573 +1942 1.474095429 0.004339444
  574 +1944 1.47334202 0.004204135
  575 +1946 1.472750025 0.003801614
  576 +1948 1.472449258 0.003277199
  577 +1950 1.472399446 0.002825764
  578 +1952 1.472475793 0.002533488
  579 +1954 1.472554597 0.002394375
  580 +1956 1.472561971 0.002346038
  581 +1958 1.472465217 0.002325749
  582 +1960 1.472281353 0.002200395
  583 +1962 1.472125511 0.001994452
  584 +1964 1.472020751 0.001704955
  585 +1966 1.472027616 0.001378758
  586 +1968 1.472134206 0.001096906
  587 +1970 1.472290432 0.000878129
  588 +1972 1.472468078 0.000721601
  589 +1974 1.472650017 0.00061742
  590 +1976 1.472826436 0.000562113
  591 +1978 1.472982261 0.000551026
  592 +1980 1.473106514 0.000575712
  593 +1982 1.473179497 0.000615371
  594 +1984 1.473216719 0.000626639
  595 +1986 1.473270062 0.000619345
  596 +1988 1.473326863 0.000644973
  597 +1990 1.473329296 0.000691942
  598 +1992 1.473278226 0.000694255
  599 +1994 1.473221507 0.000622443
  600 +1996 1.473236186 0.0004952
  601 +1998 1.473318243 0.00040262
  602 +2000 1.473411355 0.00035752
  603 +2002 1.473494127 0.000340716
  604 +2004 1.473561544 0.000340726
  605 +2006 1.473612248 0.000349588
  606 +2008 1.473641865 0.00035789
  607 +2010 1.47365636 0.000352783
  608 +2012 1.473673369 0.000327905
  609 +2014 1.473702337 0.0002987
  610 +2016 1.473734437 0.000271842
  611 +2018 1.473772058 0.000242333
  612 +2020 1.473816484 0.000218337
  613 +2022 1.473861113 0.000199195
  614 +2024 1.47390578 0.000183912
  615 +2026 1.473950288 0.000171888
  616 +2028 1.473995645 0.000164785
  617 +2030 1.474036603 0.000164392
  618 +2032 1.474065198 0.000169012
  619 +2034 1.47408331 0.000154128
  620 +2036 1.47412047 0.000133851
  621 +2038 1.474160982 0.000121768
  622 +2040 1.474201156 0.000114542
  623 +2042 1.47423947 0.000109961
  624 +2044 1.474276129 0.000107325
  625 +2046 1.474312184 0.00010532
  626 +2048 1.474346481 0.0001044
  627 +2050 1.474380714 0.000104561
  628 +2052 1.474412784 0.000105683
  629 +2054 1.474445206 0.000107138
  630 +2056 1.47447627 0.000109851
  631 +2058 1.474506759 0.000113964
  632 +2060 1.474535887 0.00011916
  633 +2062 1.474563867 0.000125394
  634 +2064 1.474590735 0.000135383
  635 +2066 1.474612054 0.000150829
  636 +2068 1.474618173 0.000163896
  637 +2070 1.474618403 0.000158539
  638 +2072 1.474632772 0.000143857
  639 +2074 1.474654279 0.000133839
  640 +2076 1.474677092 0.000126083
  641 +2078 1.47470099 0.000119111
  642 +2080 1.474725901 0.000113979
  643 +2082 1.474750651 0.000110908
  644 +2084 1.474774681 0.000108575
  645 +2086 1.474797765 0.00010575
  646 +2088 1.474821422 0.000102758
  647 +2090 1.474846336 0.000100315
  648 +2092 1.474871219 9.89E-05
  649 +2094 1.474896096 9.85E-05
  650 +2096 1.474919997 9.87E-05
  651 +2098 1.474944347 9.87E-05
  652 +2100 1.474969806 9.95E-05
  653 +2102 1.474995643 0.000102501
  654 +2104 1.47502159 0.000108578
  655 +2106 1.475044176 0.000117599
  656 +2108 1.475062645 0.00012881
  657 +2110 1.475073954 0.000138078
  658 +2112 1.475083937 0.000139895
  659 +2114 1.47510043 0.000140372
  660 +2116 1.475111984 0.000147184
  661 +2118 1.475112146 0.000142581
  662 +2120 1.475127628 0.000126124
  663 +2122 1.475152113 0.000119111
  664 +2124 1.475171824 0.000117762
  665 +2126 1.475187748 0.000110386
  666 +2128 1.475213108 0.000100586
  667 +2130 1.475241165 9.65E-05
  668 +2132 1.475270052 9.72E-05
  669 +2134 1.475295905 0.000100589
  670 +2136 1.47531935 0.000104482
  671 +2138 1.475342091 0.000107041
  672 +2140 1.475365546 0.000108872
  673 +2142 1.47539141 0.00011149
  674 +2144 1.475417352 0.000115452
  675 +2146 1.475444492 0.000120558
  676 +2148 1.475473425 0.000126538
  677 +2150 1.475506197 0.000134734
  678 +2152 1.475541784 0.000148644
  679 +2154 1.475582035 0.000172041
  680 +2156 1.475621601 0.000210049
  681 +2158 1.475652538 0.000268126
  682 +2160 1.475661516 0.000351069
  683 +2162 1.475612259 0.000450345
  684 +2164 1.475480686 0.000489939
  685 +2166 1.475372967 0.000409493
  686 +2168 1.475362114 0.000304388
  687 +2170 1.475398909 0.000235891
  688 +2172 1.475446566 0.000200519
  689 +2174 1.475491977 0.000185711
  690 +2176 1.475532032 0.000182425
  691 +2178 1.475568644 0.000187449
  692 +2180 1.475602158 0.000203021
  693 +2182 1.475624645 0.000231533
  694 +2184 1.475620856 0.000266979
  695 +2186 1.475589805 0.00027467
  696 +2188 1.47557481 0.000249531
  697 +2190 1.475580335 0.000224075
  698 +2192 1.475592327 0.000200277
  699 +2194 1.475614571 0.000177273
  700 +2196 1.475644341 0.000160286
  701 +2198 1.475678575 0.000150581
  702 +2200 1.475716178 0.000148631
  703 +2202 1.475757268 0.000159419
  704 +2204 1.475793377 0.000190928
  705 +2206 1.475797468 0.000246686
  706 +2208 1.475741896 0.000270255
  707 +2210 1.475711949 0.000222823
  708 +2212 1.47572957 0.0001833
  709 +2214 1.47575472 0.000159208
  710 +2216 1.475786212 0.000141368
  711 +2218 1.475819421 0.000133886
  712 +2220 1.475850887 0.000133378
  713 +2222 1.475878972 0.000136687
  714 +2224 1.475902989 0.000141595
  715 +2226 1.4759247 0.000145519
  716 +2228 1.475947794 0.000148459
  717 +2230 1.475972651 0.000153317
  718 +2232 1.475997487 0.000163254
  719 +2234 1.476018072 0.000178923
  720 +2236 1.476026891 0.000194257
  721 +2238 1.476030055 0.00019645
  722 +2240 1.476042817 0.000188282
  723 +2242 1.476067262 0.000182547
  724 +2244 1.476097849 0.000184193
  725 +2246 1.47612902 0.000192794
  726 +2248 1.476159494 0.000207469
  727 +2250 1.476188521 0.000228636
  728 +2252 1.476214462 0.000256822
  729 +2254 1.476234897 0.000293238
  730 +2256 1.47624408 0.000339844
  731 +2258 1.476230185 0.000394697
  732 +2260 1.476177424 0.000433842
  733 +2262 1.476112288 0.000418808
  734 +2264 1.47608501 0.000365652
  735 +2266 1.476098678 0.000317993
  736 +2268 1.476129099 0.000289252
  737 +2270 1.476164765 0.000276323
  738 +2272 1.476199474 0.000276008
  739 +2274 1.476232531 0.000285195
  740 +2276 1.476263196 0.00030584
  741 +2278 1.476282004 0.000341615
  742 +2280 1.476266804 0.000378324
  743 +2282 1.476243764 0.000375183
  744 +2284 1.476247144 0.000372499
  745 +2286 1.476239393 0.00037913
  746 +2288 1.476222636 0.000369071
  747 +2290 1.476217012 0.000344203
  748 +2292 1.476224148 0.000313724
  749 +2294 1.476246398 0.00028318
  750 +2296 1.476282306 0.000260398
  751 +2298 1.476326374 0.000248364
  752 +2300 1.476373566 0.000246962
  753 +2302 1.476425239 0.000257337
  754 +2304 1.476478147 0.000282117
  755 +2306 1.476529967 0.000327012
  756 +2308 1.476570593 0.000402901
  757 +2310 1.476566051 0.000515679
  758 +2312 1.476464512 0.000613222
  759 +2314 1.476321398 0.000587317
  760 +2316 1.476264349 0.000479704
  761 +2318 1.47628667 0.000387543
  762 +2320 1.476341784 0.000331936
  763 +2322 1.476406262 0.000305882
  764 +2324 1.47647368 0.000301743
  765 +2326 1.476544201 0.000318022
  766 +2328 1.476616937 0.000360763
  767 +2330 1.476682206 0.000442865
  768 +2332 1.476708974 0.000580146
  769 +2334 1.47661953 0.000746878
  770 +2336 1.476406995 0.000778906
  771 +2338 1.476289181 0.000655879
  772 +2340 1.476279224 0.00054986
  773 +2342 1.476296106 0.00047431
  774 +2344 1.476337757 0.000414797
  775 +2346 1.476396689 0.000384139
  776 +2348 1.476454641 0.000382158
  777 +2350 1.476502523 0.000402158
  778 +2352 1.476533968 0.000435516
  779 +2354 1.476551882 0.000472183
  780 +2356 1.476566258 0.000515961
  781 +2358 1.476563425 0.000592576
  782 +2360 1.476468418 0.000693207
  783 +2362 1.476279886 0.000643638
  784 +2364 1.47623361 0.000478342
  785 +2366 1.476283496 0.000369914
  786 +2368 1.476347141 0.000314093
  787 +2370 1.476405794 0.000287309
  788 +2372 1.476456738 0.000274524
  789 +2374 1.476503293 0.000270062
  790 +2376 1.476544739 0.00027183
  791 +2378 1.476585198 0.000279195
  792 +2380 1.476623607 0.000294905
  793 +2382 1.476655091 0.000319348
  794 +2384 1.476679399 0.000350241
  795 +2386 1.476689994 0.000391786
  796 +2388 1.476668323 0.000432288
  797 +2390 1.47662552 0.000431895
  798 +2392 1.476612276 0.000400307
  799 +2394 1.476623269 0.000373781
  800 +2396 1.476645385 0.000355411
  801 +2398 1.47667621 0.000347152
  802 +2400 1.476708403 0.000350924
  803 +2402 1.476737324 0.000365707
  804 +2404 1.476760801 0.000389705
  805 +2406 1.476775668 0.000421335
  806 +2408 1.476777474 0.000459934
  807 +2410 1.47675773 0.000500617
  808 +2412 1.476711765 0.000525703
  809 +2414 1.476658988 0.000513224
  810 +2416 1.476628886 0.000478248
  811 +2418 1.476616099 0.000439596
  812 +2420 1.476618049 0.000399407
  813 +2422 1.476633611 0.000365632
  814 +2424 1.476656153 0.000342099
  815 +2426 1.476679897 0.000327643
  816 +2428 1.476701679 0.000319852
  817 +2430 1.476718893 0.00031809
  818 +2432 1.4767266 0.000318227
  819 +2434 1.476725819 0.000307018
  820 +2436 1.476735887 0.000284561
  821 +2438 1.476756253 0.000265983
  822 +2440 1.476778115 0.000252938
  823 +2442 1.476802013 0.000242679
  824 +2444 1.476826903 0.000236093
  825 +2446 1.476851343 0.000233131
  826 +2448 1.476874688 0.000233167
  827 +2450 1.476895779 0.000235416
  828 +2452 1.476914612 0.000239364
  829 +2454 1.476931215 0.000244209
  830 +2456 1.476944837 0.000248579
  831 +2458 1.476957066 0.000251145
  832 +2460 1.476968412 0.000252431
  833 +2462 1.47698093 0.000253692
  834 +2464 1.476991653 0.000255788
  835 +2466 1.476998922 0.000256434
  836 +2468 1.477005189 0.000251073
  837 +2470 1.477016819 0.000241598
  838 +2472 1.477033711 0.000234162
  839 +2474 1.477051728 0.000229677
  840 +2476 1.477069632 0.000227592
  841 +2478 1.47708839 0.000226834
  842 +2480 1.477105952 0.000227169
  843 +2482 1.47712353 0.000228589
  844 +2484 1.477140454 0.000231746
  845 +2486 1.477155269 0.000236824
  846 +2488 1.477167859 0.0002416
  847 +2490 1.477177464 0.000244394
  848 +2492 1.477187741 0.000244248
  849 +2494 1.477201081 0.000245128
  850 +2496 1.477211169 0.000251435
  851 +2498 1.477209088 0.000247994
  852 +2500 1.477219752 0.000232736
  853 +2502 1.477241531 0.000222498
  854 +2504 1.477268421 0.000221589
  855 +2506 1.477291641 0.00023258
  856 +2508 1.477297932 0.000250427
  857 +2510 1.477287517 0.000252498
  858 +2512 1.47728596 0.00023219
  859 +2514 1.477303462 0.00021105
  860 +2516 1.477328662 0.000198391
  861 +2518 1.477354807 0.000193636
  862 +2520 1.477377783 0.000193342
  863 +2522 1.477396405 0.000193372
  864 +2524 1.477413887 0.000189643
  865 +2526 1.477436743 0.000181795
  866 +2528 1.477466867 0.000178838
  867 +2530 1.477498595 0.000183502
  868 +2532 1.477527981 0.000194837
  869 +2534 1.47755197 0.000211328
  870 +2536 1.477570595 0.000231394
  871 +2538 1.477580089 0.000255837
  872 +2540 1.47756989 0.00027571
  873 +2542 1.477554275 0.000266055
  874 +2544 1.477563613 0.00024386
  875 +2546 1.477586393 0.000235285
  876 +2548 1.477602107 0.000236305
  877 +2550 1.477611366 0.000232544
  878 +2552 1.477623597 0.000218806
  879 +2554 1.477646777 0.000204744
  880 +2556 1.477674747 0.000196655
  881 +2558 1.477702465 0.000191976
  882 +2560 1.477730428 0.000186393
  883 +2562 1.477763616 0.000182465
  884 +2564 1.477799985 0.000182342
  885 +2566 1.477838217 0.000186623
  886 +2568 1.477878061 0.000194772
  887 +2570 1.477920641 0.000207509
  888 +2572 1.477964885 0.000227537
  889 +2574 1.478009562 0.000256126
  890 +2576 1.478053148 0.000293784
  891 +2578 1.478098835 0.000344607
  892 +2580 1.47814186 0.000421001
  893 +2582 1.478159973 0.00053994
  894 +2584 1.478093604 0.000691325
  895 +2586 1.477908663 0.000768064
  896 +2588 1.477734 0.000684349
  897 +2590 1.477674804 0.000536496
  898 +2592 1.477703642 0.000418108
  899 +2594 1.477766627 0.000348163
  900 +2596 1.47783459 0.000316562
  901 +2598 1.477897132 0.000311606
  902 +2600 1.477950764 0.000329719
  903 +2602 1.47798212 0.000370011
  904 +2604 1.477968395 0.000412185
  905 +2606 1.477930226 0.000402482
  906 +2608 1.477933844 0.00036847
  907 +2610 1.477945647 0.000353398
  908 +2612 1.477950473 0.000328282
  909 +2614 1.477975395 0.000295401
  910 +2616 1.478012745 0.000275903
  911 +2618 1.478051085 0.000268299
  912 +2620 1.47808604 0.000267512
  913 +2622 1.478116632 0.000270974
  914 +2624 1.478145774 0.000277238
  915 +2626 1.478171009 0.000286764
  916 +2628 1.478191857 0.000300107
  917 +2630 1.478202008 0.000316525
  918 +2632 1.478195093 0.000327263
  919 +2634 1.478180696 0.000305877
  920 +2636 1.478199378 0.000269148
  921 +2638 1.478235352 0.000248173
  922 +2640 1.478270816 0.000239824
  923 +2642 1.478304044 0.000238746
  924 +2644 1.478329954 0.000239869
  925 +2646 1.478352433 0.000237698
  926 +2648 1.478376736 0.000231659
  927 +2650 1.478404223 0.00022456
  928 +2652 1.478435039 0.000220155
  929 +2654 1.478465258 0.000220025
  930 +2656 1.478492298 0.000220822
  931 +2658 1.478516192 0.000219097
  932 +2660 1.478542286 0.000213669
  933 +2662 1.478571831 0.000206552
  934 +2664 1.478606758 0.000200133
  935 +2666 1.478645026 0.000198263
  936 +2668 1.478684425 0.000204157
  937 +2670 1.478716452 0.000219582
  938 +2672 1.478728447 0.000228529
  939 +2674 1.47874645 0.000212671
  940 +2676 1.478783675 0.000198554
  941 +2678 1.478825771 0.000193734
  942 +2680 1.478867341 0.000194427
  943 +2682 1.47890576 0.000197546
  944 +2684 1.478944105 0.000200582
  945 +2686 1.478982467 0.000203985
  946 +2688 1.479020786 0.000208935
  947 +2690 1.479056977 0.000213886
  948 +2692 1.479093486 0.000215781
  949 +2694 1.479132532 0.000215167
  950 +2696 1.479177137 0.000214896
  951 +2698 1.479224944 0.00021736
  952 +2700 1.479273702 0.000222624
  953 +2702 1.479323501 0.000229951
  954 +2704 1.479374778 0.00023778
  955 +2706 1.47942978 0.000247271
  956 +2708 1.47948663 0.000260084
  957 +2710 1.479545725 0.000275286
  958 +2712 1.479609 0.000293138
  959 +2714 1.479675821 0.000315099
  960 +2716 1.479747834 0.00034214
  961 +2718 1.479826864 0.000376356
  962 +2720 1.479914349 0.000422619
  963 +2722 1.480011619 0.000488803
  964 +2724 1.48011529 0.000585387
  965 +2726 1.480217436 0.000728319
  966 +2728 1.48029271 0.000938827
  967 +2730 1.480284699 0.001230376
  968 +2732 1.480093337 0.001552296
  969 +2734 1.479686045 0.00172267
  970 +2736 1.479260698 0.001584292
  971 +2738 1.479043822 0.001262354
  972 +2740 1.479031373 0.00095422
  973 +2742 1.479122344 0.000733284
  974 +2744 1.479244752 0.000590574
  975 +2746 1.479368961 0.000500914
  976 +2748 1.479485477 0.000444284
  977 +2750 1.479593467 0.000408552
  978 +2752 1.479693914 0.000386443
  979 +2754 1.479786963 0.000373264
  980 +2756 1.479874783 0.00036667
  981 +2758 1.479957584 0.000363877
  982 +2760 1.480037273 0.000361533
  983 +2762 1.480119242 0.000363675
  984 +2764 1.480199134 0.000366719
  985 +2766 1.480279226 0.000373488
  986 +2768 1.480357698 0.000385907
  987 +2770 1.480433858 0.000398462
  988 +2772 1.480507254 0.000413801
  989 +2774 1.480575671 0.00042566
  990 +2776 1.480651059 0.000436402
  991 +2778 1.480722663 0.000446663
  992 +2780 1.480799774 0.000455121
  993 +2782 1.480880532 0.000464084
  994 +2784 1.480966873 0.000471838
  995 +2786 1.481055122 0.000485997
  996 +2788 1.481149376 0.000502173
  997 +2790 1.481244667 0.00052283
  998 +2792 1.481341189 0.000548289
  999 +2794 1.481440145 0.000579634
  1000 +2796 1.481533085 0.000611379
  1001 +2798 1.481628758 0.000641159
  1002 +2800 1.481730232 0.000672247
  1003 +2802 1.481835672 0.000711616
  1004 +2804 1.481937644 0.000756204
  1005 +2806 1.482037722 0.000806513
  1006 +2808 1.482133328 0.000854384
  1007 +2810 1.48221893 0.000899046
  1008 +2812 1.482301281 0.000920533
  1009 +2814 1.482415432 0.000922946
  1010 +2816 1.482561883 0.000938823
  1011 +2818 1.482721464 0.000975854
  1012 +2820 1.482885937 0.001037948
  1013 +2822 1.483031462 0.001114411
  1014 +2824 1.483165355 0.001171243
  1015 +2826 1.48333288 0.001205841
  1016 +2828 1.483538865 0.001261413
  1017 +2830 1.483762339 0.001347783
  1018 +2832 1.483993724 0.001461997
  1019 +2834 1.484228597 0.001597189
  1020 +2836 1.484469148 0.001753303
  1021 +2838 1.48472336 0.001935236
  1022 +2840 1.484988918 0.002148293
  1023 +2842 1.48526979 0.002396939
  1024 +2844 1.485562444 0.002709475
  1025 +2846 1.485850301 0.00308962
  1026 +2848 1.486116357 0.003559406
  1027 +2850 1.486317037 0.004122104
  1028 +2852 1.486426168 0.004768919
  1029 +2854 1.486389319 0.005472141
  1030 +2856 1.486172881 0.006174092
  1031 +2858 1.485780553 0.006787228
  1032 +2860 1.485282546 0.007238079
  1033 +2862 1.484774737 0.007520489
  1034 +2864 1.484313069 0.007694051
  1035 +2866 1.483902949 0.007806724
  1036 +2868 1.483527587 0.007892118
  1037 +2870 1.483159233 0.007959358
  1038 +2872 1.482763173 0.007997332
  1039 +2874 1.482330362 0.007959348
  1040 +2876 1.481900332 0.007786842
  1041 +2878 1.481569899 0.007485135
  1042 +2880 1.481358298 0.007127825
  1043 +2882 1.481270464 0.006747168
  1044 +2884 1.481292247 0.006365591
  1045 +2886 1.48142276 0.006002528
  1046 +2888 1.481661524 0.005680035
  1047 +2890 1.481994694 0.005418693
  1048 +2892 1.482412863 0.005231499
  1049 +2894 1.482906156 0.005138593
  1050 +2896 1.483461748 0.005149122
  1051 +2898 1.484060687 0.005282986
  1052 +2900 1.484697491 0.005548465
  1053 +2902 1.485349018 0.005966707
  1054 +2904 1.486004513 0.006560259
  1055 +2906 1.486633305 0.007373091
  1056 +2908 1.487160493 0.008443431
  1057 +2910 1.487494274 0.009807836
  1058 +2912 1.48745635 0.011436182
  1059 +2914 1.486879188 0.013204372
  1060 +2916 1.485646477 0.01486394
  1061 +2918 1.483781384 0.016032264
  1062 +2920 1.481608423 0.01638484
  1063 +2922 1.479639022 0.01593156
  1064 +2924 1.478175633 0.014971222
  1065 +2926 1.477253662 0.01381792
  1066 +2928 1.476800099 0.012683
  1067 +2930 1.476706003 0.011705176
  1068 +2932 1.476835929 0.010945412
  1069 +2934 1.477078489 0.010409493
  1070 +2936 1.47736368 0.010077746
  1071 +2938 1.477619988 0.009915762
  1072 +2940 1.47780992 0.009890928
  1073 +2942 1.477906166 0.009952539
  1074 +2944 1.477893522 0.010055844
  1075 +2946 1.47776643 0.010146665
  1076 +2948 1.477553036 0.010170091
  1077 +2950 1.477320986 0.010097042
  1078 +2952 1.477109823 0.009954455
  1079 +2954 1.476926564 0.009771848
  1080 +2956 1.476778657 0.009560314
  1081 +2958 1.476643898 0.009316728
  1082 +2960 1.4765395 0.009008413
  1083 +2962 1.476523809 0.008604525
  1084 +2964 1.476711438 0.008191732
  1085 +2966 1.477065906 0.007931884
  1086 +2968 1.477426843 0.00787857
  1087 +2970 1.477700092 0.007954067
  1088 +2972 1.477862473 0.008070214
  1089 +2974 1.477947414 0.00817434
  1090 +2976 1.477978994 0.008250035
  1091 +2978 1.477982236 0.008288556
  1092 +2980 1.47795004 0.008283863
  1093 +2982 1.477901474 0.00816951
  1094 +2984 1.477957354 0.007951471
  1095 +2986 1.478144969 0.007718758
  1096 +2988 1.478446924 0.007521776
  1097 +2990 1.478849187 0.00739483
  1098 +2992 1.479323443 0.007354951
  1099 +2994 1.479863068 0.007424008
  1100 +2996 1.48043188 0.007629477
  1101 +2998 1.480975377 0.008003502
  1102 +3000 1.481385171 0.008498811
  1103 +3002 1.481623564 0.008966242
  1104 +3004 1.48185212 0.009250402
  1105 +3006 1.482284404 0.009454556
  1106 +3008 1.482971786 0.009765818
  1107 +3010 1.48385674 0.010315072
  1108 +3012 1.484879935 0.011209164
  1109 +3014 1.485956652 0.012566574
  1110 +3016 1.48695938 0.014492031
  1111 +3018 1.487674683 0.017152331
  1112 +3020 1.487655241 0.020658807
  1113 +3022 1.486181326 0.024792757
  1114 +3024 1.48268462 0.028533826
  1115 +3026 1.477620824 0.030573743
  1116 +3028 1.472327275 0.030419773
  1117 +3030 1.467764639 0.028528571
  1118 +3032 1.464408789 0.025462618
  1119 +3034 1.462471976 0.021841785
  1120 +3036 1.461967693 0.018321478
  1121 +3038 1.462539472 0.015436726
  1122 +3040 1.463673822 0.013417427
  1123 +3042 1.464914177 0.012181431
  1124 +3044 1.466015631 0.011480242
  1125 +3046 1.466976865 0.011108233
  1126 +3048 1.467814648 0.011036495
  1127 +3050 1.468474029 0.011234121
  1128 +3052 1.468878533 0.01165214
  1129 +3054 1.468956751 0.012167935
  1130 +3056 1.468753239 0.012649209
  1131 +3058 1.468343027 0.013064024
  1132 +3060 1.467712827 0.013421784
  1133 +3062 1.466753005 0.013602735
  1134 +3064 1.465537036 0.013356676
  1135 +3066 1.464357344 0.012495783
  1136 +3068 1.463643333 0.01111858
  1137 +3070 1.463619676 0.009623122
  1138 +3072 1.464162707 0.00840019
  1139 +3074 1.465005896 0.00762786
  1140 +3076 1.46593266 0.007314317
  1141 +3078 1.466814971 0.007427694
  1142 +3080 1.467541081 0.008001699
  1143 +3082 1.467856909 0.009099248
  1144 +3084 1.467267609 0.010561298
  1145 +3086 1.465332472 0.011595346
  1146 +3088 1.462682921 0.010891552
  1147 +3090 1.461203035 0.008553483
  1148 +3092 1.461344785 0.006257663
  1149 +3094 1.462213698 0.00474251
  1150 +3096 1.463212479 0.00389488
  1151 +3098 1.464116618 0.003502421
  1152 +3100 1.464823693 0.003425661
  1153 +3102 1.465256367 0.003542455
  1154 +3104 1.465335815 0.0036633
  1155 +3106 1.465190984 0.003512557
  1156 +3108 1.465169074 0.003071606
  1157 +3110 1.465380607 0.002623191
  1158 +3112 1.465682768 0.002302389
  1159 +3114 1.465969313 0.002083306
  1160 +3116 1.466197395 0.00190296
  1161 +3118 1.46639102 0.001701246
  1162 +3120 1.466610549 0.001472218
  1163 +3122 1.466870492 0.001266802
  1164 +3124 1.467139097 0.001102215
  1165 +3126 1.467402517 0.000972843
  1166 +3128 1.467659659 0.000865976
  1167 +3130 1.467905953 0.000787123
  1168 +3132 1.468134489 0.00072557
  1169 +3134 1.468347231 0.00067862
  1170 +3136 1.468545536 0.000643376
  1171 +3138 1.46872579 0.000613508
  1172 +3140 1.468896068 0.000585754
  1173 +3142 1.469053617 0.000561171
  1174 +3144 1.469207884 0.000538802
  1175 +3146 1.469351559 0.000520081
  1176 +3148 1.469489266 0.000505697
  1177 +3150 1.46961712 0.000493471
  1178 +3152 1.469739323 0.000480268
  1179 +3154 1.469857715 0.000470385
  1180 +3156 1.469970841 0.00045922
  1181 +3158 1.470081254 0.000450945
  1182 +3160 1.470188345 0.000450827
  1183 +3162 1.470287492 0.000455121
  1184 +3164 1.470375616 0.000465884
  1185 +3166 1.470447337 0.000478799
  1186 +3168 1.470495236 0.000482832
  1187 +3170 1.470532879 0.000455626
  1188 +3172 1.47059397 0.000403339
  1189 +3174 1.470680289 0.000360438
  1190 +3176 1.470771001 0.000332521
  1191 +3178 1.470858344 0.000313939
  1192 +3180 1.47094238 0.000300706
  1193 +3182 1.471021271 0.000290666
  1194 +3184 1.471096912 0.000282478
  1195 +3186 1.471168154 0.000275747
  1196 +3188 1.471236186 0.000269274
  1197 +3190 1.471301847 0.000262631
  1198 +3192 1.471365114 0.000255445
  1199 +3194 1.471427348 0.000248378
  1200 +3196 1.471488517 0.000241978
  1201 +3198 1.47154755 0.000236252
  1202 +3200 1.47160533 0.000230923
  1203 +3202 1.471660128 0.000226049
  1204 +3204 1.47171225 0.000221226
  1205 +3206 1.471763155 0.000214716
  1206 +3208 1.471813951 0.000206518
  1207 +3210 1.471864668 0.000198105
  1208 +3212 1.471916616 0.000190353
  1209 +3214 1.471967385 0.000183842
  1210 +3216 1.472017079 0.000178537
  1211 +3218 1.472065889 0.000173733
  1212 +3220 1.472113652 0.000169366
  1213 +3222 1.472159365 0.0001653
  1214 +3224 1.472205007 0.000161253
  1215 +3226 1.472250332 0.00015755
  1216 +3228 1.472294241 0.000154291
  1217 +3230 1.472337337 0.000151403
  1218 +3232 1.472379806 0.000148762
  1219 +3234 1.472421223 0.000146609
  1220 +3236 1.472461738 0.000144929
  1221 +3238 1.472500905 0.000143621
  1222 +3240 1.472539331 0.000142424
  1223 +3242 1.472576666 0.000141225
  1224 +3244 1.472612894 0.00013988
  1225 +3246 1.472649422 0.00013812
  1226 +3248 1.47268468 0.000136558
  1227 +3250 1.472718966 0.00013503
  1228 +3252 1.472753298 0.000133891
  1229 +3254 1.472787238 0.000133096
  1230 +3256 1.472819576 0.000132369
  1231 +3258 1.472850861 0.000131179
  1232 +3260 1.472881925 0.000129611
  1233 +3262 1.472913 0.000128051
  1234 +3264 1.472943992 0.000126497
  1235 +3266 1.4729752 0.000125487
  1236 +3268 1.473004566 0.000124918
  1237 +3270 1.473033069 0.000124283
  1238 +3272 1.473062298 0.000123525
  1239 +3274 1.473090298 0.000122442
  1240 +3276 1.473117251 0.000121444
  1241 +3278 1.473145192 0.00012076
  1242 +3280 1.473171918 0.000120133
  1243 +3282 1.473199048 0.000119423
  1244 +3284 1.473224805 0.000118787
  1245 +3286 1.47325068 0.00011805
  1246 +3288 1.473275587 0.000117491
  1247 +3290 1.473301496 0.000116941
  1248 +3292 1.473325233 0.000116412
  1249 +3294 1.473350252 0.000116041
  1250 +3296 1.47337511 0.000115835
  1251 +3298 1.47339906 0.000116086
  1252 +3300 1.47342297 0.000116987
  1253 +3302 1.473445822 0.000118268
  1254 +3304 1.473466581 0.000119505
  1255 +3306 1.473487385 0.000120364
  1256 +3308 1.473507032 0.000119983
  1257 +3310 1.473526836 0.000118961
  1258 +3312 1.47354755 0.000117874
  1259 +3314 1.473568295 0.000117091
  1260 +3316 1.473589032 0.000116576
  1261 +3318 1.473608805 0.000116631
  1262 +3320 1.473628554 0.000116649
  1263 +3322 1.473647349 0.00011664
  1264 +3324 1.473665478 0.000116602
  1265 +3326 1.47368305 0.000116254
  1266 +3328 1.4736996 0.000115188
  1267 +3330 1.473717184 0.000113812
  1268 +3332 1.473733781 0.000111681
  1269 +3334 1.473750687 0.000108818
  1270 +3336 1.473768449 0.000105958
  1271 +3338 1.473786661 0.000103152
  1272 +3340 1.473804046 0.000100395
  1273 +3342 1.473822765 9.80E-05
  1274 +3344 1.47384041 9.54E-05
  1275 +3346 1.473859047 9.25E-05
  1276 +3348 1.473878582 9.01E-05
  1277 +3350 1.473897523 8.83E-05
  1278 +3352 1.473917523 8.72E-05
  1279 +3354 1.473936067 8.64E-05
  1280 +3356 1.473954889 8.61E-05
  1281 +3358 1.47397354 8.62E-05
  1282 +3360 1.473992346 8.70E-05
  1283 +3362 1.474010557 8.83E-05
  1284 +3364 1.47402827 9.00E-05
  1285 +3366 1.474045082 9.23E-05
  1286 +3368 1.474061418 9.51E-05
  1287 +3370 1.474077043 9.79E-05
  1288 +3372 1.474090591 0.000100096
  1289 +3374 1.47410503 0.000102179
  1290 +3376 1.474117827 0.00010375
  1291 +3378 1.474130815 0.000105213
  1292 +3380 1.474143266 0.000106689
  1293 +3382 1.474155712 0.000107854
  1294 +3384 1.474167173 0.000108504
  1295 +3386 1.474178416 0.000108466
  1296 +3388 1.47418915 0.000107522
  1297 +3390 1.474199987 0.000105586
  1298 +3392 1.474211901 0.000103099
  1299 +3394 1.474224434 0.000100324
  1300 +3396 1.474236835 9.74E-05
  1301 +3398 1.474250335 9.52E-05
  1302 +3400 1.474264805 9.35E-05
  1303 +3402 1.474278267 9.21E-05
  1304 +3404 1.474291704 9.07E-05
  1305 +3406 1.474304771 8.91E-05
  1306 +3408 1.474318355 8.75E-05
  1307 +3410 1.474331936 8.57E-05
  1308 +3412 1.474346421 8.44E-05
  1309 +3414 1.474360879 8.35E-05
  1310 +3416 1.474375326 8.28E-05
  1311 +3418 1.474390181 8.26E-05
  1312 +3420 1.474405156 8.35E-05
  1313 +3422 1.474420443 8.51E-05
  1314 +3424 1.474436061 8.77E-05
  1315 +3426 1.474449644 9.19E-05
  1316 +3428 1.474462948 9.73E-05
  1317 +3430 1.474474391 0.000103498
  1318 +3432 1.474484169 0.000110175
  1319 +3434 1.47449072 0.000116489
  1320 +3436 1.474495914 0.000121652
  1321 +3438 1.474499038 0.0001252
  1322 +3440 1.474499934 0.000126017
  1323 +3442 1.474501355 0.000123364
  1324 +3444 1.474504588 0.000118359
  1325 +3446 1.474508751 0.000111284
  1326 +3448 1.474514459 0.000102049
  1327 +3450 1.474524843 9.29E-05
  1328 +3452 1.474538272 8.57E-05
  1329 +3454 1.474551723 8.04E-05
  1330 +3456 1.474565172 7.65E-05
  1331 +3458 1.474578602 7.35E-05
  1332 +3460 1.474591921 7.16E-05
  1333 +3462 1.474604503 7.00E-05
  1334 +3464 1.474616965 6.87E-05
  1335 +3466 1.474628399 6.77E-05
  1336 +3468 1.474639874 6.66E-05
  1337 +3470 1.474651882 6.58E-05
  1338 +3472 1.474662664 6.49E-05
  1339 +3474 1.474674097 6.42E-05
  1340 +3476 1.474684737 6.34E-05
  1341 +3478 1.474696083 6.21E-05
  1342 +3480 1.47470752 6.08E-05
  1343 +3482 1.474718859 6.00E-05
  1344 +3484 1.474731411 5.95E-05
  1345 +3486 1.474743217 5.98E-05
  1346 +3488 1.474755405 6.07E-05
  1347 +3490 1.474765776 6.21E-05
  1348 +3492 1.474775177 6.36E-05
  1349 +3494 1.474784377 6.40E-05
  1350 +3496 1.474793753 6.37E-05
  1351 +3498 1.474803528 6.27E-05
  1352 +3500 1.474813865 6.17E-05
  1353 +3502 1.474825403 6.13E-05
  1354 +3504 1.474836865 6.13E-05
  1355 +3506 1.47484923 6.25E-05
  1356 +3508 1.474860542 6.44E-05
  1357 +3510 1.474871181 6.71E-05
  1358 +3512 1.474881618 7.04E-05
  1359 +3514 1.474891556 7.48E-05
  1360 +3516 1.474897792 7.96E-05
  1361 +3518 1.474901998 8.35E-05
  1362 +3520 1.474905152 8.40E-05
  1363 +3522 1.474908586 8.07E-05
  1364 +3524 1.474915894 7.56E-05
  1365 +3526 1.474925638 7.11E-05
  1366 +3528 1.474937218 6.82E-05
  1367 +3530 1.474949652 6.64E-05
  1368 +3532 1.474962095 6.58E-05
  1369 +3534 1.474975481 6.67E-05
  1370 +3536 1.47498901 6.95E-05
  1371 +3538 1.475002501 7.44E-05
  1372 +3540 1.475013344 8.17E-05
  1373 +3542 1.47502156 9.03E-05
  1374 +3544 1.475025909 9.86E-05
  1375 +3546 1.475027988 0.000104547
  1376 +3548 1.475029087 0.000107434
  1377 +3550 1.475030131 0.000108038
  1378 +3552 1.475031521 0.000107167
  1379 +3554 1.47503369 0.000105179
  1380 +3556 1.475035962 0.000101095
  1381 +3558 1.475039944 9.51E-05
  1382 +3560 1.475047208 8.82E-05
  1383 +3562 1.475057577 8.18E-05
  1384 +3564 1.475069218 7.69E-05
  1385 +3566 1.475082228 7.39E-05
  1386 +3568 1.475095836 7.28E-05
  1387 +3570 1.475109436 7.34E-05
  1388 +3572 1.475122992 7.57E-05
  1389 +3574 1.475135442 7.97E-05
  1390 +3576 1.475147886 8.51E-05
  1391 +3578 1.475158773 9.29E-05
  1392 +3580 1.4751683 0.000102526
  1393 +3582 1.475173011 0.000114877
  1394 +3584 1.475167301 0.000126191
  1395 +3586 1.475160988 0.000124628
  1396 +3588 1.475159999 0.000119416
  1397 +3590 1.47516345 0.000112007
  1398 +3592 1.475169959 0.000105579
  1399 +3594 1.475178935 0.000100692
  1400 +3596 1.475189495 9.80E-05
  1401 +3598 1.47519987 9.79E-05
  1402 +3600 1.475208153 9.77E-05
  1403 +3602 1.475216397 9.63E-05
  1404 +3604 1.475226778 9.48E-05
  1405 +3606 1.475237563 9.41E-05
  1406 +3608 1.475249058 9.39E-05
  1407 +3610 1.475262354 9.47E-05
  1408 +3612 1.475276891 9.80E-05
  1409 +3614 1.475292415 0.000104631
  1410 +3616 1.475305776 0.000115783
  1411 +3618 1.475315507 0.000130667
  1412 +3620 1.475318072 0.000146477
  1413 +3622 1.475313309 0.000158531
  1414 +3624 1.475305207 0.000162319
  1415 +3626 1.475300997 0.000158126
  1416 +3628 1.475304196 0.000150672
  1417 +3630 1.475312923 0.00014455
  1418 +3632 1.47532683 0.000142051
  1419 +3634 1.475342302 0.00014553
  1420 +3636 1.475358179 0.000153343
  1421 +3638 1.475372708 0.000167576
  1422 +3640 1.475383066 0.000187306
  1423 +3642 1.47538491 0.000211282
  1424 +3644 1.475378084 0.000235521
  1425 +3646 1.475361528 0.000255526
  1426 +3648 1.475338298 0.000267309
  1427 +3650 1.475311272 0.00026762
  1428 +3652 1.475288315 0.000257282
  1429 +3654 1.475271733 0.000238427
  1430 +3656 1.475264007 0.00021591
  1431 +3658 1.47526538 0.000194199
  1432 +3660 1.475271965 0.000175916
  1433 +3662 1.475283325 0.000162335
  1434 +3664 1.475295472 0.000152841
  1435 +3666 1.47530792 0.000146982
  1436 +3668 1.475319403 0.000143998
  1437 +3670 1.475329509 0.000143648
  1438 +3672 1.475337525 0.000144734
  1439 +3674 1.475342646 0.000145901
  1440 +3676 1.475344937 0.000145536
  1441 +3678 1.475347938 0.000142791
  1442 +3680 1.47535101 0.000138713
  1443 +3682 1.475355127 0.000133855
  1444 +3684 1.47536061 0.000128953
  1445 +3686 1.475366775 0.000123725
  1446 +3688 1.475374222 0.000118054
  1447 +3690 1.475383491 0.000112539
  1448 +3692 1.475394668 0.000108763
  1449 +3694 1.475406148 0.000106869
  1450 +3696 1.475417668 0.000106179
  1451 +3698 1.475431036 0.000108026
  1452 +3700 1.475443093 0.000113499
  1453 +3702 1.475451689 0.000122346
  1454 +3704 1.475453966 0.000132017
  1455 +3706 1.475452075 0.000138205
  1456 +3708 1.475447975 0.000137813
  1457 +3710 1.475447048 0.000131957
  1458 +3712 1.475451897 0.000124912
  1459 +3714 1.475459959 0.000120086
  1460 +3716 1.475470951 0.000119369
  1461 +3718 1.475480666 0.000123023
  1462 +3720 1.475486979 0.000129682
  1463 +3722 1.47548796 0.000136686
  1464 +3724 1.475484782 0.000140356
  1465 +3726 1.475479476 0.000137643
  1466 +3728 1.475478633 0.000130059
  1467 +3730 1.475481745 0.000121898
  1468 +3732 1.475487781 0.000115279
  1469 +3734 1.475494036 0.000109786
  1470 +3736 1.475501254 0.0001053
  1471 +3738 1.475509342 0.000101063
  1472 +3740 1.475516832 9.69E-05
  1473 +3742 1.475526886 9.32E-05
  1474 +3744 1.475537291 9.10E-05
  1475 +3746 1.475546782 8.98E-05
  1476 +3748 1.475557133 8.93E-05
  1477 +3750 1.475566593 8.96E-05
  1478 +3752 1.475576695 9.07E-05
  1479 +3754 1.475586473 9.23E-05
  1480 +3756 1.475595298 9.52E-05
  1481 +3758 1.4756036 9.88E-05
  1482 +3760 1.475610915 0.000102898
  1483 +3762 1.475616097 0.000106542
  1484 +3764 1.475620291 0.000108639
  1485 +3766 1.475624418 0.000107126
  1486 +3768 1.475633066 0.000104745
  1487 +3770 1.475644052 0.000104907
  1488 +3772 1.475655523 0.000107524
  1489 +3774 1.475666948 0.000112566
  1490 +3776 1.475678309 0.000120129
  1491 +3778 1.475687551 0.000130378
  1492 +3780 1.475694636 0.000143388
  1493 +3782 1.475695475 0.000157828
  1494 +3784 1.475689514 0.000171337
  1495 +3786 1.475678359 0.000178286
  1496 +3788 1.475665939 0.000174781
  1497 +3790 1.47566102 0.000164121
  1498 +3792 1.47566355 0.00015261
  1499 +3794 1.475671857 0.000144163
  1500 +3796 1.475683213 0.000139239
  1501 +3798 1.475695293 0.000137793
  1502 +3800 1.475707725 0.000140105
  1503 +3802 1.4757181 0.000145422
  1504 +3804 1.475726484 0.000152835
  1505 +3806 1.475731342 0.000161128
  1506 +3808 1.47573352 0.000168582
  1507 +3810 1.475732924 0.00017333
  1508 +3812 1.475732993 0.000175196
  1509 +3814 1.475733987 0.000174404
  1510 +3816 1.475738176 0.000172977
  1511 +3818 1.475745275 0.000172633
  1512 +3820 1.475752771 0.000174761
  1513 +3822 1.475759674 0.000179016
  1514 +3824 1.475764703 0.000183475
  1515 +3826 1.475769755 0.00018761
  1516 +3828 1.475776986 0.000192418
  1517 +3830 1.475783098 0.000199639
  1518 +3832 1.475788297 0.000209346
  1519 +3834 1.475790958 0.000221078
  1520 +3836 1.475788399 0.000233277
  1521 +3838 1.475781539 0.000243302
  1522 +3840 1.475773258 0.00024822
  1523 +3842 1.475766957 0.000249319
  1524 +3844 1.475761815 0.000250161
  1525 +3846 1.47575639 0.000251131
  1526 +3848 1.475748935 0.000250954
  1527 +3850 1.475740677 0.000247448
  1528 +3852 1.47573419 0.000239298
  1529 +3854 1.475732013 0.00022763
  1530 +3856 1.475736094 0.000215807
  1531 +3858 1.475743401 0.000207047
  1532 +3860 1.475754065 0.000202158
  1533 +3862 1.475765096 0.000202101
  1534 +3864 1.475773442 0.000206089
  1535 +3866 1.475777823 0.000212973
  1536 +3868 1.475777044 0.00022007
  1537 +3870 1.475769788 0.000223161
  1538 +3872 1.475761679 0.000217701
  1539 +3874 1.475759835 0.00020568
  1540 +3876 1.475766159 0.000194071
  1541 +3878 1.475776036 0.000186624
  1542 +3880 1.475787496 0.000183261
  1543 +3882 1.47579899 0.000183371
  1544 +3884 1.475808298 0.000186003
  1545 +3886 1.475815532 0.000190704
  1546 +3888 1.475820446 0.000195753
  1547 +3890 1.475823615 0.000199899
  1548 +3892 1.475824887 0.000202665
  1549 +3894 1.475826912 0.000204321
  1550 +3896 1.475827988 0.000204971
  1551 +3898 1.475830058 0.000204185
  1552 +3900 1.475833336 0.00020288
  1553 +3902 1.475837981 0.000202091
  1554 +3904 1.475843498 0.000203201
  1555 +3906 1.475848785 0.000206778
  1556 +3908 1.475851041 0.00021273
  1557 +3910 1.475847864 0.000215759
  1558 +3912 1.475845039 0.000211571
  1559 +3914 1.475847728 0.000205958
  1560 +3916 1.47585513 0.000202886
  1561 +3918 1.475861612 0.00020386
  1562 +3920 1.475866801 0.000208044
  1563 +3922 1.475868017 0.000213749
  1564 +3924 1.475862852 0.000216258
  1565 +3926 1.47585769 0.000210993
  1566 +3928 1.475857257 0.000200361
  1567 +3930 1.475865029 0.000190404
  1568 +3932 1.475876388 0.000185295
  1569 +3934 1.475887586 0.000184723
  1570 +3936 1.475896004 0.000186124
  1571 +3938 1.475903314 0.000187275
  1572 +3940 1.475910608 0.000189149
  1573 +3942 1.475917896 0.000191266
  1574 +3944 1.475924571 0.000194824
  1575 +3946 1.475930811 0.000199963
  1576 +3948 1.475933986 0.000206118
  1577 +3950 1.475932956 0.000211965
  1578 +3952 1.475928783 0.000211772
  1579 +3954 1.475926843 0.00020721
  1580 +3956 1.475929862 0.000200358
  1581 +3958 1.475936289 0.000194987
  1582 +3960 1.475943518 0.00019141
  1583 +3962 1.475951862 0.000188811
  1584 +3964 1.475959113 0.000186954
  1585 +3966 1.47596855 0.000184972
  1586 +3968 1.475977129 0.000183219
  1587 +3970 1.47598747 0.000181797
  1588 +3972 1.476000044 0.000181759
  1589 +3974 1.476013374 0.000184824
  1590 +3976 1.476026922 0.000192623
  1591 +3978 1.476034056 0.000205577
  1592 +3980 1.476028174 0.000216734
  1593 +3982 1.476018745 0.000209197
  1594 +3984 1.476025637 0.000193026
  1595 +3986 1.476043674 0.000183363
  1596 +3988 1.476063276 0.000180229
  1597 +3990 1.476083041 0.000181566
  1598 +3992 1.476102695 0.000186255
  1599 +3994 1.476122622 0.000193691
  1600 +3996 1.476140785 0.000204149
  1601 +3998 1.476157521 0.000217163
  1602 +4000 1.476171336 0.000231948
0 1603 \ No newline at end of file
... ...
eta_TolueneK.txt deleted
1   -800 0.00237097091817457
2   -802 0.00227949941219620
3   -804 0.00221816388191892
4   -806 0.00217471041775780
5   -808 0.00215481795727275
6   -810 0.00213388387011066
7   -812 0.00209363211698535
8   -814 0.00202082763908315
9   -816 0.00193585066178408
10   -818 0.00188250850160370
11   -820 0.00184538369212481
12   -822 0.00183536653704965
13   -824 0.00185974183080381
14   -826 0.00190647188683237
15   -828 0.00199326404385590
16   -830 0.00213499888469032
17   -832 0.00233225842027966
18   -834 0.00257593995310952
19   -836 0.00287502014227382
20   -838 0.00318754088914534
21   -840 0.00349170996961850
22   -842 0.00366108155160527
23   -844 0.00362683356184450
24   -846 0.00340059748640139
25   -848 0.00305608088262669
26   -850 0.00270129337895778
27   -852 0.00239675724637807
28   -854 0.00217864428240924
29   -856 0.00203021645685105
30   -858 0.00193686140678899
31   -860 0.00187749764181973
32   -862 0.00185772044069943
33   -864 0.00188910883086452
34   -866 0.00195093483930895
35   -868 0.00204692017755064
36   -870 0.00215522059478817
37   -872 0.00226016367314688
38   -874 0.00224604514385606
39   -876 0.00210230179408609
40   -878 0.00199743674523776
41   -880 0.00199218269491360
42   -882 0.00208480862951801
43   -884 0.00228270137034088
44   -886 0.00262030644370857
45   -888 0.00319352984551477
46   -890 0.00421972378192706
47   -892 0.00602385856914103
48   -894 0.00840405009274333
49   -896 0.00900675480510885
50   -898 0.00696613165618276
51   -900 0.00499554830114596
52   -902 0.00383849939561442
53   -904 0.00320523678732641
54   -906 0.00285555041538049
55   -908 0.00266476454212409
56   -910 0.00254627716354120
57   -912 0.00245341529587653
58   -914 0.00236459307673934
59   -916 0.00229282344387905
60   -918 0.00223035979386559
61   -920 0.00221227947671869
62   -922 0.00224238729804433
63   -924 0.00235007654381494
64   -926 0.00256726325953723
65   -928 0.00284644035247116
66   -930 0.00294228033320561
67   -932 0.00275916688965430
68   -934 0.00258731026217053
69   -936 0.00255719587176405
70   -938 0.00262153336828821
71   -940 0.00273896371051358
72   -942 0.00287538936255749
73   -944 0.00299732885131251
74   -946 0.00309698674175826
75   -948 0.00316605202547143
76   -950 0.00320470876397792
77   -952 0.00323491311445059
78   -954 0.00329692599734166
79   -956 0.00338582912769461
80   -958 0.00350331602393855
81   -960 0.00365994789379712
82   -962 0.00382797968742639
83   -964 0.00395048819829240
84   -966 0.00399909330987952
85   -968 0.00397747867047571
86   -970 0.00393338530466517
87   -972 0.00391527408455760
88   -974 0.00393711464406835
89   -976 0.00402058186620085
90   -978 0.00414801626311813
91   -980 0.00426028437517640
92   -982 0.00424343298749414
93   -984 0.00411994903649494
94   -986 0.00399867235513141
95   -988 0.00388651104937391
96   -990 0.00379950457370988
97   -992 0.00373977952014182
98   -994 0.00373881240280082
99   -996 0.00379956481032446
100   -998 0.00393643103780800
101   -1000 0.00418426742600855
102   -1002 0.00448366832068703
103   -1004 0.00421395149528264
104   -1006 0.00400806256602511
105   -1008 0.00395963930728052
106   -1010 0.00399586579501438
107   -1012 0.00412453345420230
108   -1014 0.00435650139468447
109   -1016 0.00470823294497344
110   -1018 0.00525652222711324
111   -1020 0.00620034607293144
112   -1022 0.00761074657742514
113   -1024 0.00904862587038915
114   -1026 0.0128420613454482
115   -1028 0.0232054647758307
116   -1030 0.0401070318402723
117   -1032 0.0237662509507289
118   -1034 0.0150900768702586
119   -1036 0.0136209302389719
120   -1038 0.0140722804433677
121   -1040 0.0148520038780156
122   -1042 0.0150418759020717
123   -1044 0.0142741299011939
124   -1046 0.0127983598294137
125   -1048 0.0111020250322553
126   -1050 0.00953886802849649
127   -1052 0.00823573530792714
128   -1054 0.00722015941851439
129   -1056 0.00647199198407014
130   -1058 0.00595450625097980
131   -1060 0.00562081994003704
132   -1062 0.00547155564647798
133   -1064 0.00551163119086301
134   -1066 0.00577378575211103
135   -1068 0.00633217061275026
136   -1070 0.00731526451760166
137   -1072 0.00888941764012196
138   -1074 0.0111936669094970
139   -1076 0.0145627178352916
140   -1078 0.0198820542781815
141   -1080 0.0272101442099741
142   -1082 0.0294763996691438
143   -1084 0.0207090896497001
144   -1086 0.0127655286195192
145   -1088 0.00854004269533275
146   -1090 0.00635526613490286
147   -1092 0.00518140755178082
148   -1094 0.00455405026737381
149   -1096 0.00426268956025233
150   -1098 0.00423510235887238
151   -1100 0.00446505970250814
152   -1102 0.00496653746864136
153   -1104 0.00580707926483870
154   -1106 0.00666740083564581
155   -1108 0.00624732665593806
156   -1110 0.00479908163793379
157   -1112 0.00361121925654796
158   -1114 0.00287942570706319
159   -1116 0.00246148742161380
160   -1118 0.00222778888171568
161   -1120 0.00209650525411750
162   -1122 0.00202121838132918
163   -1124 0.00199323955812561
164   -1126 0.00200797851417853
165   -1128 0.00204812470413808
166   -1130 0.00209417368698948
167   -1132 0.00209849682757402
168   -1134 0.00210954008712956
169   -1136 0.00214927272221614
170   -1138 0.00221781253558492
171   -1140 0.00231654284254776
172   -1142 0.00241700276584513
173   -1144 0.00252090482583751
174   -1146 0.00265926205183231
175   -1148 0.00286652526484237
176   -1150 0.00313647720191737
177   -1152 0.00347416081610501
178   -1154 0.00387661923259805
179   -1156 0.00410043342018308
180   -1158 0.00394886198110498
181   -1160 0.00373148843650175
182   -1162 0.00350494607394550
183   -1164 0.00334022215869222
184   -1166 0.00324053812759405
185   -1168 0.00323728249115084
186   -1170 0.00337030363472976
187   -1172 0.00370331752537631
188   -1174 0.00446861428672600
189   -1176 0.00627098368325835
190   -1178 0.00931078620410600
191   -1180 0.00795027706068620
192   -1182 0.00505648215885331
193   -1184 0.00377716421438011
194   -1186 0.00319136495849046
195   -1188 0.00290137589052677
196   -1190 0.00275791558623964
197   -1192 0.00269226681474014
198   -1194 0.00266088014296474
199   -1196 0.00258817828799466
200   -1198 0.00241700923017517
201   -1200 0.00221558969693162
202   -1202 0.00211217407863773
203   -1204 0.00220182940076526
204   -1206 0.00261294695511882
205   -1208 0.00347974535374746
206   -1210 0.00437930056728570
207   -1212 0.00342648851242818
208   -1214 0.00227260060290268
209   -1216 0.00178258728885112
210   -1218 0.00154392622881232
211   -1220 0.00139698451678244
212   -1222 0.00129280677379398
213   -1224 0.00121946854787068
214   -1226 0.00117184455170345
215   -1228 0.00113722984861070
216   -1230 0.00111912311009601
217   -1232 0.00111390956612134
218   -1234 0.00112443805885795
219   -1236 0.00115660063219376
220   -1238 0.00121045559427169
221   -1240 0.00129274578774778
222   -1242 0.00140396276384137
223   -1244 0.00154410614148823
224   -1246 0.00169860381220359
225   -1248 0.00180840115780576
226   -1250 0.00177688982988028
227   -1252 0.00157601125295148
228   -1254 0.00138106340282942
229   -1256 0.00125620905206826
230   -1258 0.00118717226425611
231   -1260 0.00114496451549449
232   -1262 0.00111429933337465
233   -1264 0.00109740533980092
234   -1266 0.00108967549075875
235   -1268 0.00109315730663637
236   -1270 0.00110701272913057
237   -1272 0.00112547293050748
238   -1274 0.00114417070376777
239   -1276 0.00115549769406343
240   -1278 0.00115861723477586
241   -1280 0.00114576824540165
242   -1282 0.00112307423917382
243   -1284 0.00110803299150391
244   -1286 0.00109790695605719
245   -1288 0.00109710433202375
246   -1290 0.00110698710171340
247   -1292 0.00113245942678089
248   -1294 0.00117552067320688
249   -1296 0.00124267198974583
250   -1298 0.00132277561158489
251   -1300 0.00139217958266282
252   -1302 0.00142973694885209
253   -1304 0.00144188181676038
254   -1306 0.00147541483276765
255   -1308 0.00159956692209740
256   -1310 0.00186843894759088
257   -1312 0.00216486082449073
258   -1314 0.00211728875491887
259   -1316 0.00187507564071290
260   -1318 0.00171677440706927
261   -1320 0.00164837511625716
262   -1322 0.00163899782669962
263   -1324 0.00166410609076352
264   -1326 0.00171764577889364
265   -1328 0.00180479473401823
266   -1330 0.00194274885535529
267   -1332 0.00206022538770732
268   -1334 0.00196217286057273
269   -1336 0.00188492778401013
270   -1338 0.00187122231048589
271   -1340 0.00188921428962955
272   -1342 0.00193700700412885
273   -1344 0.00200313353323991
274   -1346 0.00208778115174581
275   -1348 0.00218066174704292
276   -1350 0.00226588109762249
277   -1352 0.00236276913468593
278   -1354 0.00248915903884931
279   -1356 0.00265547420500685
280   -1358 0.00284820286383517
281   -1360 0.00303211548157874
282   -1362 0.00319538643027851
283   -1364 0.00338011260813816
284   -1366 0.00363996415682390
285   -1368 0.00400265764738686
286   -1370 0.00448976968523854
287   -1372 0.00525773678870123
288   -1374 0.00662029687278425
289   -1376 0.00908376119233617
290   -1378 0.0123031513241818
291   -1380 0.0121671979448086
292   -1382 0.00940007546463800
293   -1384 0.00754318150864360
294   -1386 0.00640356392721685
295   -1388 0.00563257119321882
296   -1390 0.00511010869784208
297   -1392 0.00475789415695825
298   -1394 0.00452833517370964
299   -1396 0.00440186171426137
300   -1398 0.00433687786700866
301   -1400 0.00432317844214779
302   -1402 0.00436175400856741
303   -1404 0.00444654158141412
304   -1406 0.00458045165701961
305   -1408 0.00472070193080689
306   -1410 0.00484730108752061
307   -1412 0.00499169569971829
308   -1414 0.00517526500052341
309   -1416 0.00540856165680758
310   -1418 0.00569301961826355
311   -1420 0.00603609386579061
312   -1422 0.00639815529754280
313   -1424 0.00676704333943306
314   -1426 0.00709702523848474
315   -1428 0.00735286473751553
316   -1430 0.00758946104003622
317   -1432 0.00786781701959305
318   -1434 0.00830202970708910
319   -1436 0.00898232020613486
320   -1438 0.0100197835148382
321   -1440 0.0115095063570045
322   -1442 0.0133985990853930
323   -1444 0.0153768866835411
324   -1446 0.0171765347348967
325   -1448 0.0189361099169456
326   -1450 0.0208245294344141
327   -1452 0.0228039247538198
328   -1454 0.0246810508004892
329   -1456 0.0262618411626106
330   -1458 0.0273608063623162
331   -1460 0.0277930934742346
332   -1462 0.0274706237226478
333   -1464 0.0264211185824187
334   -1466 0.0247980788620200
335   -1468 0.0228296555480849
336   -1470 0.0207834609064780
337   -1472 0.0188724652439656
338   -1474 0.0171801988754876
339   -1476 0.0157920753997752
340   -1478 0.0147283011159520
341   -1480 0.0140030494767984
342   -1482 0.0137569248084170
343   -1484 0.0141879797029108
344   -1486 0.0159226244331294
345   -1488 0.0201940578220826
346   -1490 0.0260836787125339
347   -1492 0.0401202763896059
348   -1494 0.0761786772950870
349   -1496 0.108223079178941
350   -1498 0.0527249260725011
351   -1500 0.0271635520581988
352   -1502 0.0173322191403291
353   -1504 0.0124889207648925
354   -1506 0.00992131298532918
355   -1508 0.00839752655521901
356   -1510 0.00745176347821015
357   -1512 0.00688020881374870
358   -1514 0.00648533490268327
359   -1516 0.00628100243994201
360   -1518 0.00629379543847072
361   -1520 0.00670033315002658
362   -1522 0.00786453088070098
363   -1524 0.00861000109877936
364   -1526 0.00697026673858113
365   -1528 0.00565227380276001
366   -1530 0.00510003019871344
367   -1532 0.00487330093915990
368   -1534 0.00477643425469498
369   -1536 0.00467177280329912
370   -1538 0.00449022432901730
371   -1540 0.00423934685882746
372   -1542 0.00393426018189818
373   -1544 0.00365660104528498
374   -1546 0.00348923385240243
375   -1548 0.00342710802865492
376   -1550 0.00346898664460405
377   -1552 0.00338295466527580
378   -1554 0.00321378452613121
379   -1556 0.00313430635529189
380   -1558 0.00316907431392649
381   -1560 0.00330481737182376
382   -1562 0.00356172011440931
383   -1564 0.00388898354936485
384   -1566 0.00429638887941885
385   -1568 0.00472113284868973
386   -1570 0.00504929184964361
387   -1572 0.00519286093716334
388   -1574 0.00509202242388202
389   -1576 0.00481769783190026
390   -1578 0.00455543799934706
391   -1580 0.00435935962171553
392   -1582 0.00433990247775519
393   -1584 0.00460726311748136
394   -1586 0.00492003737038605
395   -1588 0.00490704034351103
396   -1590 0.00492753522146188
397   -1592 0.00518588888004375
398   -1594 0.00592543183304241
399   -1596 0.00720757954725413
400   -1598 0.00912890526935344
401   -1600 0.0130293680056744
402   -1602 0.0206809953186127
403   -1604 0.0299953585748135
404   -1606 0.0248157340286292
405   -1608 0.0127358449020555
406   -1610 0.00746783575970784
407   -1612 0.00537209761858949
408   -1614 0.00445129559785390
409   -1616 0.00405329276394375
410   -1618 0.00399146289131384
411   -1620 0.00409659649670941
412   -1622 0.00425086095548363
413   -1624 0.00425306230534309
414   -1626 0.00388013491422351
415   -1628 0.00322765310314340
416   -1630 0.00259805094537761
417   -1632 0.00208657181154715
418   -1634 0.00169843933990688
419   -1636 0.00141785441008406
420   -1638 0.00123234974672297
421   -1640 0.00109764310439106
422   -1642 0.000997096490971439
423   -1644 0.000923943814992787
424   -1646 0.000867694719207358
425   -1648 0.000857989573211860
426   -1650 0.000876925837508371
427   -1652 0.000900483600662835
428   -1654 0.000924599031590994
429   -1656 0.000943402878947833
430   -1658 0.000957189946759812
431   -1660 0.000919301596934912
432   -1662 0.000829980699381760
433   -1664 0.000741920416434289
434   -1666 0.000684454640853614
435   -1668 0.000660487010052916
436   -1670 0.000677329699540855
437   -1672 0.000733663772686657
438   -1674 0.000829672252398670
439   -1676 0.000923202402787059
440   -1678 0.000900896424649981
441   -1680 0.000787132461270056
442   -1682 0.000676995955481515
443   -1684 0.000611701232515841
444   -1686 0.000595044263899243
445   -1688 0.000601913444772076
446   -1690 0.000631185451917075
447   -1692 0.000675093910401457
448   -1694 0.000731422393886708
449   -1696 0.000808376337564176
450   -1698 0.000794279618925047
451   -1700 0.000709354504802398
452   -1702 0.000657251178127169
453   -1704 0.000631084077034609
454   -1706 0.000620630016846374
455   -1708 0.000614804872029308
456   -1710 0.000610379344278778
457   -1712 0.000608365704329393
458   -1714 0.000610177708447017
459   -1716 0.000628060629349526
460   -1718 0.000671390695691186
461   -1720 0.000748670745348075
462   -1722 0.000874314265691752
463   -1724 0.00104123844277088
464   -1726 0.00123749183518020
465   -1728 0.00147184752955714
466   -1730 0.00173223404858593
467   -1732 0.00197582318555127
468   -1734 0.00215543372945357
469   -1736 0.00220452603076912
470   -1738 0.00209119301342784
471   -1740 0.00185700091397871
472   -1742 0.00156445999707629
473   -1744 0.00127824303920924
474   -1746 0.00103830550711541
475   -1748 0.000858082809524967
476   -1750 0.000736720622233361
477   -1752 0.000665836151632355
478   -1754 0.000633014507978860
479   -1756 0.000636204186868655
480   -1758 0.000664560791933513
481   -1760 0.000700854142871225
482   -1762 0.000738249770728404
483   -1764 0.000779473476320026
484   -1766 0.000831332837575542
485   -1768 0.000887483745995595
486   -1770 0.000943100942235622
487   -1772 0.00100855983483948
488   -1774 0.00108815587341361
489   -1776 0.00117336763806935
490   -1778 0.00122720647155439
491   -1780 0.00120867298099444
492   -1782 0.00117346527655232
493   -1784 0.00119371865588136
494   -1786 0.00128533671400934
495   -1788 0.00142590894789679
496   -1790 0.00158054902116715
497   -1792 0.00179850758319075
498   -1794 0.00213331852757031
499   -1796 0.00258371206804431
500   -1798 0.00310651819625664
501   -1800 0.00358456135015573
502   -1802 0.00384535056234718
503   -1804 0.00377208677963125
504   -1806 0.00340950704775298
505   -1808 0.00292589878928829
506   -1810 0.00246230467854199
507   -1812 0.00209503276430901
508   -1814 0.00185262669472132
509   -1816 0.00171702079169156
510   -1818 0.00163886439352206
511   -1820 0.00157730777183400
512   -1822 0.00149679229624579
513   -1824 0.00138863730310920
514   -1826 0.00127743508882463
515   -1828 0.00118456389012839
516   -1830 0.00112905353317808
517   -1832 0.00108606377735617
518   -1834 0.00103086061641581
519   -1836 0.000984959950309749
520   -1838 0.000979289058512249
521   -1840 0.00102288594610930
522   -1842 0.00112067935890798
523   -1844 0.00128394592127716
524   -1846 0.00152723861251123
525   -1848 0.00188826636609761
526   -1850 0.00239227576491655
527   -1852 0.00300971905084921
528   -1854 0.00364059420885185
529   -1856 0.00414527688649222
530   -1858 0.00428418417776257
531   -1860 0.00397341781363892
532   -1862 0.00343437915842565
533   -1864 0.00294698351848267
534   -1866 0.00265685216170442
535   -1868 0.00257554798807387
536   -1870 0.00262362192114651
537   -1872 0.00267320615475132
538   -1874 0.00259670566832300
539   -1876 0.00235341832549094
540   -1878 0.00201352392982882
541   -1880 0.00167162491751218
542   -1882 0.00138756730843950
543   -1884 0.00117032979189392
544   -1886 0.00101120581308014
545   -1888 0.000892343360827370
546   -1890 0.000799797724248844
547   -1892 0.000722584304592367
548   -1894 0.000668205830350704
549   -1896 0.000645563701038960
550   -1898 0.000645767881929762
551   -1900 0.000633984361915526
552   -1902 0.000588098076669510
553   -1904 0.000535948959936282
554   -1906 0.000500979831672727
555   -1908 0.000480503614669823
556   -1910 0.000475812984522745
557   -1912 0.000486823903968232
558   -1914 0.000515195500000000
559   -1916 0.000562568109473544
560   -1918 0.000630427523781356
561   -1920 0.000723610116430462
562   -1922 0.000847642176098185
563   -1924 0.000992789644339751
564   -1926 0.00114429259972093
565   -1928 0.00131728542788928
566   -1930 0.00155893716312052
567   -1932 0.00190373075161683
568   -1934 0.00237556565013185
569   -1936 0.00298040121387223
570   -1938 0.00364293200808332
571   -1940 0.00416589638649938
572   -1942 0.00433944387091247
573   -1944 0.00420413532397440
574   -1946 0.00380161374653215
575   -1948 0.00327719918178656
576   -1950 0.00282576366330091
577   -1952 0.00253348765310892
578   -1954 0.00239437526824859
579   -1956 0.00234603768444204
580   -1958 0.00232574864667046
581   -1960 0.00220039532483667
582   -1962 0.00199445232375287
583   -1964 0.00170495488495039
584   -1966 0.00137875775323702
585   -1968 0.00109690552229723
586   -1970 0.000878128994624433
587   -1972 0.000721601368959039
588   -1974 0.000617419916987627
589   -1976 0.000562113218832075
590   -1978 0.000551026292591773
591   -1980 0.000575711660935202
592   -1982 0.000615370850112472
593   -1984 0.000626638864213787
594   -1986 0.000619344762051612
595   -1988 0.000644972987040071
596   -1990 0.000691941782910493
597   -1992 0.000694254646432683
598   -1994 0.000622443290799324
599   -1996 0.000495200120138662
600   -1998 0.000402620427801543
601   -2000 0.000357520428000267
602   -2002 0.000340715817783006
603   -2004 0.000340725563484929
604   -2006 0.000349587604938024
605   -2008 0.000357889528657337
606   -2010 0.000352782837535485
607   -2012 0.000327904929253038
608   -2014 0.000298699882098499
609   -2016 0.000271842376811093
610   -2018 0.000242333037716520
611   -2020 0.000218337240170542
612   -2022 0.000199194821720737
613   -2024 0.000183911806628813
614   -2026 0.000171888258235563
615   -2028 0.000164785282634461
616   -2030 0.000164391739593814
617   -2032 0.000169011600820695
618   -2034 0.000154127618321273
619   -2036 0.000133850562902313
620   -2038 0.000121768011512588
621   -2040 0.000114542173977814
622   -2042 0.000109960714942027
623   -2044 0.000107324747708015
624   -2046 0.000105319938271901
625   -2048 0.000104400109927128
626   -2050 0.000104560803595480
627   -2052 0.000105682984195988
628   -2054 0.000107138188290709
629   -2056 0.000109850938702712
630   -2058 0.000113964387835913
631   -2060 0.000119159665067584
632   -2062 0.000125394011284327
633   -2064 0.000135383120416356
634   -2066 0.000150829077064515
635   -2068 0.000163896208951784
636   -2070 0.000158538657020860
637   -2072 0.000143857048326539
638   -2074 0.000133838990991728
639   -2076 0.000126082674541763
640   -2078 0.000119111322229434
641   -2080 0.000113978504701401
642   -2082 0.000110907574969952
643   -2084 0.000108574694668308
644   -2086 0.000105750311657561
645   -2088 0.000102757884920459
646   -2090 0.000100315348970678
647   -2092 9.88998809699028e-05
648   -2094 9.84636051990861e-05
649   -2096 9.86736776470892e-05
650   -2098 9.86832304001427e-05
651   -2100 9.94847029581411e-05
652   -2102 0.000102501492433386
653   -2104 0.000108578252528750
654   -2106 0.000117598982731806
655   -2108 0.000128810423312497
656   -2110 0.000138078130156183
657   -2112 0.000139894738408702
658   -2114 0.000140372347283306
659   -2116 0.000147183990385426
660   -2118 0.000142580842940779
661   -2120 0.000126124302551768
662   -2122 0.000119111147897455
663   -2124 0.000117761941379516
664   -2126 0.000110386213471180
665   -2128 0.000100586367430428
666   -2130 9.65127771567695e-05
667   -2132 9.71593180254151e-05
668   -2134 0.000100588542105452
669   -2136 0.000104481772978239
670   -2138 0.000107041125533866
671   -2140 0.000108872498221666
672   -2142 0.000111489568147590
673   -2144 0.000115451529322482
674   -2146 0.000120558240114413
675   -2148 0.000126537781071288
676   -2150 0.000134733619506300
677   -2152 0.000148643632029954
678   -2154 0.000172040859828778
679   -2156 0.000210048660817435
680   -2158 0.000268125741557685
681   -2160 0.000351069215958102
682   -2162 0.000450344598032358
683   -2164 0.000489938528699291
684   -2166 0.000409492796412179
685   -2168 0.000304387639702614
686   -2170 0.000235891130206754
687   -2172 0.000200519075056806
688   -2174 0.000185710828669175
689   -2176 0.000182424899321747
690   -2178 0.000187448554282292
691   -2180 0.000203021437757415
692   -2182 0.000231533383222207
693   -2184 0.000266979354976650
694   -2186 0.000274670338797065
695   -2188 0.000249531305296574
696   -2190 0.000224075465024111
697   -2192 0.000200276630934979
698   -2194 0.000177273244376758
699   -2196 0.000160285923199765
700   -2198 0.000150581068702164
701   -2200 0.000148630566016007
702   -2202 0.000159418644068291
703   -2204 0.000190928483551684
704   -2206 0.000246685640401459
705   -2208 0.000270254541506430
706   -2210 0.000222823187679136
707   -2212 0.000183299674920404
708   -2214 0.000159208446689860
709   -2216 0.000141367831176120
710   -2218 0.000133886240444937
711   -2220 0.000133377867922854
712   -2222 0.000136687110101880
713   -2224 0.000141595068371183
714   -2226 0.000145519316291541
715   -2228 0.000148458736825531
716   -2230 0.000153316938474443
717   -2232 0.000163253960273079
718   -2234 0.000178923069609914
719   -2236 0.000194257120755014
720   -2238 0.000196450490452201
721   -2240 0.000188281502894665
722   -2242 0.000182547056123856
723   -2244 0.000184193400303698
724   -2246 0.000192794200162931
725   -2248 0.000207468879582850
726   -2250 0.000228635659533982
727   -2252 0.000256821954754517
728   -2254 0.000293238050530334
729   -2256 0.000339843587945316
730   -2258 0.000394697192716897
731   -2260 0.000433841600455809
732   -2262 0.000418808222045475
733   -2264 0.000365652480977041
734   -2266 0.000317992842743265
735   -2268 0.000289251978678528
736   -2270 0.000276323460348606
737   -2272 0.000276007776761593
738   -2274 0.000285194711508216
739   -2276 0.000305840459677383
740   -2278 0.000341614672459952
741   -2280 0.000378323694871339
742   -2282 0.000375183465200990
743   -2284 0.000372499291886178
744   -2286 0.000379130457959152
745   -2288 0.000369071052928138
746   -2290 0.000344203099796142
747   -2292 0.000313724278864159
748   -2294 0.000283180068926335
749   -2296 0.000260398235921227
750   -2298 0.000248364444837745
751   -2300 0.000246962256014277
752   -2302 0.000257337196851115
753   -2304 0.000282117167464228
754   -2306 0.000327011660272884
755   -2308 0.000402901410624785
756   -2310 0.000515678907419335
757   -2312 0.000613221545587734
758   -2314 0.000587317319167494
759   -2316 0.000479703817387008
760   -2318 0.000387543339108333
761   -2320 0.000331935579008350
762   -2322 0.000305882244139694
763   -2324 0.000301743073919341
764   -2326 0.000318021837096887
765   -2328 0.000360763254301904
766   -2330 0.000442864766710211
767   -2332 0.000580146273004247
768   -2334 0.000746878008138738
769   -2336 0.000778905767997363
770   -2338 0.000655878707879373
771   -2340 0.000549860316308082
772   -2342 0.000474310426764780
773   -2344 0.000414796574428013
774   -2346 0.000384139069758195
775   -2348 0.000382158356339707
776   -2350 0.000402158338733409
777   -2352 0.000435516153586227
778   -2354 0.000472182760873504
779   -2356 0.000515961034751272
780   -2358 0.000592576004516974
781   -2360 0.000693206523120231
782   -2362 0.000643638218785556
783   -2364 0.000478341631402279
784   -2366 0.000369914098808752
785   -2368 0.000314093467617302
786   -2370 0.000287309303030045
787   -2372 0.000274524402561852
788   -2374 0.000270061869985669
789   -2376 0.000271829601590763
790   -2378 0.000279194809335497
791   -2380 0.000294905061876556
792   -2382 0.000319347534507768
793   -2384 0.000350241467027989
794   -2386 0.000391786089197638
795   -2388 0.000432288381112108
796   -2390 0.000431894838874137
797   -2392 0.000400306861211915
798   -2394 0.000373780803138032
799   -2396 0.000355410966982535
800   -2398 0.000347151739593354
801   -2400 0.000350924151462325
802   -2402 0.000365706536144189
803   -2404 0.000389705426960732
804   -2406 0.000421334803876133
805   -2408 0.000459934423654906
806   -2410 0.000500616815279102
807   -2412 0.000525702627325844
808   -2414 0.000513223543953278
809   -2416 0.000478247500654749
810   -2418 0.000439595749420076
811   -2420 0.000399407179067621
812   -2422 0.000365631853681067
813   -2424 0.000342099304419797
814   -2426 0.000327643185447820
815   -2428 0.000319852482413628
816   -2430 0.000318090248146717
817   -2432 0.000318226888962093
818   -2434 0.000307017564256603
819   -2436 0.000284561022911212
820   -2438 0.000265983112770141
821   -2440 0.000252937611403322
822   -2442 0.000242679401171322
823   -2444 0.000236093051616947
824   -2446 0.000233130690914760
825   -2448 0.000233167378896135
826   -2450 0.000235415965609999
827   -2452 0.000239364304311204
828   -2454 0.000244209499641596
829   -2456 0.000248579466181052
830   -2458 0.000251144773278908
831   -2460 0.000252431049719579
832   -2462 0.000253691712617762
833   -2464 0.000255788005476147
834   -2466 0.000256434321853842
835   -2468 0.000251072591655402
836   -2470 0.000241597521259849
837   -2472 0.000234162117014666
838   -2474 0.000229676856991507
839   -2476 0.000227592143774873
840   -2478 0.000226834091088810
841   -2480 0.000227168703547583
842   -2482 0.000228588584217583
843   -2484 0.000231746296813716
844   -2486 0.000236823965966075
845   -2488 0.000241600139160114
846   -2490 0.000244394482975018
847   -2492 0.000244248137929474
848   -2494 0.000245127828260994
849   -2496 0.000251434891521320
850   -2498 0.000247993851620619
851   -2500 0.000232735996433491
852   -2502 0.000222497793867323
853   -2504 0.000221589422451279
854   -2506 0.000232579945681551
855   -2508 0.000250427153657126
856   -2510 0.000252498000507853
857   -2512 0.000232189718802120
858   -2514 0.000211050185590214
859   -2516 0.000198391157226399
860   -2518 0.000193635707688150
861   -2520 0.000193341820452081
862   -2522 0.000193371593068733
863   -2524 0.000189643081211288
864   -2526 0.000181794690676754
865   -2528 0.000178838464388285
866   -2530 0.000183501803348288
867   -2532 0.000194837096053966
868   -2534 0.000211327514566071
869   -2536 0.000231393834808824
870   -2538 0.000255837394665623
871   -2540 0.000275709996672117
872   -2542 0.000266055047783776
873   -2544 0.000243859757637041
874   -2546 0.000235285437161138
875   -2548 0.000236304976186297
876   -2550 0.000232544359689715
877   -2552 0.000218806075082454
878   -2554 0.000204743746363893
879   -2556 0.000196655427865349
880   -2558 0.000191976123078746
881   -2560 0.000186392842736032
882   -2562 0.000182465243677096
883   -2564 0.000182341770175991
884   -2566 0.000186622668096877
885   -2568 0.000194771585308041
886   -2570 0.000207509200230819
887   -2572 0.000227536779149540
888   -2574 0.000256126025913237
889   -2576 0.000293783533966409
890   -2578 0.000344606705405512
891   -2580 0.000421000900491490
892   -2582 0.000539940417278290
893   -2584 0.000691325137774485
894   -2586 0.000768064347900480
895   -2588 0.000684349300000000
896   -2590 0.000536495643153772
897   -2592 0.000418107936641488
898   -2594 0.000348162932430616
899   -2596 0.000316562063243598
900   -2598 0.000311605992448936
901   -2600 0.000329718943031756
902   -2602 0.000370011429187919
903   -2604 0.000412184734144213
904   -2606 0.000402481978671523
905   -2608 0.000368470211663778
906   -2610 0.000353398410510846
907   -2612 0.000328281593188018
908   -2614 0.000295400882956194
909   -2616 0.000275902521470556
910   -2618 0.000268299167514448
911   -2620 0.000267511791747167
912   -2622 0.000270974116559811
913   -2624 0.000277238419508473
914   -2626 0.000286763887252883
915   -2628 0.000300107477286003
916   -2630 0.000316524811935304
917   -2632 0.000327263381122722
918   -2634 0.000305877054698251
919   -2636 0.000269148133708810
920   -2638 0.000248172907618610
921   -2640 0.000239823700606054
922   -2642 0.000238746030638882
923   -2644 0.000239868631298371
924   -2646 0.000237697572301885
925   -2648 0.000231658620506580
926   -2650 0.000224559727594560
927   -2652 0.000220154792342943
928   -2654 0.000220025182909045
929   -2656 0.000220821585838385
930   -2658 0.000219097069889182
931   -2660 0.000213668868513552
932   -2662 0.000206551642880241
933   -2664 0.000200132874030954
934   -2666 0.000198263371264169
935   -2668 0.000204157476079366
936   -2670 0.000219581959345431
937   -2672 0.000228529275997830
938   -2674 0.000212671171569940
939   -2676 0.000198554340066309
940   -2678 0.000193733620852842
941   -2680 0.000194427317307389
942   -2682 0.000197546011671515
943   -2684 0.000200581527813713
944   -2686 0.000203985348880727
945   -2688 0.000208935024070450
946   -2690 0.000213885837983080
947   -2692 0.000215780646355564
948   -2694 0.000215167439140776
949   -2696 0.000214895725221701
950   -2698 0.000217360387387823
951   -2700 0.000222623944199778
952   -2702 0.000229950531867105
953   -2704 0.000237779651458241
954   -2706 0.000247270953949545
955   -2708 0.000260083526905394
956   -2710 0.000275286056335416
957   -2712 0.000293138008774478
958   -2714 0.000315098638979930
959   -2716 0.000342140022611386
960   -2718 0.000376355762584957
961   -2720 0.000422618703820090
962   -2722 0.000488803228667163
963   -2724 0.000585387059813060
964   -2726 0.000728318801443707
965   -2728 0.000938827018235910
966   -2730 0.00123037571269695
967   -2732 0.00155229568740433
968   -2734 0.00172266995984292
969   -2736 0.00158429227183195
970   -2738 0.00126235409603059
971   -2740 0.000954219558161654
972   -2742 0.000733284051680574
973   -2744 0.000590574186925838
974   -2746 0.000500913503228797
975   -2748 0.000444283569806984
976   -2750 0.000408552058896459
977   -2752 0.000386442879562956
978   -2754 0.000373264157615818
979   -2756 0.000366670327661857
980   -2758 0.000363876514149830
981   -2760 0.000361532536949891
982   -2762 0.000363675314741141
983   -2764 0.000366718711717702
984   -2766 0.000373487709343178
985   -2768 0.000385907143020104
986   -2770 0.000398462101615587
987   -2772 0.000413801469177668
988   -2774 0.000425659990486031
989   -2776 0.000436402382617843
990   -2778 0.000446662734946199
991   -2780 0.000455121187378285
992   -2782 0.000464083631949392
993   -2784 0.000471837814603525
994   -2786 0.000485996560282024
995   -2788 0.000502172804216709
996   -2790 0.000522830212064553
997   -2792 0.000548289451554969
998   -2794 0.000579634288120943
999   -2796 0.000611379237870225
1000   -2798 0.000641158616950349
1001   -2800 0.000672247209660977
1002   -2802 0.000711615716417748
1003   -2804 0.000756204442404881
1004   -2806 0.000806513382136127
1005   -2808 0.000854383801707436
1006   -2810 0.000899046135928726
1007   -2812 0.000920533253907859
1008   -2814 0.000922946174823163
1009   -2816 0.000938823165339874
1010   -2818 0.000975854382639431
1011   -2820 0.00103794809306155
1012   -2822 0.00111441105526966
1013   -2824 0.00117124310275486
1014   -2826 0.00120584112843460
1015   -2828 0.00126141309789025
1016   -2830 0.00134778284367920
1017   -2832 0.00146199663837007
1018   -2834 0.00159718851386329
1019   -2836 0.00175330338362696
1020   -2838 0.00193523559724759
1021   -2840 0.00214829304268432
1022   -2842 0.00239693861672905
1023   -2844 0.00270947510257679
1024   -2846 0.00308962037090872
1025   -2848 0.00355940585209848
1026   -2850 0.00412210422108316
1027   -2852 0.00476891854151234
1028   -2854 0.00547214050611261
1029   -2856 0.00617409172881556
1030   -2858 0.00678722786702444
1031   -2860 0.00723807939551757
1032   -2862 0.00752048939258356
1033   -2864 0.00769405118384194
1034   -2866 0.00780672387589873
1035   -2868 0.00789211778455793
1036   -2870 0.00795935754077555
1037   -2872 0.00799733164350610
1038   -2874 0.00795934759033912
1039   -2876 0.00778684233057949
1040   -2878 0.00748513477927108
1041   -2880 0.00712782450019760
1042   -2882 0.00674716793892496
1043   -2884 0.00636559086703165
1044   -2886 0.00600252759803496
1045   -2888 0.00568003469443299
1046   -2890 0.00541869257628554
1047   -2892 0.00523149924308805
1048   -2894 0.00513859281992941
1049   -2896 0.00514912231818864
1050   -2898 0.00528298553786387
1051   -2900 0.00554846488279469
1052   -2902 0.00596670745150011
1053   -2904 0.00656025912947429
1054   -2906 0.00737309118502326
1055   -2908 0.00844343143196328
1056   -2910 0.00980783562233305
1057   -2912 0.0114361820721680
1058   -2914 0.0132043723140582
1059   -2916 0.0148639399258050
1060   -2918 0.0160322637171387
1061   -2920 0.0163848402191419
1062   -2922 0.0159315596024990
1063   -2924 0.0149712224125917
1064   -2926 0.0138179195741240
1065   -2928 0.0126830001717222
1066   -2930 0.0117051760061400
1067   -2932 0.0109454119425227
1068   -2934 0.0104094926683649
1069   -2936 0.0100777464854532
1070   -2938 0.00991576239015874
1071   -2940 0.00989092758914217
1072   -2942 0.00995253861794336
1073   -2944 0.0100558436016283
1074   -2946 0.0101466649820268
1075   -2948 0.0101700911447294
1076   -2950 0.0100970420129300
1077   -2952 0.00995445488065370
1078   -2954 0.00977184847019253
1079   -2956 0.00956031409076577
1080   -2958 0.00931672833064324
1081   -2960 0.00900841342025127
1082   -2962 0.00860452512496009
1083   -2964 0.00819173199579369
1084   -2966 0.00793188379052879
1085   -2968 0.00787856977180025
1086   -2970 0.00795406658370171
1087   -2972 0.00807021356855313
1088   -2974 0.00817433984043233
1089   -2976 0.00825003493744345
1090   -2978 0.00828855603001654
1091   -2980 0.00828386290179407
1092   -2982 0.00816950979044141
1093   -2984 0.00795147116279175
1094   -2986 0.00771875813248752
1095   -2988 0.00752177579743462
1096   -2990 0.00739482968641806
1097   -2992 0.00735495102785436
1098   -2994 0.00742400805444368
1099   -2996 0.00762947734762659
1100   -2998 0.00800350176450487
1101   -3000 0.00849881078288103
1102   -3002 0.00896624168638865
1103   -3004 0.00925040248900867
1104   -3006 0.00945455630611128
1105   -3008 0.00976581762927042
1106   -3010 0.0103150719126273
1107   -3012 0.0112091641279662
1108   -3014 0.0125665741882334
1109   -3016 0.0144920310150755
1110   -3018 0.0171523311364697
1111   -3020 0.0206588071576588
1112   -3022 0.0247927573582982
1113   -3024 0.0285338257471566
1114   -3026 0.0305737428191527
1115   -3028 0.0304197730378849
1116   -3030 0.0285285708945381
1117   -3032 0.0254626182993726
1118   -3034 0.0218417847555673
1119   -3036 0.0183214780469989
1120   -3038 0.0154367262434714
1121   -3040 0.0134174271105468
1122   -3042 0.0121814306436623
1123   -3044 0.0114802419869786
1124   -3046 0.0111082334096508
1125   -3048 0.0110364952795097
1126   -3050 0.0112341213861221
1127   -3052 0.0116521403194674
1128   -3054 0.0121679353995795
1129   -3056 0.0126492093791370
1130   -3058 0.0130640240273400
1131   -3060 0.0134217837485980
1132   -3062 0.0136027351521215
1133   -3064 0.0133566760196114
1134   -3066 0.0124957830807641
1135   -3068 0.0111185801076637
1136   -3070 0.00962312187980008
1137   -3072 0.00840019013916095
1138   -3074 0.00762785975903174
1139   -3076 0.00731431659052294
1140   -3078 0.00742769361429674
1141   -3080 0.00800169947155848
1142   -3082 0.00909924810606661
1143   -3084 0.0105612984915747
1144   -3086 0.0115953458981882
1145   -3088 0.0108915516715014
1146   -3090 0.00855348266587572
1147   -3092 0.00625766310903960
1148   -3094 0.00474250996240750
1149   -3096 0.00389487972553113
1150   -3098 0.00350242093033435
1151   -3100 0.00342566123955596
1152   -3102 0.00354245491578370
1153   -3104 0.00366329979669444
1154   -3106 0.00351255659174282
1155   -3108 0.00307160622386024
1156   -3110 0.00262319086310484
1157   -3112 0.00230238895472291
1158   -3114 0.00208330628877116
1159   -3116 0.00190296000440166
1160   -3118 0.00170124594674715
1161   -3120 0.00147221774746264
1162   -3122 0.00126680203340060
1163   -3124 0.00110221512874358
1164   -3126 0.000972843085744223
1165   -3128 0.000865976217229730
1166   -3130 0.000787123046176519
1167   -3132 0.000725569824317256
1168   -3134 0.000678619961272403
1169   -3136 0.000643376054198741
1170   -3138 0.000613508276940799
1171   -3140 0.000585754400051242
1172   -3142 0.000561171104171409
1173   -3144 0.000538801514536514
1174   -3146 0.000520080512301793
1175   -3148 0.000505696831504068
1176   -3150 0.000493470880103411
1177   -3152 0.000480268222246598
1178   -3154 0.000470385004364871
1179   -3156 0.000459220112914975
1180   -3158 0.000450945450269378
1181   -3160 0.000450827328828143
1182   -3162 0.000455120896574839
1183   -3164 0.000465883832863404
1184   -3166 0.000478798660924222
1185   -3168 0.000482832083650923
1186   -3170 0.000455625596338195
1187   -3172 0.000403338720059331
1188   -3174 0.000360438306588196
1189   -3176 0.000332520864586029
1190   -3178 0.000313938694862586
1191   -3180 0.000300705768353348
1192   -3182 0.000290665831960273
1193   -3184 0.000282478444260369
1194   -3186 0.000275747274780963
1195   -3188 0.000269274452306063
1196   -3190 0.000262630704721266
1197   -3192 0.000255445037852355
1198   -3194 0.000248377973867383
1199   -3196 0.000241977580841794
1200   -3198 0.000236251689540068
1201   -3200 0.000230923454004864
1202   -3202 0.000226049100105626
1203   -3204 0.000221226160126354
1204   -3206 0.000214716060376866
1205   -3208 0.000206517982920749
1206   -3210 0.000198104526951019
1207   -3212 0.000190353242003341
1208   -3214 0.000183841618071712
1209   -3216 0.000178536526886377
1210   -3218 0.000173732996508941
1211   -3220 0.000169365792718528
1212   -3222 0.000165299675350027
1213   -3224 0.000161252739783070
1214   -3226 0.000157550287906591
1215   -3228 0.000154290860671044
1216   -3230 0.000151403187559336
1217   -3232 0.000148762116611554
1218   -3234 0.000146608972658800
1219   -3236 0.000144929084687115
1220   -3238 0.000143621190469325
1221   -3240 0.000142423755040669
1222   -3242 0.000141225309365069
1223   -3244 0.000139879705280103
1224   -3246 0.000138120388481842
1225   -3248 0.000136557609027687
1226   -3250 0.000135029965649156
1227   -3252 0.000133891483928728
1228   -3254 0.000133096425324259
1229   -3256 0.000132368577771128
1230   -3258 0.000131178881840028
1231   -3260 0.000129611032335659
1232   -3262 0.000128050800000000
1233   -3264 0.000126496752229370
1234   -3266 0.000125487476864466
1235   -3268 0.000124918363511663
1236   -3270 0.000124282902673504
1237   -3272 0.000123524889665480
1238   -3274 0.000122442491776109
1239   -3276 0.000121443655497364
1240   -3278 0.000120760252331750
1241   -3280 0.000120133235127335
1242   -3282 0.000119422774440518
1243   -3284 0.000118787091342885
1244   -3286 0.000118050006014353
1245   -3288 0.000117490615311207
1246   -3290 0.000116940876538515
1247   -3292 0.000116411722780357
1248   -3294 0.000116040811167173
1249   -3296 0.000115834700717885
1250   -3298 0.000116085966839459
1251   -3300 0.000116986523436758
1252   -3302 0.000118267730379294
1253   -3304 0.000119505403103670
1254   -3306 0.000120364280297837
1255   -3308 0.000119982615737227
1256   -3310 0.000118961448074642
1257   -3312 0.000117873723711904
1258   -3314 0.000117091085003690
1259   -3316 0.000116576391297391
1260   -3318 0.000116630812029799
1261   -3320 0.000116648622872189
1262   -3322 0.000116640410140475
1263   -3324 0.000116601640984688
1264   -3326 0.000116254038453171
1265   -3328 0.000115188264691018
1266   -3330 0.000113811841076524
1267   -3332 0.000111681446514179
1268   -3334 0.000108818040972509
1269   -3336 0.000105958252604406
1270   -3338 0.000103151741537451
1271   -3340 0.000100395217441575
1272   -3342 9.80332064093372e-05
1273   -3344 9.53544349575209e-05
1274   -3346 9.25223256784850e-05
1275   -3348 9.00829101787277e-05
1276   -3350 8.83163531062304e-05
1277   -3352 8.72118771260860e-05
1278   -3354 8.64440098119140e-05
1279   -3356 8.60520504254794e-05
1280   -3358 8.61965597139509e-05
1281   -3360 8.70019144324470e-05
1282   -3362 8.83318478317726e-05
1283   -3364 9.00079714359512e-05
1284   -3366 9.23139048671722e-05
1285   -3368 9.50882502511675e-05
1286   -3370 9.78832163580005e-05
1287   -3372 0.000100096171211192
1288   -3374 0.000102179086616863
1289   -3376 0.000103749608742208
1290   -3378 0.000105213237160669
1291   -3380 0.000106688938713341
1292   -3382 0.000107853667399164
1293   -3384 0.000108503663896066
1294   -3386 0.000108465998629706
1295   -3388 0.000107522134166390
1296   -3390 0.000105586354148376
1297   -3392 0.000103099282581304
1298   -3394 0.000100324257650923
1299   -3396 9.74485799284953e-05
1300   -3398 9.51596059704078e-05
1301   -3400 9.35013107298140e-05
1302   -3402 9.21170196430098e-05
1303   -3404 9.07360614712649e-05
1304   -3406 8.91138931604199e-05
1305   -3408 8.74505590276362e-05
1306   -3410 8.56664975562433e-05
1307   -3412 8.43848055968202e-05
1308   -3414 8.35095737363273e-05
1309   -3416 8.28173663218536e-05
1310   -3418 8.25803390851867e-05
1311   -3420 8.34887031217918e-05
1312   -3422 8.50941717249168e-05
1313   -3424 8.76826565386191e-05
1314   -3426 9.18893425240818e-05
1315   -3428 9.72727573628125e-05
1316   -3430 0.000103498414055259
1317   -3432 0.000110175431772886
1318   -3434 0.000116489353052258
1319   -3436 0.000121652113320222
1320   -3438 0.000125199891677689
1321   -3440 0.000126017012084730
1322   -3442 0.000123363542579961
1323   -3444 0.000118359425974797
1324   -3446 0.000111284305442118
1325   -3448 0.000102049297013716
1326   -3450 9.29060570294263e-05
1327   -3452 8.56830126047782e-05
1328   -3454 8.03943044406067e-05
1329   -3456 7.64946805035534e-05
1330   -3458 7.35384095568400e-05
1331   -3460 7.15607792666279e-05
1332   -3462 7.00113147312602e-05
1333   -3464 6.86840886320734e-05
1334   -3466 6.76516046709459e-05
1335   -3468 6.66317002099573e-05
1336   -3470 6.58163245627029e-05
1337   -3472 6.48526803819241e-05
1338   -3474 6.41769150098627e-05
1339   -3476 6.33519637219242e-05
1340   -3478 6.21036964756407e-05
1341   -3480 6.07594134549892e-05
1342   -3482 5.99888706228529e-05
1343   -3484 5.95355056229478e-05
1344   -3486 5.98196476615315e-05
1345   -3488 6.07067305157839e-05
1346   -3490 6.20707024404776e-05
1347   -3492 6.35630004076309e-05
1348   -3494 6.39802692410745e-05
1349   -3496 6.36894878745265e-05
1350   -3498 6.27365377476382e-05
1351   -3500 6.17431130904710e-05
1352   -3502 6.13279727787810e-05
1353   -3504 6.13193515749704e-05
1354   -3506 6.24903413403870e-05
1355   -3508 6.43864144265415e-05
1356   -3510 6.71410924962580e-05
1357   -3512 7.03539058487688e-05
1358   -3514 7.47946182109209e-05
1359   -3516 7.95754496113107e-05
1360   -3518 8.34700851824913e-05
1361   -3520 8.39873348467991e-05
1362   -3522 8.07272560865977e-05
1363   -3524 7.56312308938946e-05
1364   -3526 7.10894728276635e-05
1365   -3528 6.81632208726418e-05
1366   -3530 6.64216930115337e-05
1367   -3532 6.58132280866232e-05
1368   -3534 6.67321753128692e-05
1369   -3536 6.94647085013537e-05
1370   -3538 7.44308734240544e-05
1371   -3540 8.16543395123198e-05
1372   -3542 9.03200858171377e-05
1373   -3544 9.85535954298993e-05
1374   -3546 0.000104547035052111
1375   -3548 0.000107433770750519
1376   -3550 0.000108038450708995
1377   -3552 0.000107166592996916
1378   -3554 0.000105178798896553
1379   -3556 0.000101095184756009
1380   -3558 9.50814999627662e-05
1381   -3560 8.82058228394490e-05
1382   -3562 8.18208514354733e-05
1383   -3564 7.68850700845907e-05
1384   -3566 7.38744666163043e-05
1385   -3568 7.27642291486909e-05
1386   -3570 7.33994731408140e-05
1387   -3572 7.56627166220080e-05
1388   -3574 7.96660140607364e-05
1389   -3576 8.51090055206606e-05
1390   -3578 9.29167699145132e-05
1391   -3580 0.000102526366929820
1392   -3582 0.000114877275226176
1393   -3584 0.000126190559302250
1394   -3586 0.000124628073841470
1395   -3588 0.000119415520864134
1396   -3590 0.000112006712936662
1397   -3592 0.000105579072932928
1398   -3594 0.000100691596209911
1399   -3596 9.80454508807073e-05
1400   -3598 9.79289585249404e-05
1401   -3600 9.76517090509766e-05
1402   -3602 9.63252158538093e-05
1403   -3604 9.47873503300014e-05
1404   -3606 9.40807594813255e-05
1405   -3608 9.38724750866359e-05
1406   -3610 9.46504942395723e-05
1407   -3612 9.80150733458878e-05
1408   -3614 0.000104630751802908
1409   -3616 0.000115783489148453
1410   -3618 0.000130667214647273
1411   -3620 0.000146477404898454
1412   -3622 0.000158530547818508
1413   -3624 0.000162318596543099
1414   -3626 0.000158125871191841
1415   -3628 0.000150672245587412
1416   -3630 0.000144549679683140
1417   -3632 0.000142051097385185
1418   -3634 0.000145529942933542
1419   -3636 0.000153343488815115
1420   -3638 0.000167576397035396
1421   -3640 0.000187305749491179
1422   -3642 0.000211282337261951
1423   -3644 0.000235521019158824
1424   -3646 0.000255526042383438
1425   -3648 0.000267309387292886
1426   -3650 0.000267620489558132
1427   -3652 0.000257281965913234
1428   -3654 0.000238427431722088
1429   -3656 0.000215910141107563
1430   -3658 0.000194198641163347
1431   -3660 0.000175915805990763
1432   -3662 0.000162335012119966
1433   -3664 0.000152841199834750
1434   -3666 0.000146981907091703
1435   -3668 0.000143997827610619
1436   -3670 0.000143648436802218
1437   -3672 0.000144734329787788
1438   -3674 0.000145900823579283
1439   -3676 0.000145536357339105
1440   -3678 0.000142791335633658
1441   -3680 0.000138712508096908
1442   -3682 0.000133854756804407
1443   -3684 0.000128953007630511
1444   -3686 0.000123724720918296
1445   -3688 0.000118053544364748
1446   -3690 0.000112538647366327
1447   -3692 0.000108762709162428
1448   -3694 0.000106869096858975
1449   -3696 0.000106178550226360
1450   -3698 0.000108026299705946
1451   -3700 0.000113499289845608
1452   -3702 0.000122346067036449
1453   -3704 0.000132017367154307
1454   -3706 0.000138204981263169
1455   -3708 0.000137812952692201
1456   -3710 0.000131957371338105
1457   -3712 0.000124911657013813
1458   -3714 0.000120086480186131
1459   -3716 0.000119368867384451
1460   -3718 0.000123023160227338
1461   -3720 0.000129681526292498
1462   -3722 0.000136685573712829
1463   -3724 0.000140355687154432
1464   -3726 0.000137643004943763
1465   -3728 0.000130059156127694
1466   -3730 0.000121898190215580
1467   -3732 0.000115279209639364
1468   -3734 0.000109785664308487
1469   -3736 0.000105299764060944
1470   -3738 0.000101063203615323
1471   -3740 9.68651180755000e-05
1472   -3742 9.31808749176699e-05
1473   -3744 9.10149507453584e-05
1474   -3746 8.98056206735940e-05
1475   -3748 8.93161375554986e-05
1476   -3750 8.95680290795053e-05
1477   -3752 9.07085327291721e-05
1478   -3754 9.23144122730348e-05
1479   -3756 9.51698234276085e-05
1480   -3758 9.88200437936328e-05
1481   -3760 0.000102897737658181
1482   -3762 0.000106541912714358
1483   -3764 0.000108638955977754
1484   -3766 0.000107125969211894
1485   -3768 0.000104745321090008
1486   -3770 0.000104907149891996
1487   -3772 0.000107524035997495
1488   -3774 0.000112565658169961
1489   -3776 0.000120128967951347
1490   -3778 0.000130377699611365
1491   -3780 0.000143388258757916
1492   -3782 0.000157827987118552
1493   -3784 0.000171336843948261
1494   -3786 0.000178285748324712
1495   -3788 0.000174781489954516
1496   -3790 0.000164121439128089
1497   -3792 0.000152610210570708
1498   -3794 0.000144162759638053
1499   -3796 0.000139239462639203
1500   -3798 0.000137792736182703
1501   -3800 0.000140104567703810
1502   -3802 0.000145422058851258
1503   -3804 0.000152835113748305
1504   -3806 0.000161127793420174
1505   -3808 0.000168581867788859
1506   -3810 0.000173330279437380
1507   -3812 0.000175195783104517
1508   -3814 0.000174404180004515
1509   -3816 0.000172977411115116
1510   -3818 0.000172632535041757
1511   -3820 0.000174761333878933
1512   -3822 0.000179015946250825
1513   -3824 0.000183474569007118
1514   -3826 0.000187609784690581
1515   -3828 0.000192418303544244
1516   -3830 0.000199638672160316
1517   -3832 0.000209346193913544
1518   -3834 0.000221078085152779
1519   -3836 0.000233276912915708
1520   -3838 0.000243302212259793
1521   -3840 0.000248219562860653
1522   -3842 0.000249318750764567
1523   -3844 0.000250161224209589
1524   -3846 0.000251130509086889
1525   -3848 0.000250954031996911
1526   -3850 0.000247448125111366
1527   -3852 0.000239298068537633
1528   -3854 0.000227630000846504
1529   -3856 0.000215807191993378
1530   -3858 0.000207046517196079
1531   -3860 0.000202157638401237
1532   -3862 0.000202101096220524
1533   -3864 0.000206089427126992
1534   -3866 0.000212972794266054
1535   -3868 0.000220069608188463
1536   -3870 0.000223160954785535
1537   -3872 0.000217701230702324
1538   -3874 0.000205680240569784
1539   -3876 0.000194071196201460
1540   -3878 0.000186624022776833
1541   -3880 0.000183260750499541
1542   -3882 0.000183370917787493
1543   -3884 0.000186002682616268
1544   -3886 0.000190704000843751
1545   -3888 0.000195753159488382
1546   -3890 0.000199899173040718
1547   -3892 0.000202664798143917
1548   -3894 0.000204320562044854
1549   -3896 0.000204971280265517
1550   -3898 0.000204184602522533
1551   -3900 0.000202879694728580
1552   -3902 0.000202091110448804
1553   -3904 0.000203200507821011
1554   -3906 0.000206777694070363
1555   -3908 0.000212730193424292
1556   -3910 0.000215758904170297
1557   -3912 0.000211571330269805
1558   -3914 0.000205958146733392
1559   -3916 0.000202885902366098
1560   -3918 0.000203859899346076
1561   -3920 0.000208043821414469
1562   -3922 0.000213749060271441
1563   -3924 0.000216258022232613
1564   -3926 0.000210993095532934
1565   -3928 0.000200360509814737
1566   -3930 0.000190403984953153
1567   -3932 0.000185294952858894
1568   -3934 0.000184723195717293
1569   -3936 0.000186124269760876
1570   -3938 0.000187274520079713
1571   -3940 0.000189148765118607
1572   -3942 0.000191266181204903
1573   -3944 0.000194823747520104
1574   -3946 0.000199962536960736
1575   -3948 0.000206117700447747
1576   -3950 0.000211964821297933
1577   -3952 0.000211771907916455
1578   -3954 0.000207210064931517
1579   -3956 0.000200358454677226
1580   -3958 0.000194986979879340
1581   -3960 0.000191410166101308
1582   -3962 0.000188811490516811
1583   -3964 0.000186954388139908
1584   -3966 0.000184972375095875
1585   -3968 0.000183218705269115
1586   -3970 0.000181796902747989
1587   -3972 0.000181759132648531
1588   -3974 0.000184824282283672
1589   -3976 0.000192623374739583
1590   -3978 0.000205576802325497
1591   -3980 0.000216734030830589
1592   -3982 0.000209196916619900
1593   -3984 0.000193026471982283
1594   -3986 0.000183362654697217
1595   -3988 0.000180228706844783
1596   -3990 0.000181565573496817
1597   -3992 0.000186254988451223
1598   -3994 0.000193691373041908
1599   -3996 0.000204148918879724
1600   -3998 0.000217163156382698
1601   -4000 0.000231947733021415
1602 0 \ No newline at end of file
eta_TolueneN.txt deleted
1   -800 1.44120102496924
2   -802 1.44244952355793
3   -804 1.44362241452370
4   -806 1.44473157548162
5   -808 1.44576931343185
6   -810 1.44673515341541
7   -812 1.44763153740528
8   -814 1.44849997645288
9   -816 1.44937159368323
10   -818 1.45024511061741
11   -820 1.45109838059394
12   -822 1.45193180052550
13   -824 1.45274307737647
14   -826 1.45353862658166
15   -828 1.45431614422343
16   -830 1.45505783090997
17   -832 1.45575257351567
18   -834 1.45637393495922
19   -836 1.45689903981153
20   -838 1.45730768949019
21   -840 1.45754105585989
22   -842 1.45762277914234
23   -844 1.45763704972226
24   -846 1.45770974157519
25   -848 1.45792998369439
26   -850 1.45831194599516
27   -852 1.45879214084464
28   -854 1.45933254646700
29   -856 1.45988983429307
30   -858 1.46043988459777
31   -860 1.46098292821135
32   -862 1.46151723624776
33   -864 1.46203872496248
34   -866 1.46253192223325
35   -868 1.46297856786196
36   -870 1.46337643775072
37   -872 1.46369146339390
38   -874 1.46394643585616
39   -876 1.46431343981134
40   -878 1.46483594897202
41   -880 1.46543855156632
42   -882 1.46608462990801
43   -884 1.46677023178158
44   -886 1.46750898169590
45   -888 1.46831763414834
46   -890 1.46912802427779
47   -892 1.46954514029358
48   -894 1.46839331789610
49   -896 1.46522362501208
50   -898 1.46324102369024
51   -900 1.46324805165743
52   -902 1.46389477313103
53   -904 1.46460285834673
54   -906 1.46524189063531
55   -908 1.46578615865865
56   -910 1.46624870624222
57   -912 1.46665117759441
58   -914 1.46703266934571
59   -916 1.46740765502925
60   -918 1.46779668973951
61   -920 1.46820189802559
62   -922 1.46861141696830
63   -924 1.46901759517687
64   -926 1.46935992609941
65   -928 1.46951316452951
66   -930 1.46945198189589
67   -932 1.46950773718789
68   -934 1.46980252488385
69   -936 1.47016397014931
70   -938 1.47050527825284
71   -940 1.47079802225791
72   -942 1.47102956241248
73   -944 1.47121559715866
74   -946 1.47137193902005
75   -948 1.47152008803324
76   -950 1.47167672882319
77   -952 1.47187041329055
78   -954 1.47208448275609
79   -956 1.47229737949647
80   -958 1.47250268786501
81   -960 1.47267011513556
82   -962 1.47277605897765
83   -964 1.47281096169045
84   -966 1.47283377833869
85   -968 1.47288521062562
86   -970 1.47300680592029
87   -972 1.47318336590741
88   -974 1.47338081764773
89   -976 1.47357969584368
90   -978 1.47371821017195
91   -980 1.47375527316737
92   -982 1.47374243519460
93   -984 1.47381322933363
94   -986 1.47398487555170
95   -988 1.47420629302573
96   -990 1.47448130861459
97   -992 1.47481507770761
98   -994 1.47518229617302
99   -996 1.47557023171639
100   -998 1.47596326572828
101   -1000 1.47630080652934
102   -1002 1.47636823234471
103   -1004 1.47636996678396
104   -1006 1.47689524896944
105   -1008 1.47750032220134
106   -1010 1.47819158796836
107   -1012 1.47897505869564
108   -1014 1.47986167058547
109   -1016 1.48089513800264
110   -1018 1.48214271193312
111   -1020 1.48362438976875
112   -1022 1.48502767979268
113   -1024 1.48723564000764
114   -1026 1.49092289691198
115   -1028 1.49396375951509
116   -1030 1.47873935405011
117   -1032 1.46178488502145
118   -1034 1.46614728364263
119   -1036 1.46944972756204
120   -1038 1.47076139801307
121   -1040 1.47051860247504
122   -1042 1.46925108082617
123   -1044 1.46777888639623
124   -1046 1.46677062217283
125   -1048 1.46644104430282
126   -1050 1.46666085838594
127   -1052 1.46724995592262
128   -1054 1.46804818971542
129   -1056 1.46897681608261
130   -1058 1.46995585496974
131   -1060 1.47098590895262
132   -1062 1.47206714530921
133   -1064 1.47321734998274
134   -1066 1.47445175619764
135   -1068 1.47579194531028
136   -1070 1.47721681438477
137   -1072 1.47863578920406
138   -1074 1.47989036409651
139   -1076 1.48086017571181
140   -1078 1.48069474784801
141   -1080 1.47616731467815
142   -1082 1.46390771869497
143   -1084 1.45570223896581
144   -1086 1.45597971475891
145   -1088 1.45836941934247
146   -1090 1.46066235559752
147   -1092 1.46255873201846
148   -1094 1.46411051824312
149   -1096 1.46540793776881
150   -1098 1.46651204425965
151   -1100 1.46743001960627
152   -1102 1.46810891059625
153   -1104 1.46835826348699
154   -1106 1.46762316195694
155   -1108 1.46618573784309
156   -1110 1.46572358542781
157   -1112 1.46614920302751
158   -1114 1.46684472613418
159   -1116 1.46754366818093
160   -1118 1.46816766240122
161   -1120 1.46871860517754
162   -1122 1.46920770699094
163   -1124 1.46965073082635
164   -1126 1.47005259957817
165   -1128 1.47040212564529
166   -1130 1.47068773768668
167   -1132 1.47096001810126
168   -1134 1.47125261448772
169   -1136 1.47154891832636
170   -1138 1.47183699189280
171   -1140 1.47209800955853
172   -1142 1.47233456778191
173   -1144 1.47257573473017
174   -1146 1.47283356711807
175   -1148 1.47307259446091
176   -1150 1.47326381831914
177   -1152 1.47336996150258
178   -1154 1.47330710459724
179   -1156 1.47293509477181
180   -1158 1.47266594765858
181   -1160 1.47259707273045
182   -1162 1.47267982619196
183   -1164 1.47288581951866
184   -1166 1.47317564562733
185   -1168 1.47355761342796
186   -1170 1.47402209612147
187   -1172 1.47459197223784
188   -1174 1.47529073492465
189   -1176 1.47579201984062
190   -1178 1.47389452829121
191   -1180 1.46944888964386
192   -1182 1.46919538008765
193   -1184 1.46993706618235
194   -1186 1.47058584953654
195   -1188 1.47109418040909
196   -1190 1.47148385016616
197   -1192 1.47177356227783
198   -1194 1.47196611004565
199   -1196 1.47207728619391
200   -1198 1.47220096862104
201   -1200 1.47245042725556
202   -1202 1.47283662225685
203   -1204 1.47330431122777
204   -1206 1.47375342391676
205   -1208 1.47385318037376
206   -1210 1.47280027515132
207   -1212 1.47140252001622
208   -1214 1.47159489093342
209   -1216 1.47205516262945
210   -1218 1.47243159969193
211   -1220 1.47273916940180
212   -1222 1.47301272972689
213   -1224 1.47326393439881
214   -1226 1.47349889542765
215   -1228 1.47371659199003
216   -1230 1.47393059180901
217   -1232 1.47413378656172
218   -1234 1.47433469964923
219   -1236 1.47453039235071
220   -1238 1.47471647903353
221   -1240 1.47488491964895
222   -1242 1.47502851521336
223   -1244 1.47512495593972
224   -1246 1.47514408931247
225   -1248 1.47505892212860
226   -1250 1.47489972136187
227   -1252 1.47484106680061
228   -1254 1.47493923662727
229   -1256 1.47509846252746
230   -1258 1.47526567770392
231   -1260 1.47542057167793
232   -1262 1.47557439533574
233   -1264 1.47572116951863
234   -1266 1.47586745130108
235   -1268 1.47601147334394
236   -1270 1.47614701936603
237   -1272 1.47627015399601
238   -1274 1.47638091039797
239   -1276 1.47648361938200
240   -1278 1.47658183373250
241   -1280 1.47668313548634
242   -1282 1.47679959880658
243   -1284 1.47693261142928
244   -1286 1.47707297484201
245   -1288 1.47722283448259
246   -1290 1.47738070554226
247   -1292 1.47754337420682
248   -1294 1.47770716341215
249   -1296 1.47786028165421
250   -1298 1.47798887584323
251   -1300 1.47808934206014
252   -1302 1.47818243145329
253   -1304 1.47830827158180
254   -1306 1.47849364056186
255   -1308 1.47871221118251
256   -1310 1.47885808674696
257   -1312 1.47873010242650
258   -1314 1.47845803582890
259   -1316 1.47844930632483
260   -1318 1.47861179184706
261   -1320 1.47881460317012
262   -1322 1.47902291732804
263   -1324 1.47922066571969
264   -1326 1.47941412833592
265   -1328 1.47959210849367
266   -1330 1.47973167816960
267   -1332 1.47972691925884
268   -1334 1.47975105896865
269   -1336 1.47993512250321
270   -1338 1.48014837613309
271   -1340 1.48037360725078
272   -1342 1.48060038757184
273   -1344 1.48082753333001
274   -1346 1.48104968129957
275   -1348 1.48126553234897
276   -1350 1.48148716441519
277   -1352 1.48173647624861
278   -1354 1.48200446828695
279   -1356 1.48227599517218
280   -1358 1.48252791950314
281   -1360 1.48276324869435
282   -1362 1.48303458306896
283   -1364 1.48338223264961
284   -1366 1.48379902481358
285   -1368 1.48427223592360
286   -1370 1.48482960284728
287   -1372 1.48552801978829
288   -1374 1.48627546417750
289   -1376 1.48651700069497
290   -1378 1.48432599213190
291   -1380 1.47977968972337
292   -1382 1.47800355097223
293   -1384 1.47805316502072
294   -1386 1.47842143243600
295   -1388 1.47890024839336
296   -1390 1.47940651645865
297   -1392 1.47991712903019
298   -1394 1.48041754934745
299   -1396 1.48089750917415
300   -1398 1.48135158724828
301   -1400 1.48179771126525
302   -1402 1.48224069922095
303   -1404 1.48266579602562
304   -1406 1.48305944158359
305   -1408 1.48342298716122
306   -1410 1.48379030750588
307   -1412 1.48419035949659
308   -1414 1.48461342812701
309   -1416 1.48505164072948
310   -1418 1.48548005566484
311   -1420 1.48588588173361
312   -1422 1.48626036521862
313   -1424 1.48659663343317
314   -1426 1.48690837523274
315   -1428 1.48726752634633
316   -1430 1.48775649947673
317   -1432 1.48841619746365
318   -1434 1.48924758721438
319   -1436 1.49022965011215
320   -1438 1.49126109208233
321   -1440 1.49220157896289
322   -1442 1.49274786168208
323   -1444 1.49275436842747
324   -1446 1.49244040803637
325   -1448 1.49203506779732
326   -1450 1.49142867984501
327   -1452 1.49040469923150
328   -1454 1.48888698396754
329   -1456 1.48687784303199
330   -1458 1.48442850436533
331   -1460 1.48174723159373
332   -1462 1.47906693249971
333   -1464 1.47667955286596
334   -1466 1.47482397028080
335   -1468 1.47364425598396
336   -1470 1.47319928261846
337   -1472 1.47339047699181
338   -1474 1.47411629804730
339   -1476 1.47533374680842
340   -1478 1.47696195971213
341   -1480 1.47908527215456
342   -1482 1.48180866451580
343   -1484 1.48531763958917
344   -1486 1.48994928684771
345   -1488 1.49499065429219
346   -1490 1.50119515596543
347   -1492 1.50990378628749
348   -1494 1.51196694565470
349   -1496 1.44560795826024
350   -1498 1.41456003179507
351   -1500 1.42568725767340
352   -1502 1.43509242814603
353   -1504 1.44179871660811
354   -1506 1.44669596130319
355   -1508 1.45033176716821
356   -1510 1.45318682655572
357   -1512 1.45545228048253
358   -1514 1.45731921509841
359   -1516 1.45894932377219
360   -1518 1.46041227592838
361   -1520 1.46176173499470
362   -1522 1.46244384736929
363   -1524 1.46122289585454
364   -1526 1.46043285810887
365   -1528 1.46128161485975
366   -1530 1.46226970833946
367   -1532 1.46306701307330
368   -1534 1.46366399954379
369   -1536 1.46409417910494
370   -1538 1.46444109535269
371   -1540 1.46477704752644
372   -1542 1.46519165698743
373   -1544 1.46568852566980
374   -1546 1.46623889292729
375   -1548 1.46677632998672
376   -1550 1.46719167293357
377   -1552 1.46747772804745
378   -1554 1.46791932189599
379   -1556 1.46844756268659
380   -1558 1.46898255634672
381   -1560 1.46952197034328
382   -1562 1.46999610489784
383   -1564 1.47038792635287
384   -1566 1.47066419723057
385   -1568 1.47075696992025
386   -1570 1.47067580679212
387   -1572 1.47047224204500
388   -1574 1.47030976437525
389   -1576 1.47033092176687
390   -1578 1.47057489703138
391   -1580 1.47099907306615
392   -1582 1.47158364170880
393   -1584 1.47213789972489
394   -1586 1.47240454856960
395   -1588 1.47273455527947
396   -1590 1.47343724065447
397   -1592 1.47446091811145
398   -1594 1.47574194447918
399   -1596 1.47705173230297
400   -1598 1.47867335885708
401   -1600 1.48062028756105
402   -1602 1.48036168324124
403   -1604 1.47134299168096
404   -1606 1.45508276794757
405   -1608 1.45359592019623
406   -1610 1.45693626090464
407   -1612 1.45964926448336
408   -1614 1.46156535264851
409   -1616 1.46294485069237
410   -1618 1.46393384687173
411   -1620 1.46454159062356
412   -1622 1.46478536173497
413   -1624 1.46467572345167
414   -1626 1.46443675069875
415   -1628 1.46442873304410
416   -1630 1.46468245393626
417   -1632 1.46507304958839
418   -1634 1.46551002264583
419   -1636 1.46597619450157
420   -1638 1.46639465048447
421   -1640 1.46677714745798
422   -1642 1.46713350654907
423   -1644 1.46746066478520
424   -1646 1.46777688897226
425   -1648 1.46807230212257
426   -1650 1.46832313178042
427   -1652 1.46853535477890
428   -1654 1.46871126235072
429   -1656 1.46886441952877
430   -1658 1.46897717842913
431   -1660 1.46906019325977
432   -1662 1.46917336129198
433   -1664 1.46933992968848
434   -1666 1.46953218537231
435   -1668 1.46973458666196
436   -1670 1.46993137012353
437   -1672 1.47010972990258
438   -1674 1.47023592719105
439   -1676 1.47026189453436
440   -1678 1.47023042790416
441   -1680 1.47026824213020
442   -1682 1.47039195163007
443   -1684 1.47055816296083
444   -1686 1.47072223030395
445   -1688 1.47088122473311
446   -1690 1.47102029360098
447   -1692 1.47114084717626
448   -1694 1.47123960018069
449   -1696 1.47128779153643
450   -1698 1.47126399416326
451   -1700 1.47132896383171
452   -1702 1.47143681802407
453   -1704 1.47155945773850
454   -1706 1.47167556592223
455   -1708 1.47178940246904
456   -1710 1.47190604771198
457   -1712 1.47202944260493
458   -1714 1.47216568678700
459   -1716 1.47231539851653
460   -1718 1.47248386890388
461   -1720 1.47265447525274
462   -1722 1.47281731074269
463   -1724 1.47295042900518
464   -1726 1.47304600716400
465   -1728 1.47309375883840
466   -1730 1.47305939547434
467   -1732 1.47291741773166
468   -1734 1.47267688996611
469   -1736 1.47235533806185
470   -1738 1.47204881790723
471   -1740 1.47183343980199
472   -1742 1.47174243401936
473   -1744 1.47176880507034
474   -1746 1.47188162854264
475   -1748 1.47204632190602
476   -1750 1.47223241396135
477   -1752 1.47242316015794
478   -1754 1.47260867420886
479   -1756 1.47278327809895
480   -1758 1.47293258838400
481   -1760 1.47306085751883
482   -1762 1.47317848011178
483   -1764 1.47329045336641
484   -1766 1.47339550159425
485   -1768 1.47349145470639
486   -1770 1.47357817480071
487   -1772 1.47366712599018
488   -1774 1.47373929846121
489   -1776 1.47378551120112
490   -1778 1.47379002011073
491   -1780 1.47381389620918
492   -1782 1.47392354891587
493   -1784 1.47409170003533
494   -1786 1.47427198188798
495   -1788 1.47442615650942
496   -1790 1.47457291909648
497   -1792 1.47474878427437
498   -1794 1.47489348470272
499   -1796 1.47493489892040
500   -1798 1.47478110512949
501   -1800 1.47437081445076
502   -1802 1.47373622085690
503   -1804 1.47304588258769
504   -1806 1.47251222749590
505   -1808 1.47223472657190
506   -1810 1.47217821063195
507   -1812 1.47227236503443
508   -1814 1.47243859996067
509   -1816 1.47259748640805
510   -1818 1.47271718154483
511   -1820 1.47279535803734
512   -1822 1.47284920630461
513   -1824 1.47291235631300
514   -1826 1.47301397376823
515   -1828 1.47314852957960
516   -1830 1.47329330162724
517   -1832 1.47342543709755
518   -1834 1.47357056562475
519   -1836 1.47375873628681
520   -1838 1.47398158101288
521   -1840 1.47422445263378
522   -1842 1.47448077748417
523   -1844 1.47474586805163
524   -1846 1.47500613122839
525   -1848 1.47524723874056
526   -1850 1.47539669943437
527   -1852 1.47535125830335
528   -1854 1.47504217493076
529   -1856 1.47442394463698
530   -1858 1.47358493716912
531   -1860 1.47284787021825
532   -1862 1.47246109965773
533   -1864 1.47241132718491
534   -1866 1.47253616431924
535   -1868 1.47266502935955
536   -1870 1.47267966566327
537   -1872 1.47252923128383
538   -1874 1.47227196419049
539   -1876 1.47203509622402
540   -1878 1.47192107290153
541   -1880 1.47194298711947
542   -1882 1.47205363793314
543   -1884 1.47220708298649
544   -1886 1.47237095289447
545   -1888 1.47253062677600
546   -1890 1.47268167466003
547   -1892 1.47283038859118
548   -1894 1.47298500841240
549   -1896 1.47313109785186
550   -1898 1.47324769232051
551   -1900 1.47333129201763
552   -1902 1.47341557098201
553   -1904 1.47353087942641
554   -1906 1.47366534069078
555   -1908 1.47380841038952
556   -1910 1.47395828541387
557   -1912 1.47411340271346
558   -1914 1.47427400000000
559   -1916 1.47443781042483
560   -1918 1.47460593444462
561   -1920 1.47477582054714
562   -1922 1.47493879861924
563   -1924 1.47508438695513
564   -1926 1.47522698209875
565   -1928 1.47539264822422
566   -1930 1.47558260671450
567   -1932 1.47576219402042
568   -1934 1.47587640732885
569   -1936 1.47583908582835
570   -1938 1.47553060901904
571   -1940 1.47489150443496
572   -1942 1.47409542930774
573   -1944 1.47334201979217
574   -1946 1.47275002485068
575   -1948 1.47244925775411
576   -1950 1.47239944627947
577   -1952 1.47247579265655
578   -1954 1.47255459735783
579   -1956 1.47256197135638
580   -1958 1.47246521668706
581   -1960 1.47228135320174
582   -1962 1.47212551111344
583   -1964 1.47202075140180
584   -1966 1.47202761573580
585   -1968 1.47213420575515
586   -1970 1.47229043240161
587   -1972 1.47246807810995
588   -1974 1.47265001716927
589   -1976 1.47282643638217
590   -1978 1.47298226071844
591   -1980 1.47310651432274
592   -1982 1.47317949653548
593   -1984 1.47321671851061
594   -1986 1.47327006170979
595   -1988 1.47332686296001
596   -1990 1.47332929557274
597   -1992 1.47327822607353
598   -1994 1.47322150680404
599   -1996 1.47323618581223
600   -1998 1.47331824302286
601   -2000 1.47341135456857
602   -2002 1.47349412728021
603   -2004 1.47356154386820
604   -2006 1.47361224775319
605   -2008 1.47364186456648
606   -2010 1.47365636042820
607   -2012 1.47367336928224
608   -2014 1.47370233665225
609   -2016 1.47373443692998
610   -2018 1.47377205797454
611   -2020 1.47381648358614
612   -2022 1.47386111301432
613   -2024 1.47390577969427
614   -2026 1.47395028817579
615   -2028 1.47399564538301
616   -2030 1.47403660265942
617   -2032 1.47406519767252
618   -2034 1.47408330994744
619   -2036 1.47412047010970
620   -2038 1.47416098226622
621   -2040 1.47420115643528
622   -2042 1.47423947043298
623   -2044 1.47427612941305
624   -2046 1.47431218419212
625   -2048 1.47434648116260
626   -2050 1.47438071427926
627   -2052 1.47441278409228
628   -2054 1.47444520616084
629   -2056 1.47447627049456
630   -2058 1.47450675882064
631   -2060 1.47453588733404
632   -2062 1.47456386702353
633   -2064 1.47459073458299
634   -2066 1.47461205370700
635   -2068 1.47461817299827
636   -2070 1.47461840283149
637   -2072 1.47463277175523
638   -2074 1.47465427880758
639   -2076 1.47467709152152
640   -2078 1.47470098997954
641   -2080 1.47472590140090
642   -2082 1.47475065118331
643   -2084 1.47477468067538
644   -2086 1.47479776494193
645   -2088 1.47482142195457
646   -2090 1.47484633615274
647   -2092 1.47487121877337
648   -2094 1.47489609572630
649   -2096 1.47491999718268
650   -2098 1.47494434691905
651   -2100 1.47496980619050
652   -2102 1.47499564254391
653   -2104 1.47502159030193
654   -2106 1.47504417582923
655   -2108 1.47506264533273
656   -2110 1.47507395400220
657   -2112 1.47508393678745
658   -2114 1.47510043049552
659   -2116 1.47511198378437
660   -2118 1.47511214568773
661   -2120 1.47512762848859
662   -2122 1.47515211305019
663   -2124 1.47517182375646
664   -2126 1.47518774789092
665   -2128 1.47521310826668
666   -2130 1.47524116489652
667   -2132 1.47527005212030
668   -2134 1.47529590535418
669   -2136 1.47531935031383
670   -2138 1.47534209120029
671   -2140 1.47536554624085
672   -2142 1.47539141048574
673   -2144 1.47541735186985
674   -2146 1.47544449187503
675   -2148 1.47547342544397
676   -2150 1.47550619668115
677   -2152 1.47554178363426
678   -2154 1.47558203516447
679   -2156 1.47562160093130
680   -2158 1.47565253763469
681   -2160 1.47566151568534
682   -2162 1.47561225894049
683   -2164 1.47548068559088
684   -2166 1.47537296738995
685   -2168 1.47536211403117
686   -2170 1.47539890926361
687   -2172 1.47544656614673
688   -2174 1.47549197749543
689   -2176 1.47553203213436
690   -2178 1.47556864358705
691   -2180 1.47560215753198
692   -2182 1.47562464470162
693   -2184 1.47562085582639
694   -2186 1.47558980476200
695   -2188 1.47557480988891
696   -2190 1.47558033450347
697   -2192 1.47559232749770
698   -2194 1.47561457143455
699   -2196 1.47564434139990
700   -2198 1.47567857523082
701   -2200 1.47571617803152
702   -2202 1.47575726786490
703   -2204 1.47579337721307
704   -2206 1.47579746772491
705   -2208 1.47574189594736
706   -2210 1.47571194854898
707   -2212 1.47572956986763
708   -2214 1.47575472007504
709   -2216 1.47578621163266
710   -2218 1.47581942101129
711   -2220 1.47585088742314
712   -2222 1.47587897173469
713   -2224 1.47590298856875
714   -2226 1.47592470046514
715   -2228 1.47594779372938
716   -2230 1.47597265137572
717   -2232 1.47599748726300
718   -2234 1.47601807246604
719   -2236 1.47602689076481
720   -2238 1.47603005518190
721   -2240 1.47604281703214
722   -2242 1.47606726159445
723   -2244 1.47609784881235
724   -2246 1.47612902016881
725   -2248 1.47615949406397
726   -2250 1.47618852095385
727   -2252 1.47621446243625
728   -2254 1.47623489680521
729   -2256 1.47624408046323
730   -2258 1.47623018458297
731   -2260 1.47617742404058
732   -2262 1.47611228816094
733   -2264 1.47608500995198
734   -2266 1.47609867784140
735   -2268 1.47612909924113
736   -2270 1.47616476482454
737   -2272 1.47619947439469
738   -2274 1.47623253066542
739   -2276 1.47626319551276
740   -2278 1.47628200368923
741   -2280 1.47626680426481
742   -2282 1.47624376410414
743   -2284 1.47624714378783
744   -2286 1.47623939342228
745   -2288 1.47622263640102
746   -2290 1.47621701248520
747   -2292 1.47622414847935
748   -2294 1.47624639786310
749   -2296 1.47628230617739
750   -2298 1.47632637399547
751   -2300 1.47637356620751
752   -2302 1.47642523943489
753   -2304 1.47647814675017
754   -2306 1.47652996718143
755   -2308 1.47657059295077
756   -2310 1.47656605147736
757   -2312 1.47646451238365
758   -2314 1.47632139830172
759   -2316 1.47626434895975
760   -2318 1.47628666976549
761   -2320 1.47634178441866
762   -2322 1.47640626197946
763   -2324 1.47647367980355
764   -2326 1.47654420112269
765   -2328 1.47661693748934
766   -2330 1.47668220577778
767   -2332 1.47670897421522
768   -2334 1.47661953024202
769   -2336 1.47640699456743
770   -2338 1.47628918090598
771   -2340 1.47627922381635
772   -2342 1.47629610568572
773   -2344 1.47633775742674
774   -2346 1.47639668853055
775   -2348 1.47645464076621
776   -2350 1.47650252320800
777   -2352 1.47653396769864
778   -2354 1.47655188224605
779   -2356 1.47656625779288
780   -2358 1.47656342537266
781   -2360 1.47646841808416
782   -2362 1.47627988649258
783   -2364 1.47623361007945
784   -2366 1.47628349602868
785   -2368 1.47634714131595
786   -2370 1.47640579435613
787   -2372 1.47645673781608
788   -2374 1.47650329311272
789   -2376 1.47654473856361
790   -2378 1.47658519751564
791   -2380 1.47662360662062
792   -2382 1.47665509133976
793   -2384 1.47667939867421
794   -2386 1.47668999377568
795   -2388 1.47666832266751
796   -2390 1.47662551968266
797   -2392 1.47661227607686
798   -2394 1.47662326945870
799   -2396 1.47664538468599
800   -2398 1.47667621017793
801   -2400 1.47670840326370
802   -2402 1.47673732384369
803   -2404 1.47676080113293
804   -2406 1.47677566835384
805   -2408 1.47677747426079
806   -2410 1.47675773033081
807   -2412 1.47671176533526
808   -2414 1.47665898774225
809   -2416 1.47662888566870
810   -2418 1.47661609885311
811   -2420 1.47661804906686
812   -2422 1.47663361079607
813   -2424 1.47665615258179
814   -2426 1.47667989702189
815   -2428 1.47670167875450
816   -2430 1.47671889251986
817   -2432 1.47672660033007
818   -2434 1.47672581905542
819   -2436 1.47673588691547
820   -2438 1.47675625346807
821   -2440 1.47677811479011
822   -2442 1.47680201299431
823   -2444 1.47682690323960
824   -2446 1.47685134280847
825   -2448 1.47687468838441
826   -2450 1.47689577948214
827   -2452 1.47691461221252
828   -2454 1.47693121483650
829   -2456 1.47694483659804
830   -2458 1.47695706614166
831   -2460 1.47696841245298
832   -2462 1.47698092980728
833   -2464 1.47699165258073
834   -2466 1.47699892231642
835   -2468 1.47700518850467
836   -2470 1.47701681917772
837   -2472 1.47703371133993
838   -2474 1.47705172804537
839   -2476 1.47706963205611
840   -2478 1.47708839046513
841   -2480 1.47710595182822
842   -2482 1.47712353018048
843   -2484 1.47714045399508
844   -2486 1.47715526898974
845   -2488 1.47716785931325
846   -2490 1.47717746351979
847   -2492 1.47718774105152
848   -2494 1.47720108087222
849   -2496 1.47721116876733
850   -2498 1.47720908793559
851   -2500 1.47721975153658
852   -2502 1.47724153102797
853   -2504 1.47726842063502
854   -2506 1.47729164115863
855   -2508 1.47729793164711
856   -2510 1.47728751673010
857   -2512 1.47728595976167
858   -2514 1.47730346177822
859   -2516 1.47732866245654
860   -2518 1.47735480680865
861   -2520 1.47737778321487
862   -2522 1.47739640465051
863   -2524 1.47741388745850
864   -2526 1.47743674344455
865   -2528 1.47746686662636
866   -2530 1.47749859543051
867   -2532 1.47752798101785
868   -2534 1.47755196992726
869   -2536 1.47757059463727
870   -2538 1.47758008928483
871   -2540 1.47756988987874
872   -2542 1.47755427512999
873   -2544 1.47756361259663
874   -2546 1.47758639316885
875   -2548 1.47760210701986
876   -2550 1.47761136589934
877   -2552 1.47762359682751
878   -2554 1.47764677677048
879   -2556 1.47767474710701
880   -2558 1.47770246497527
881   -2560 1.47773042785198
882   -2562 1.47776361629940
883   -2564 1.47779998470837
884   -2566 1.47783821733131
885   -2568 1.47787806111451
886   -2570 1.47792064098960
887   -2572 1.47796488547863
888   -2574 1.47800956216730
889   -2576 1.47805314833494
890   -2578 1.47809883475004
891   -2580 1.47814186001493
892   -2582 1.47815997256423
893   -2584 1.47809360441189
894   -2586 1.47790866325303
895   -2588 1.47773400000000
896   -2590 1.47767480433235
897   -2592 1.47770364229106
898   -2594 1.47776662663767
899   -2596 1.47783459041379
900   -2598 1.47789713249225
901   -2600 1.47795076443856
902   -2602 1.47798212010995
903   -2604 1.47796839500240
904   -2606 1.47793022585363
905   -2608 1.47793384355028
906   -2610 1.47794564701586
907   -2612 1.47795047312967
908   -2614 1.47797539539217
909   -2616 1.47801274460181
910   -2618 1.47805108460942
911   -2620 1.47808604011951
912   -2622 1.47811663248782
913   -2624 1.47814577420760
914   -2626 1.47817100891022
915   -2628 1.47819185746701
916   -2630 1.47820200756835
917   -2632 1.47819509341812
918   -2634 1.47818069648523
919   -2636 1.47819937787229
920   -2638 1.47823535219485
921   -2640 1.47827081637876
922   -2642 1.47830404351228
923   -2644 1.47832995386373
924   -2646 1.47835243329009
925   -2648 1.47837673632241
926   -2650 1.47840422324866
927   -2652 1.47843503880664
928   -2654 1.47846525754672
929   -2656 1.47849229804531
930   -2658 1.47851619218461
931   -2660 1.47854228554823
932   -2662 1.47857183053155
933   -2664 1.47860675830984
934   -2666 1.47864502580642
935   -2668 1.47868442524625
936   -2670 1.47871645234617
937   -2672 1.47872844710197
938   -2674 1.47874644966096
939   -2676 1.47878367512841
940   -2678 1.47882577091271
941   -2680 1.47886734102623
942   -2682 1.47890576030499
943   -2684 1.47894410487476
944   -2686 1.47898246676081
945   -2688 1.47902078634990
946   -2690 1.47905697663379
947   -2692 1.47909348635787
948   -2694 1.47913253241860
949   -2696 1.47917713682535
950   -2698 1.47922494363690
951   -2700 1.47927370219512
952   -2702 1.47932350132184
953   -2704 1.47937477829841
954   -2706 1.47942977955203
955   -2708 1.47948662996503
956   -2710 1.47954572465315
957   -2712 1.47960899951982
958   -2714 1.47967582145469
959   -2716 1.47974783424700
960   -2718 1.47982686383801
961   -2720 1.47991434869689
962   -2722 1.48001161889876
963   -2724 1.48011529035864
964   -2726 1.48021743640732
965   -2728 1.48029271013490
966   -2730 1.48028469924544
967   -2732 1.48009333694647
968   -2734 1.47968604519118
969   -2736 1.47926069770098
970   -2738 1.47904382199068
971   -2740 1.47903137276969
972   -2742 1.47912234371550
973   -2744 1.47924475242006
974   -2746 1.47936896123536
975   -2748 1.47948547683776
976   -2750 1.47959346670195
977   -2752 1.47969391424782
978   -2754 1.47978696270901
979   -2756 1.47987478298896
980   -2758 1.47995758449142
981   -2760 1.48003727324589
982   -2762 1.48011924219933
983   -2764 1.48019913384442
984   -2766 1.48027922637338
985   -2768 1.48035769798330
986   -2770 1.48043385800477
987   -2772 1.48050725415469
988   -2774 1.48057567058368
989   -2776 1.48065105935983
990   -2778 1.48072266299449
991   -2780 1.48079977415031
992   -2782 1.48088053164822
993   -2784 1.48096687278145
994   -2786 1.48105512159158
995   -2788 1.48114937559786
996   -2790 1.48124466747644
997   -2792 1.48134118881539
998   -2794 1.48144014454067
999   -2796 1.48153308521599
1000   -2798 1.48162875830237
1001   -2800 1.48173023207917
1002   -2802 1.48183567152155
1003   -2804 1.48193764434860
1004   -2806 1.48203772197889
1005   -2808 1.48213332822876
1006   -2810 1.48221893030834
1007   -2812 1.48230128068059
1008   -2814 1.48241543210576
1009   -2816 1.48256188329700
1010   -2818 1.48272146386266
1011   -2820 1.48288593713105
1012   -2822 1.48303146156846
1013   -2824 1.48316535466125
1014   -2826 1.48333287967432
1015   -2828 1.48353886468435
1016   -2830 1.48376233940652
1017   -2832 1.48399372362724
1018   -2834 1.48422859660869
1019   -2836 1.48446914811588
1020   -2838 1.48472335986644
1021   -2840 1.48498891752954
1022   -2842 1.48526978967144
1023   -2844 1.48556244410920
1024   -2846 1.48585030113417
1025   -2848 1.48611635747129
1026   -2850 1.48631703683473
1027   -2852 1.48642616794096
1028   -2854 1.48638931900690
1029   -2856 1.48617288132870
1030   -2858 1.48578055258264
1031   -2860 1.48528254616381
1032   -2862 1.48477473720320
1033   -2864 1.48431306898547
1034   -2866 1.48390294869478
1035   -2868 1.48352758708888
1036   -2870 1.48315923324289
1037   -2872 1.48276317318322
1038   -2874 1.48233036174381
1039   -2876 1.48190033197863
1040   -2878 1.48156989857095
1041   -2880 1.48135829837939
1042   -2882 1.48127046426508
1043   -2884 1.48129224687463
1044   -2886 1.48142276034719
1045   -2888 1.48166152381514
1046   -2890 1.48199469355260
1047   -2892 1.48241286263108
1048   -2894 1.48290615618025
1049   -2896 1.48346174779728
1050   -2898 1.48406068695481
1051   -2900 1.48469749104873
1052   -2902 1.48534901849277
1053   -2904 1.48600451268347
1054   -2906 1.48663330502903
1055   -2908 1.48716049340272
1056   -2910 1.48749427432860
1057   -2912 1.48745634999468
1058   -2914 1.48687918789111
1059   -2916 1.48564647709805
1060   -2918 1.48378138421067
1061   -2920 1.48160842259702
1062   -2922 1.47963902212310
1063   -2924 1.47817563267450
1064   -2926 1.47725366173650
1065   -2928 1.47680009878321
1066   -2930 1.47670600337876
1067   -2932 1.47683592850229
1068   -2934 1.47707848906770
1069   -2936 1.47736368012666
1070   -2938 1.47761998820843
1071   -2940 1.47780991969196
1072   -2942 1.47790616610153
1073   -2944 1.47789352215007
1074   -2946 1.47776642994662
1075   -2948 1.47755303644224
1076   -2950 1.47732098571495
1077   -2952 1.47710982305520
1078   -2954 1.47692656410946
1079   -2956 1.47677865708199
1080   -2958 1.47664389769752
1081   -2960 1.47653950030308
1082   -2962 1.47652380859929
1083   -2964 1.47671143784641
1084   -2966 1.47706590558488
1085   -2968 1.47742684312635
1086   -2970 1.47770009243870
1087   -2972 1.47786247321149
1088   -2974 1.47794741384886
1089   -2976 1.47797899370123
1090   -2978 1.47798223648454
1091   -2980 1.47795004028588
1092   -2982 1.47790147416153
1093   -2984 1.47795735389707
1094   -2986 1.47814496927765
1095   -2988 1.47844692443850
1096   -2990 1.47884918651108
1097   -2992 1.47932344250011
1098   -2994 1.47986306802417
1099   -2996 1.48043188046815
1100   -2998 1.48097537656156
1101   -3000 1.48138517100778
1102   -3002 1.48162356419426
1103   -3004 1.48185212024737
1104   -3006 1.48228440440630
1105   -3008 1.48297178567222
1106   -3010 1.48385673952528
1107   -3012 1.48487993544870
1108   -3014 1.48595665242293
1109   -3016 1.48695938009756
1110   -3018 1.48767468298278
1111   -3020 1.48765524108674
1112   -3022 1.48618132554454
1113   -3024 1.48268461964750
1114   -3026 1.47762082421352
1115   -3028 1.47232727506644
1116   -3030 1.46776463943145
1117   -3032 1.46440878935946
1118   -3034 1.46247197560802
1119   -3036 1.46196769309556
1120   -3038 1.46253947223186
1121   -3040 1.46367382189299
1122   -3042 1.46491417717244
1123   -3044 1.46601563099238
1124   -3046 1.46697686500990
1125   -3048 1.46781464802766
1126   -3050 1.46847402904648
1127   -3052 1.46887853308036
1128   -3054 1.46895675121188
1129   -3056 1.46875323941201
1130   -3058 1.46834302704055
1131   -3060 1.46771282666113
1132   -3062 1.46675300487368
1133   -3064 1.46553703632205
1134   -3066 1.46435734374414
1135   -3068 1.46364333274111
1136   -3070 1.46361967631567
1137   -3072 1.46416270683630
1138   -3074 1.46500589551713
1139   -3076 1.46593266001109
1140   -3078 1.46681497080407
1141   -3080 1.46754108115619
1142   -3082 1.46785690887919
1143   -3084 1.46726760945338
1144   -3086 1.46533247163430
1145   -3088 1.46268292062625
1146   -3090 1.46120303549580
1147   -3092 1.46134478479294
1148   -3094 1.46221369798373
1149   -3096 1.46321247938499
1150   -3098 1.46411661764251
1151   -3100 1.46482369285261
1152   -3102 1.46525636685728
1153   -3104 1.46533581524600
1154   -3106 1.46519098442260
1155   -3108 1.46516907412280
1156   -3110 1.46538060689336
1157   -3112 1.46568276755924
1158   -3114 1.46596931336371
1159   -3116 1.46619739482536
1160   -3118 1.46639101964608
1161   -3120 1.46661054944789
1162   -3122 1.46687049156442
1163   -3124 1.46713909721892
1164   -3126 1.46740251735782
1165   -3128 1.46765965900548
1166   -3130 1.46790595336806
1167   -3132 1.46813448944673
1168   -3134 1.46834723054744
1169   -3136 1.46854553575727
1170   -3138 1.46872578997706
1171   -3140 1.46889606787041
1172   -3142 1.46905361684206
1173   -3144 1.46920788445114
1174   -3146 1.46935155893370
1175   -3148 1.46948926642375
1176   -3150 1.46961711994727
1177   -3152 1.46973932284344
1178   -3154 1.46985771524525
1179   -3156 1.46997084147302
1180   -3158 1.47008125375275
1181   -3160 1.47018834504960
1182   -3162 1.47028749194193
1183   -3164 1.47037561555632
1184   -3166 1.47044733671974
1185   -3168 1.47049523638823
1186   -3170 1.47053287904761
1187   -3172 1.47059397007388
1188   -3174 1.47068028883230
1189   -3176 1.47077100092966
1190   -3178 1.47085834352883
1191   -3180 1.47094237966502
1192   -3182 1.47102127140257
1193   -3184 1.47109691171596
1194   -3186 1.47116815404231
1195   -3188 1.47123618567128
1196   -3190 1.47130184743484
1197   -3192 1.47136511381017
1198   -3194 1.47142734846007
1199   -3196 1.47148851688128
1200   -3198 1.47154755038698
1201   -3200 1.47160533014890
1202   -3202 1.47166012795457
1203   -3204 1.47171224992608
1204   -3206 1.47176315489772
1205   -3208 1.47181395071669
1206   -3210 1.47186466789480
1207   -3212 1.47191661577937
1208   -3214 1.47196738520913
1209   -3216 1.47201707857991
1210   -3218 1.47206588870145
1211   -3220 1.47211365240659
1212   -3222 1.47215936522226
1213   -3224 1.47220500735251
1214   -3226 1.47225033231421
1215   -3228 1.47229424065224
1216   -3230 1.47233733691715
1217   -3232 1.47237980638024
1218   -3234 1.47242122252104
1219   -3236 1.47246173766460
1220   -3238 1.47250090500984
1221   -3240 1.47253933121953
1222   -3242 1.47257666559418
1223   -3244 1.47261289353408
1224   -3246 1.47264942225475
1225   -3248 1.47268468000033
1226   -3250 1.47271896562139
1227   -3252 1.47275329822459
1228   -3254 1.47278723826016
1229   -3256 1.47281957643892
1230   -3258 1.47285086138010
1231   -3260 1.47288192451579
1232   -3262 1.47291300000000
1233   -3264 1.47294399234620
1234   -3266 1.47297519999867
1235   -3268 1.47300456597122
1236   -3270 1.47303306949960
1237   -3272 1.47306229798834
1238   -3274 1.47309029819990
1239   -3276 1.47311725100397
1240   -3278 1.47314519229524
1241   -3280 1.47317191831342
1242   -3282 1.47319904835607
1243   -3284 1.47322480511295
1244   -3286 1.47325068033533
1245   -3288 1.47327558727819
1246   -3290 1.47330149637565
1247   -3292 1.47332523279087
1248   -3294 1.47335025198767
1249   -3296 1.47337510971327
1250   -3298 1.47339905996618
1251   -3300 1.47342296954304
1252   -3302 1.47344582202335
1253   -3304 1.47346658074592
1254   -3306 1.47348738493031
1255   -3308 1.47350703202034
1256   -3310 1.47352683574489
1257   -3312 1.47354755048152
1258   -3314 1.47356829450234
1259   -3316 1.47358903215508
1260   -3318 1.47360880465673
1261   -3320 1.47362855417648
1262   -3322 1.47364734936801
1263   -3324 1.47366547803442
1264   -3326 1.47368305009043
1265   -3328 1.47369959979993
1266   -3330 1.47371718446385
1267   -3332 1.47373378124277
1268   -3334 1.47375068696817
1269   -3336 1.47376844875514
1270   -3338 1.47378666053286
1271   -3340 1.47380404591194
1272   -3342 1.47382276516742
1273   -3344 1.47384040963255
1274   -3346 1.47385904663877
1275   -3348 1.47387858239480
1276   -3350 1.47389752320424
1277   -3352 1.47391752328576
1278   -3354 1.47393606713734
1279   -3356 1.47395488874822
1280   -3358 1.47397353990369
1281   -3360 1.47399234620080
1282   -3362 1.47401055721405
1283   -3364 1.47402826981442
1284   -3366 1.47404508175359
1285   -3368 1.47406141829832
1286   -3370 1.47407704342040
1287   -3372 1.47409059132764
1288   -3374 1.47410503032631
1289   -3376 1.47411782704824
1290   -3378 1.47413081528590
1291   -3380 1.47414326557675
1292   -3382 1.47415571156753
1293   -3384 1.47416717298263
1294   -3386 1.47417841575972
1295   -3388 1.47418915024028
1296   -3390 1.47419998707473
1297   -3392 1.47421190062571
1298   -3394 1.47422443429139
1299   -3396 1.47423683452363
1300   -3398 1.47425033505022
1301   -3400 1.47426480528893
1302   -3402 1.47427826680738
1303   -3404 1.47429170418534
1304   -3406 1.47430477066294
1305   -3408 1.47431835512023
1306   -3410 1.47433193595530
1307   -3412 1.47434642118416
1308   -3414 1.47436087920127
1309   -3416 1.47437532634686
1310   -3418 1.47439018109776
1311   -3420 1.47440515622779
1312   -3422 1.47442044328205
1313   -3424 1.47443606103306
1314   -3426 1.47444964436527
1315   -3428 1.47446294847254
1316   -3430 1.47447439134230
1317   -3432 1.47448416869267
1318   -3434 1.47449072019392
1319   -3436 1.47449591374259
1320   -3438 1.47449903792179
1321   -3440 1.47449993449953
1322   -3442 1.47450135456237
1323   -3444 1.47450458795612
1324   -3446 1.47450875108451
1325   -3448 1.47451445884208
1326   -3450 1.47452484258401
1327   -3452 1.47453827241797
1328   -3454 1.47455172262247
1329   -3456 1.47456517206426
1330   -3458 1.47457860151852
1331   -3460 1.47459192059468
1332   -3462 1.47460450298261
1333   -3464 1.47461696547474
1334   -3466 1.47462839859281
1335   -3468 1.47463987388367
1336   -3470 1.47465188200346
1337   -3472 1.47466266389847
1338   -3474 1.47467409691578
1339   -3476 1.47468473670609
1340   -3478 1.47469608306209
1341   -3480 1.47470752002888
1342   -3482 1.47471885889080
1343   -3484 1.47473141107054
1344   -3486 1.47474321664113
1345   -3488 1.47475540477105
1346   -3490 1.47476577603289
1347   -3492 1.47477517654069
1348   -3494 1.47478437686762
1349   -3496 1.47479375265910
1350   -3498 1.47480352784050
1351   -3500 1.47481386454326
1352   -3502 1.47482540254891
1353   -3504 1.47483686546170
1354   -3506 1.47484922964243
1355   -3508 1.47486054239155
1356   -3510 1.47487118057395
1357   -3512 1.47488161773392
1358   -3514 1.47489155648764
1359   -3516 1.47489779215940
1360   -3518 1.47490199751604
1361   -3520 1.47490515212000
1362   -3522 1.47490858576642
1363   -3524 1.47491589352572
1364   -3526 1.47492563809847
1365   -3528 1.47493721829251
1366   -3530 1.47494965183138
1367   -3532 1.47496209482301
1368   -3534 1.47497548127118
1369   -3536 1.47498901026331
1370   -3538 1.47500250064110
1371   -3540 1.47501334375007
1372   -3542 1.47502155988466
1373   -3544 1.47502590855583
1374   -3546 1.47502798788122
1375   -3548 1.47502908741446
1376   -3550 1.47503013111600
1377   -3552 1.47503152066431
1378   -3554 1.47503369017078
1379   -3556 1.47503596161309
1380   -3558 1.47503994401260
1381   -3560 1.47504720780187
1382   -3562 1.47505757685400
1383   -3564 1.47506921753979
1384   -3566 1.47508222835820
1385   -3568 1.47509583612677
1386   -3570 1.47510943592653
1387   -3572 1.47512299244722
1388   -3574 1.47513544229862
1389   -3576 1.47514788646150
1390   -3578 1.47515877336465
1391   -3580 1.47516830010454
1392   -3582 1.47517301097796
1393   -3584 1.47516730096467
1394   -3586 1.47516098788624
1395   -3588 1.47515999912529
1396   -3590 1.47516344979552
1397   -3592 1.47516995891151
1398   -3594 1.47517893497533
1399   -3596 1.47518949533554
1400   -3598 1.47519986950803
1401   -3600 1.47520815315630
1402   -3602 1.47521639684906
1403   -3604 1.47522677803691
1404   -3606 1.47523756307109
1405   -3608 1.47524905817071
1406   -3610 1.47526235394740
1407   -3612 1.47527689090454
1408   -3614 1.47529241512157
1409   -3616 1.47530577596310
1410   -3618 1.47531550675526
1411   -3620 1.47531807217956
1412   -3622 1.47531330897623
1413   -3624 1.47530520668685
1414   -3626 1.47530099713781
1415   -3628 1.47530419555884
1416   -3630 1.47531292297539
1417   -3632 1.47532682994681
1418   -3634 1.47534230166646
1419   -3636 1.47535817866622
1420   -3638 1.47537270802382
1421   -3640 1.47538306617453
1422   -3642 1.47538491013479
1423   -3644 1.47537808441815
1424   -3646 1.47536152773521
1425   -3648 1.47533829820411
1426   -3650 1.47531127187157
1427   -3652 1.47528831452931
1428   -3654 1.47527173292062
1429   -3656 1.47526400688559
1430   -3658 1.47526538002071
1431   -3660 1.47527196497124
1432   -3662 1.47528332467912
1433   -3664 1.47529547167214
1434   -3666 1.47530792033597
1435   -3668 1.47531940264238
1436   -3670 1.47532950934428
1437   -3672 1.47533752543273
1438   -3674 1.47534264633859
1439   -3676 1.47534493660391
1440   -3678 1.47534793834948
1441   -3680 1.47535101048592
1442   -3682 1.47535512741537
1443   -3684 1.47536061029192
1444   -3686 1.47536677517540
1445   -3688 1.47537422152313
1446   -3690 1.47538349069671
1447   -3692 1.47539466802181
1448   -3694 1.47540614815786
1449   -3696 1.47541766757740
1450   -3698 1.47543103564364
1451   -3700 1.47544309274752
1452   -3702 1.47545168948545
1453   -3704 1.47545396563826
1454   -3706 1.47545207507319
1455   -3708 1.47544797484465
1456   -3710 1.47544704753668
1457   -3712 1.47545189667326
1458   -3714 1.47545995926878
1459   -3716 1.47547095072698
1460   -3718 1.47548066602429
1461   -3720 1.47548697893292
1462   -3722 1.47548796009613
1463   -3724 1.47548478177503
1464   -3726 1.47547947641639
1465   -3728 1.47547863259801
1466   -3730 1.47548174475524
1467   -3732 1.47548778078125
1468   -3734 1.47549403635331
1469   -3736 1.47550125363908
1470   -3738 1.47550934180435
1471   -3740 1.47551683167599
1472   -3742 1.47552688594006
1473   -3744 1.47553729090548
1474   -3746 1.47554678198008
1475   -3748 1.47555713325216
1476   -3750 1.47556659302775
1477   -3752 1.47557669459374
1478   -3754 1.47558647315562
1479   -3756 1.47559529768016
1480   -3758 1.47560360009648
1481   -3760 1.47561091508282
1482   -3762 1.47561609735508
1483   -3764 1.47562029070796
1484   -3766 1.47562441780911
1485   -3768 1.47563306550754
1486   -3770 1.47564405166112
1487   -3772 1.47565552291783
1488   -3774 1.47566694809298
1489   -3776 1.47567830857219
1490   -3778 1.47568755133462
1491   -3780 1.47569463620025
1492   -3782 1.47569547492168
1493   -3784 1.47568951387041
1494   -3786 1.47567835935080
1495   -3788 1.47566593929693
1496   -3790 1.47566101977927
1497   -3792 1.47566354952827
1498   -3794 1.47567185732029
1499   -3796 1.47568321348889
1500   -3798 1.47569529254648
1501   -3800 1.47570772530959
1502   -3802 1.47571809962768
1503   -3804 1.47572648401529
1504   -3806 1.47573134192597
1505   -3808 1.47573352027040
1506   -3810 1.47573292361008
1507   -3812 1.47573299326894
1508   -3814 1.47573398673360
1509   -3816 1.47573817632205
1510   -3818 1.47574527524272
1511   -3820 1.47575277086820
1512   -3822 1.47575967350287
1513   -3824 1.47576470303911
1514   -3826 1.47576975528735
1515   -3828 1.47577698612879
1516   -3830 1.47578309783396
1517   -3832 1.47578829704916
1518   -3834 1.47579095824278
1519   -3836 1.47578839924332
1520   -3838 1.47578153880935
1521   -3840 1.47577325828602
1522   -3842 1.47576695658169
1523   -3844 1.47576181472562
1524   -3846 1.47575638975092
1525   -3848 1.47574893511221
1526   -3850 1.47574067656252
1527   -3852 1.47573418960490
1528   -3854 1.47573201348304
1529   -3856 1.47573609448654
1530   -3858 1.47574340076582
1531   -3860 1.47575406506568
1532   -3862 1.47576509594980
1533   -3864 1.47577344240290
1534   -3866 1.47577782298125
1535   -3868 1.47577704417063
1536   -3870 1.47576978782061
1537   -3872 1.47576167888626
1538   -3874 1.47575983530599
1539   -3876 1.47576615931522
1540   -3878 1.47577603616264
1541   -3880 1.47578749602566
1542   -3882 1.47579899049744
1543   -3884 1.47580829754193
1544   -3886 1.47581553191111
1545   -3888 1.47582044576450
1546   -3890 1.47582361486597
1547   -3892 1.47582488670530
1548   -3894 1.47582691190401
1549   -3896 1.47582798767520
1550   -3898 1.47583005776107
1551   -3900 1.47583333559154
1552   -3902 1.47583798052018
1553   -3904 1.47584349792097
1554   -3906 1.47584878503057
1555   -3908 1.47585104104660
1556   -3910 1.47584786442429
1557   -3912 1.47584503864650
1558   -3914 1.47584772763597
1559   -3916 1.47585513011730
1560   -3918 1.47586161194681
1561   -3920 1.47586680114244
1562   -3922 1.47586801742881
1563   -3924 1.47586285228063
1564   -3926 1.47585768990955
1565   -3928 1.47585725672200
1566   -3930 1.47586502926929
1567   -3932 1.47587638834149
1568   -3934 1.47588758559686
1569   -3936 1.47589600406114
1570   -3938 1.47590331354213
1571   -3940 1.47591060804636
1572   -3942 1.47591789591720
1573   -3944 1.47592457142526
1574   -3946 1.47593081059303
1575   -3948 1.47593398581283
1576   -3950 1.47593295565452
1577   -3952 1.47592878275285
1578   -3954 1.47592684349640
1579   -3956 1.47592986168501
1580   -3958 1.47593628896516
1581   -3960 1.47594351825970
1582   -3962 1.47595186222678
1583   -3964 1.47595911320580
1584   -3966 1.47596854991323
1585   -3968 1.47597712871599
1586   -3970 1.47598746992252
1587   -3972 1.47600004422535
1588   -3974 1.47601337421929
1589   -3976 1.47602692154134
1590   -3978 1.47603405627977
1591   -3980 1.47602817354059
1592   -3982 1.47601874488156
1593   -3984 1.47602563707167
1594   -3986 1.47604367443527
1595   -3988 1.47606327560645
1596   -3990 1.47608304122308
1597   -3992 1.47610269526207
1598   -3994 1.47612262206064
1599   -3996 1.47614078459134
1600   -3998 1.47615752083133
1601   -4000 1.47617133599432
1602 0 \ No newline at end of file
globals.h
1   -#ifndef GLOBALS_H
2   -#define GLOBALS_H
3   -
4   -#include <vector>
5   -#include <string>
6   -#include <iostream>
7   -#include "PerformanceData.h"
8   -#include <complex>
9   -using namespace std;
10   -
11   -typedef float rtsFloat;
12   -
13   -struct SpecPair{
14   - double nu;
15   - double A;
16   -};
17   -
18   -struct Material{
19   - vector<double> nu;
20   - vector<complex<double> > eta;
21   - string name;
22   -};
23   -
24   -enum SpecType {AbsorbanceSpecType, IntensitySpecType};
25   -enum OpticsType {TransmissionOpticsType, ReflectionOpticsType};
26   -
27   -extern PerformanceData PD;
28   -
29   -
30   -extern vector<vector<SpecPair> > RefSpectrum;
31   -extern int currentSpec;
32   -extern vector<SpecPair> SimSpectrum;
33   -
34   -//IO Functions
35   -vector<SpecPair> LoadSpectrum(string filename);
36   -vector<SpecPair> SetReferenceSpectrum(char* text);
37   -void SaveState();
38   -void LoadState();
39   -void SetDefaults();
40   -void SaveSimulation(string fileName);
41   -void SaveK(string fileName);
42   -void SaveN(string fileName);
43   -void LoadMaterial(string fileNameK, string fileNameN, string materialName);
44   -void LoadMaterial(string fileNameK, string materialName);
45   -
46   -//Display Functions
47   -void FitDisplay();
48   -
49   -//Update Functions
50   -void UpdateDisplay();
51   -void SimulateSpectrum();
52   -void cudaKramersKronig(double* cpuN, double* cpuK, int nVals, double nuStart, double nuEnd, double nOffset);
53   -void cudaComputeSpectrum(double* cpuI, double* cpuB, double* alpha,
54   - int Nl, int nLambda, double oThetaI, double oThetaO, double cThetaI, double cThetaO, int nSamples);
55   -
56   -//Window Parameters
57   -extern double nuMin;
58   -extern double nuMax;
59   -extern double aMin;
60   -extern double aMax;
61   -extern double dNu;
62   -extern bool dispRefSpec;
63   -extern bool dispSimSpec;
64   -extern bool dispSimK;
65   -extern bool dispMatK;
66   -extern bool dispSimN;
67   -extern bool dispMatN;
68   -extern SpecType dispSimType;
69   -extern bool dispNormalize;
70   -extern double dispNormFactor;
71   -
72   -
73   -extern double dispScaleK;
74   -extern double dispScaleN;
75   -
76   -//material parameters
77   -extern double radius;
78   -extern double baseIR;
79   -extern double cA;
80   -extern vector<SpecPair> EtaK;
81   -extern vector<SpecPair> EtaN;
82   -extern bool applyMaterial;
83   -extern vector<Material> MaterialList;
84   -extern int currentMaterial;
85   -void ChangeAbsorbance();
86   -void SetMaterial();
87   -
88   -//source parameters
89   -extern vector<SpecPair> SourceSpectrum;
90   -extern vector<SpecPair> SourceResampled;
91   -void ResampleSource(); //resample a source profile to match the sample points of the current material
92   -extern bool useSourceSpectrum;
93   -
94   -//optical parameters
95   -extern double cNAi;
96   -extern double cNAo;
97   -extern double oNAi;
98   -extern double oNAo;
99   -extern OpticsType opticsMode;
100   -extern bool pointDetector;
101   -extern int objectiveSamples;
102   -
103   -//fitting parameters
104   -extern double minMSE;
105   -extern int maxFitIter;
106   -void EstimateMaterial();
107   -extern double scaleI0;
108   -extern double refSlope;
109   -
110   -
111   -//distortion maps
112   -double ComputeDistortion();
113   -void DistortionMap(float* distortionMap, int nSteps);
114   -
115   -
116   -
117   -
118   -#endif
  1 +#ifndef GLOBALS_H
  2 +#define GLOBALS_H
  3 +
  4 +#include <vector>
  5 +#include <string>
  6 +#include <iostream>
  7 +#include "PerformanceData.h"
  8 +#include <complex>
  9 +using namespace std;
  10 +
  11 +typedef float rtsFloat;
  12 +
  13 +struct SpecPair {
  14 + double nu;
  15 + double A;
  16 +};
  17 +
  18 +struct Material {
  19 + vector<double> nu;
  20 + vector<complex<double> > eta;
  21 + bool validN;
  22 + bool validK;
  23 + string name;
  24 +};
  25 +
  26 +enum SpecType {AbsorbanceSpecType, IntensitySpecType};
  27 +enum OpticsType {TransmissionOpticsType, ReflectionOpticsType};
  28 +
  29 +extern PerformanceData PD;
  30 +
  31 +
  32 +extern vector<vector<SpecPair> > RefSpectrum;
  33 +extern int currentSpec;
  34 +extern vector<SpecPair> SimSpectrum;
  35 +
  36 +//IO Functions
  37 +vector<SpecPair> LoadSpectrum(string filename);
  38 +vector<SpecPair> SetReferenceSpectrum(char* text);
  39 +void SaveState();
  40 +void LoadState();
  41 +void SetDefaults();
  42 +void SaveSimulation(string fileName);
  43 +//void SaveK(string fileName);
  44 +void SaveMaterial(string fileName);
  45 +//void LoadMaterial(string fileNameK, string fileNameN, string materialName);
  46 +void LoadMaterial(string fileName, string materialName);
  47 +
  48 +//Display Functions
  49 +void FitDisplay();
  50 +
  51 +//Update Functions
  52 +void UpdateDisplay();
  53 +void SimulateSpectrum();
  54 +void cudaKramersKronig(double* cpuN, double* cpuK, int nVals, double nuStart, double nuEnd, double nOffset);
  55 +void cudaComputeSpectrum(double* cpuI, double* cpuB, double* alpha,
  56 + int Nl, int nLambda, double oThetaI, double oThetaO, double cThetaI, double cThetaO, int nSamples);
  57 +
  58 +//Window Parameters
  59 +extern double nuMin; //wavenumbers
  60 +extern double nuMax;
  61 +extern double aMin; //absorbance
  62 +extern double aMax;
  63 +extern double dNu;
  64 +extern double nMag; //largest magnitude for n
  65 +extern double kMax; //highest extinction coefficient
  66 +extern bool dispRefSpec;
  67 +extern bool dispSimSpec;
  68 +extern bool dispSimK;
  69 +extern bool dispMatK;
  70 +extern bool dispSimN;
  71 +extern bool dispMatN;
  72 +extern SpecType dispSimType;
  73 +extern bool dispNormalize;
  74 +extern double dispNormFactor;
  75 +
  76 +
  77 +extern double dispScaleK;
  78 +extern double dispScaleN;
  79 +
  80 +//material parameters
  81 +extern double radius;
  82 +extern double baseIR;
  83 +extern double cA;
  84 +extern vector<SpecPair> EtaK;
  85 +extern vector<SpecPair> EtaN;
  86 +extern bool applyMaterial;
  87 +extern vector<Material> MaterialList;
  88 +extern int currentMaterial;
  89 +void ChangeAbsorbance();
  90 +void SetMaterial();
  91 +
  92 +//source parameters
  93 +extern vector<SpecPair> SourceSpectrum;
  94 +extern vector<SpecPair> SourceResampled;
  95 +void ResampleSource(); //resample a source profile to match the sample points of the current material
  96 +extern bool useSourceSpectrum;
  97 +
  98 +//optical parameters
  99 +extern double cNAi;
  100 +extern double cNAo;
  101 +extern double oNAi;
  102 +extern double oNAo;
  103 +extern OpticsType opticsMode;
  104 +extern bool pointDetector;
  105 +extern int objectiveSamples;
  106 +
  107 +//fitting parameters
  108 +extern double minMSE;
  109 +extern int maxFitIter;
  110 +void EstimateMaterial();
  111 +extern double scaleI0;
  112 +extern double refSlope;
  113 +
  114 +
  115 +//distortion maps
  116 +double ComputeDistortion();
  117 +void DistortionMap(float* distortionMap, int nSteps);
  118 +
  119 +
  120 +
  121 +
  122 +#endif
... ...
interactivemie.cpp
1   -#include "interactivemie.h"
2   -#include <stdlib.h>
  1 +#include "interactivemie.h"
  2 +#include <stdlib.h>
3 3  
4 4 qtDistortionDialog* distortionDialog;
5   -
6   -InteractiveMie::InteractiveMie(QWidget *parent, Qt::WFlags flags)
7   - : QMainWindow(parent, flags)
8   -{
9   - ui.setupUi(this);
10   -}
11   -
12   -InteractiveMie::~InteractiveMie()
13   -{
14   - updating = false;
  5 +
  6 +InteractiveMie::InteractiveMie(QWidget *parent, Qt::WFlags flags)
  7 + : QMainWindow(parent, flags)
  8 +{
  9 + ui.setupUi(this);
  10 +}
  11 +
  12 +InteractiveMie::~InteractiveMie()
  13 +{
  14 + updating = false;
15 15 }
16 16  
17 17 void InteractiveMie::closeEvent(QCloseEvent *event)
18 18 {
19   - cout<<"Exiting"<<endl;
  19 + cout<<"Exiting"<<endl;
20 20 exit(0);
21 21  
22   -}
  22 +}
... ...
interactivemie.h
1   -#ifndef INTERACTIVEMIE_H
2   -#define INTERACTIVEMIE_H
3   -
4   -#include <QtGui/QMainWindow>
5   -#include <QDragEnterEvent>
6   -#include <qfiledialog.h>
7   -#include <qinputdialog.h>
8   -#include "ui_interactivemie.h"
9   -#include "qtDistortionDialog.h"
10   -#include "globals.h"
11   -
12   -extern qtDistortionDialog* distortionDialog;
13   -
14   -class InteractiveMie : public QMainWindow
15   -{
16   - Q_OBJECT
17   -
18   -public:
19   - InteractiveMie(QWidget *parent = 0, Qt::WFlags flags = 0);
20   - ~InteractiveMie();
21   - void closeEvent(QCloseEvent *event);
22   - bool updating;
23   -
24   - void refreshUI()
25   - {
26   - updating = true;
27   -
28   - ui.spinNuMin->setValue(nuMin);
29   - ui.spinNuMax->setValue(nuMax);
30   - ui.spinAMin->setValue(aMin);
31   - ui.spinAMax->setValue(aMax);
32   - ui.spinRadius->setValue(radius);
33   - ui.spinBaseIR->setValue(baseIR);
34   - ui.spinScaleK->setValue(cA);
35   - ui.spinObjNAi->setValue(oNAi);
36   - ui.spinObjNAo->setValue(oNAo);
37   - ui.spinCondNAi->setValue(cNAi);
38   - ui.spinCondNAo->setValue(cNAo);
39   - ui.spinError->setValue(minMSE);
40   - ui.spinMaxIter->setValue(maxFitIter);
41   - ui.spinI0Scale->setValue(scaleI0);
42   -
43   - //display spectra values
44   - ui.chkDisplaySimSpec->setChecked(dispSimSpec);
45   - ui.chkDisplayRefSpec->setChecked(dispRefSpec);
46   - ui.chkDisplaySimK->setChecked(dispSimK);
47   - ui.chkDisplayMatK->setChecked(dispMatK);
48   - ui.chkDisplaySimN->setChecked(dispSimN);
49   - ui.chkDisplayMatN->setChecked(dispMatN);
50   - ui.spinDispScaleK->setValue(dispScaleK);
51   - ui.spinDispScaleN->setValue(dispScaleN);
52   -
53   - //material selection combo box
54   - ui.cmbMaterial->clear();
55   - for(unsigned int i=0; i<MaterialList.size(); i++)
56   - ui.cmbMaterial->addItem(MaterialList[i].name.c_str(), i);
57   - ui.cmbMaterial->setCurrentIndex(currentMaterial);
58   -
59   - updating = false;
60   - }
61   -
62   - void dragEnterEvent(QDragEnterEvent *event)
63   - {
64   - cout<<"This is a test."<<endl;
65   - QStringList s = event->mimeData()->formats();
66   - if (event->mimeData()->hasFormat("application/x-qt-windows-mime;value=\"FileName\"") ||
67   - event->mimeData()->hasFormat("text/plain"))
68   - {
69   - event->acceptProposedAction();
70   -
71   - }
72   - }
73   -
74   - void dropEvent(QDropEvent *event)
75   - {
76   - //cout<<"Challenge Accepted."<<endl;
77   - RefSpectrum.clear();
78   - RefSpectrum.push_back(SetReferenceSpectrum(event->mimeData()->text().toAscii().data()));
79   - UpdateDisplay();
80   - }
81   -
82   -private:
83   - Ui::InteractiveMieClass ui;
84   -
85   -public slots:
86   - //display parameters
87   - void on_spinNuMin_valueChanged(int i){
88   - nuMin = (float)i;
89   - UpdateDisplay();
90   - }
91   - void on_spinNuMax_valueChanged(int i){
92   - nuMax = (float)i;
93   - UpdateDisplay();
94   - }
95   - void on_spinAMin_valueChanged(double d){
96   - aMin = d;
97   - UpdateDisplay();
98   - }
99   - void on_spinAMax_valueChanged(double d){
100   - aMax = d;
101   - UpdateDisplay();
102   - }
103   - void on_chkDisplaySimSpec_clicked(bool b){
104   - dispSimSpec = b;
105   - UpdateDisplay();
106   - }
107   - void on_chkDisplayRefSpec_clicked(bool b){
108   - dispRefSpec = b;
109   - UpdateDisplay();
110   - }
111   - void on_chkDisplaySimK_clicked(bool b){
112   - dispSimK = b;
113   - UpdateDisplay();
114   - }
115   - void on_chkDisplayMatK_clicked(bool b){
116   - dispMatK = b;
117   - UpdateDisplay();
118   - }
119   - void on_chkDisplaySimN_clicked(bool b){
120   - dispSimN = b;
121   - UpdateDisplay();
122   - }
123   - void on_chkDisplayMatN_clicked(bool b){
124   - dispMatN = b;
125   - UpdateDisplay();
126   - }
127   - void on_spinDispScaleK_valueChanged(double d){
128   - dispScaleK = d;
129   - UpdateDisplay();
130   - }
131   - void on_spinDispScaleN_valueChanged(double d){
132   - dispScaleN = d;
133   - UpdateDisplay();
134   - }
135   - void on_radDisplayAbsorbance_clicked(bool b){
136   - dispSimType = AbsorbanceSpecType;
137   - SimulateSpectrum();
138   - UpdateDisplay();
139   - }
140   - void on_radDisplayIntensity_toggled(bool b){
141   - dispSimType = IntensitySpecType;
142   - SimulateSpectrum();
143   - UpdateDisplay();
144   - }
145   - void on_chkNormalize_clicked(bool b){
146   - dispNormalize = b;
147   - SimulateSpectrum();
148   - UpdateDisplay();
149   - }
150   - void on_spinNormFactor_valueChanged(double d){
151   - dispNormFactor = d;
152   - SimulateSpectrum();
153   - UpdateDisplay();
154   - }
155   -
156   - //material parameters
157   - void on_spinRadius_valueChanged(double d){
158   - radius = d;
159   - SimulateSpectrum();
160   - UpdateDisplay();
161   - }
162   - void on_spinBaseIR_valueChanged(double d){
163   - baseIR = d;
164   - ChangeAbsorbance();
165   - SimulateSpectrum();
166   - UpdateDisplay();
167   - }
168   - void on_spinScaleK_valueChanged(double d){
169   - cA = d;
170   - ChangeAbsorbance();
171   - SimulateSpectrum();
172   - UpdateDisplay();
173   - }
174   - void on_chkApplyMaterial_clicked(bool b){
175   - applyMaterial = b;
176   - SimulateSpectrum();
177   - UpdateDisplay();
178   - }
179   - void on_cmbMaterial_currentIndexChanged(int i){
180   - if(updating) return;
181   -
182   - currentMaterial = i;
183   - SetMaterial();
184   - SimulateSpectrum();
185   - UpdateDisplay();
186   - refreshUI();
187   - }
188   -
189   - //optical parameters
190   - void on_spinCondNAi_valueChanged(double d){
191   - cNAi = d;
192   - SimulateSpectrum();
193   - UpdateDisplay();
194   - }
195   - void on_spinCondNAo_valueChanged(double d){
196   - cNAo = d;
197   - SimulateSpectrum();
198   - UpdateDisplay();
199   - }
200   - void on_spinObjNAi_valueChanged(double d){
201   - oNAi = d;
202   - SimulateSpectrum();
203   - UpdateDisplay();
204   - }
205   - void on_spinObjNAo_valueChanged(double d){
206   - oNAo = d;
207   - SimulateSpectrum();
208   - UpdateDisplay();
209   - }
210   - void on_radTransmissionOptics_clicked(bool d){
211   - ui.spinCondNAi->setEnabled(true);
212   - ui.spinCondNAo->setEnabled(true);
213   - opticsMode = TransmissionOpticsType;
214   - SimulateSpectrum();
215   - UpdateDisplay();
216   - }
217   - void on_radReflectionOptics_clicked(bool d){
218   - ui.spinCondNAi->setEnabled(false);
219   - ui.spinCondNAo->setEnabled(false);
220   - ui.radDisplayAbsorbance->setEnabled(false);
221   - ui.radDisplayIntensity->setChecked(true);
222   - opticsMode = ReflectionOpticsType;
223   - SimulateSpectrum();
224   - UpdateDisplay();
225   - }
226   - void on_chkPointDetector_clicked(bool b){
227   - if(b)
228   - {
229   - pointDetector = true;
230   - ui.spinObjectiveSamples->setEnabled(false);
231   - }
232   - else
233   - {
234   - pointDetector = false;
235   - ui.spinObjectiveSamples->setEnabled(true);
236   - }
237   -
238   - SimulateSpectrum();
239   - UpdateDisplay();
240   - }
241   -
242   - void on_spinObjectiveSamples_valueChanged(int i){
243   - objectiveSamples = i;
244   - SimulateSpectrum();
245   - UpdateDisplay();
246   - }
247   -
248   - //Fitting
249   - void on_spinMaxIter_valueChanged(int i){
250   - maxFitIter = i;
251   - }
252   - void on_spinError_valueChanged(double d){
253   - minMSE = d;
254   - }
255   - void on_spinI0Scale_valueChanged(double d){
256   - scaleI0 = d;
257   - SimulateSpectrum();
258   - UpdateDisplay();
259   - }
260   - void on_spinRefSlope_valueChanged(double d){
261   - refSlope = d;
262   - UpdateDisplay();
263   - }
264   -
265   - //display settings
266   -
267   - //Buttons
268   - void on_btnFit_clicked(){
269   - FitDisplay();
270   - refreshUI();
271   - }
272   - void on_btnSave_clicked(){
273   - SaveState();
274   - }
275   - void on_btnReset_clicked(){
276   - SetDefaults();
277   - SimulateSpectrum();
278   - UpdateDisplay();
279   - refreshUI();
280   - }
281   - void on_btnResetK_clicked(){
282   - ChangeAbsorbance();
283   - SimulateSpectrum();
284   - UpdateDisplay();
285   - }
286   - void on_btnEstimateK_clicked(){
287   - EstimateMaterial();
288   - SimulateSpectrum();
289   - UpdateDisplay();
290   - }
291   - void on_btnDistortion_clicked(){
292   - //ComputeDistortion();
293   - //DistortionMap();
294   - cout<<"Distortion"<<endl;
295   - distortionDialog->show();
296   - }
297   - void on_btnTimings_clicked(){
298   - PD.PrintResults(cout);
299   - }
300   -
301   - //menu items
302   - void on_mnuLoadReference_triggered(){
303   - QString fileName = QFileDialog::getOpenFileName(this, tr("Open Reference Spectrum"));
304   -
305   - if(fileName != QString::null){
306   - RefSpectrum.clear();
307   - RefSpectrum.push_back(LoadSpectrum(fileName.toAscii().data()));
308   - }
309   - UpdateDisplay();
310   - }
311   -
312   - void on_mnuLoadMaterial_triggered(){
313   -
314   - //first load the imaginary part
315   - QString kFileName = QFileDialog::getOpenFileName(this, tr("Open Imaginary (k) Spectrum"));
316   -
317   - //exit if no file was selected
318   - if(kFileName == QString::null)
319   - return;
320   -
321   - QString nFileName = QFileDialog::getOpenFileName(this, tr("Open Imaginary (n) Spectrum"));
322   -
323   - //request the material name
324   - QString matName = QInputDialog::getText(this, tr("Material Name"), tr("Enter material name:"));
325   -
326   - //if a real part was given, load both
327   - if(nFileName != QString::null)
328   - LoadMaterial(kFileName.toAscii().data(), nFileName.toAscii().data(), matName.toAscii().data());
329   - else
330   - LoadMaterial(kFileName.toAscii().data(), matName.toAscii().data());
331   -
332   - //add the new material to the combo box
333   - refreshUI();
334   - }
335   - void on_mnuLoadSource_triggered(){
336   - cout<<"Load source."<<endl;
337   - }
338   - void on_chkSourceSpectrum_clicked(bool b){
339   -
340   - useSourceSpectrum = b;
341   - SimulateSpectrum();
342   - UpdateDisplay();
343   -
344   - }
345   -
346   - void on_mnuSaveSim_triggered(){
347   - //first load the imaginary part
348   - QString fileName = QFileDialog::getSaveFileName(this, tr("Save Simulated Spectrum"));
349   - SaveSimulation(fileName.toAscii().data());
350   - }
351   -
352   - void on_mnuSaveK_triggered(){
353   - //first load the imaginary part
354   - QString fileName = QFileDialog::getSaveFileName(this, tr("Save Imaginary Index of Refraction (k)"));
355   - SaveK(fileName.toAscii().data());
356   - }
357   -
358   - void on_mnuSaveN_triggered(){
359   - //first load the imaginary part
360   - QString fileName = QFileDialog::getSaveFileName(this, tr("Save Real Index of Refraction (n)"));
361   - SaveN(fileName.toAscii().data());
362   - }
363   -
364   -
365   -
366   -};
367   -
368   -#endif // INTERACTIVEMIE_H
  1 +#ifndef INTERACTIVEMIE_H
  2 +#define INTERACTIVEMIE_H
  3 +
  4 +#include <QtGui/QMainWindow>
  5 +#include <QDragEnterEvent>
  6 +#include <qfiledialog.h>
  7 +#include <qinputdialog.h>
  8 +#include "ui_interactivemie.h"
  9 +#include "qtDistortionDialog.h"
  10 +#include "globals.h"
  11 +
  12 +extern qtDistortionDialog* distortionDialog;
  13 +
  14 +class InteractiveMie : public QMainWindow
  15 +{
  16 +Q_OBJECT
  17 +
  18 +public:
  19 +InteractiveMie(QWidget *parent = 0, Qt::WFlags flags = 0);
  20 +~InteractiveMie();
  21 +void closeEvent(QCloseEvent *event);
  22 +bool updating;
  23 +
  24 +void refreshUI()
  25 +{
  26 + updating = true;
  27 +
  28 + ui.spinNuMin->setValue(nuMin);
  29 + ui.spinNuMax->setValue(nuMax);
  30 + ui.spinAMin->setValue(aMin);
  31 + ui.spinAMax->setValue(aMax);
  32 + ui.spinRadius->setValue(radius);
  33 + ui.spinBaseIR->setValue(baseIR);
  34 + ui.spinScaleK->setValue(cA);
  35 + ui.spinObjNAi->setValue(oNAi);
  36 + ui.spinObjNAo->setValue(oNAo);
  37 + ui.spinCondNAi->setValue(cNAi);
  38 + ui.spinCondNAo->setValue(cNAo);
  39 + ui.spinError->setValue(minMSE);
  40 + ui.spinMaxIter->setValue(maxFitIter);
  41 + ui.spinI0Scale->setValue(scaleI0);
  42 +
  43 + //display spectra values
  44 + ui.chkDisplaySimSpec->setChecked(dispSimSpec);
  45 + ui.chkDisplayRefSpec->setChecked(dispRefSpec);
  46 + ui.chkDisplaySimK->setChecked(dispSimK);
  47 + ui.chkDisplayMatK->setChecked(dispMatK);
  48 + ui.chkDisplaySimN->setChecked(dispSimN);
  49 + ui.chkDisplayMatN->setChecked(dispMatN);
  50 + ui.spinDispScaleK->setValue(kMax);
  51 + ui.spinDispScaleN->setValue(nMag);
  52 +
  53 + //material selection combo box
  54 + ui.cmbMaterial->clear();
  55 + for(unsigned int i=0; i<MaterialList.size(); i++)
  56 + ui.cmbMaterial->addItem(MaterialList[i].name.c_str(), i);
  57 + ui.cmbMaterial->setCurrentIndex(currentMaterial);
  58 +
  59 + updating = false;
  60 +}
  61 +
  62 +void dragEnterEvent(QDragEnterEvent *event)
  63 +{
  64 + cout<<"This is a test."<<endl;
  65 + QStringList s = event->mimeData()->formats();
  66 + if (event->mimeData()->hasFormat("application/x-qt-windows-mime;value=\"FileName\"") ||
  67 + event->mimeData()->hasFormat("text/plain"))
  68 + {
  69 + event->acceptProposedAction();
  70 +
  71 + }
  72 +}
  73 +
  74 +void dropEvent(QDropEvent *event)
  75 +{
  76 + //cout<<"Challenge Accepted."<<endl;
  77 + RefSpectrum.clear();
  78 + RefSpectrum.push_back(SetReferenceSpectrum(event->mimeData()->text().toAscii().data()));
  79 + UpdateDisplay();
  80 +}
  81 +
  82 +private:
  83 +Ui::InteractiveMieClass ui;
  84 +
  85 +public slots:
  86 +//display parameters
  87 +void on_spinNuMin_valueChanged(int i) {
  88 + if(updating) return;
  89 + nuMin = (float)i;
  90 + UpdateDisplay();
  91 +}
  92 +void on_spinNuMax_valueChanged(int i) {
  93 + if(updating) return;
  94 + nuMax = (float)i;
  95 + UpdateDisplay();
  96 +}
  97 +void on_spinAMin_valueChanged(double d) {
  98 + if(updating) return;
  99 + aMin = d;
  100 + UpdateDisplay();
  101 +}
  102 +void on_spinAMax_valueChanged(double d) {
  103 + if(updating) return;
  104 + aMax = d;
  105 + UpdateDisplay();
  106 +}
  107 +void on_chkDisplaySimSpec_clicked(bool b) {
  108 + if(updating) return;
  109 + dispSimSpec = b;
  110 + UpdateDisplay();
  111 +}
  112 +void on_chkDisplayRefSpec_clicked(bool b) {
  113 + if(updating) return;
  114 + dispRefSpec = b;
  115 + UpdateDisplay();
  116 +}
  117 +void on_chkDisplaySimK_clicked(bool b) {
  118 + if(updating) return;
  119 + dispSimK = b;
  120 + UpdateDisplay();
  121 +}
  122 +void on_chkDisplayMatK_clicked(bool b) {
  123 + if(updating) return;
  124 + dispMatK = b;
  125 + UpdateDisplay();
  126 +}
  127 +void on_chkDisplaySimN_clicked(bool b) {
  128 + if(updating) return;
  129 + dispSimN = b;
  130 + UpdateDisplay();
  131 +}
  132 +void on_chkDisplayMatN_clicked(bool b) {
  133 + if(updating) return;
  134 + dispMatN = b;
  135 + UpdateDisplay();
  136 +}
  137 +void on_spinDispScaleK_valueChanged(double d) {
  138 + if(updating) return;
  139 + kMax = d;
  140 + UpdateDisplay();
  141 +}
  142 +void on_spinDispScaleN_valueChanged(double d) {
  143 + if(updating) return;
  144 + nMag = d;
  145 + UpdateDisplay();
  146 +}
  147 +void on_radDisplayAbsorbance_clicked(bool b) {
  148 + if(updating) return;
  149 + dispSimType = AbsorbanceSpecType;
  150 + SimulateSpectrum();
  151 + UpdateDisplay();
  152 +}
  153 +void on_radDisplayIntensity_toggled(bool b) {
  154 + if(updating) return;
  155 + dispSimType = IntensitySpecType;
  156 + SimulateSpectrum();
  157 + UpdateDisplay();
  158 +}
  159 +void on_chkNormalize_clicked(bool b) {
  160 + if(updating) return;
  161 + dispNormalize = b;
  162 + SimulateSpectrum();
  163 + UpdateDisplay();
  164 +}
  165 +void on_spinNormFactor_valueChanged(double d) {
  166 + if(updating) return;
  167 + dispNormFactor = d;
  168 + SimulateSpectrum();
  169 + UpdateDisplay();
  170 +}
  171 +
  172 +//material parameters
  173 +void on_spinRadius_valueChanged(double d) {
  174 + if(updating) return;
  175 + radius = d;
  176 + SimulateSpectrum();
  177 + UpdateDisplay();
  178 +}
  179 +void on_chkAdjustIR_clicked(bool b) {
  180 + if(updating) return;
  181 + //allow the user to change the mean n and k values
  182 + ui.spinBaseIR->setEnabled(b);
  183 + ui.spinScaleK->setEnabled(b);
  184 +
  185 +}
  186 +void on_spinBaseIR_valueChanged(double d) {
  187 + if(updating) return;
  188 + baseIR = d;
  189 + ChangeAbsorbance();
  190 + SimulateSpectrum();
  191 + UpdateDisplay();
  192 +}
  193 +void on_spinScaleK_valueChanged(double d) {
  194 + if(updating) return;
  195 + cA = d;
  196 + ChangeAbsorbance();
  197 + SimulateSpectrum();
  198 + UpdateDisplay();
  199 +}
  200 +void on_chkApplyMaterial_clicked(bool b) {
  201 + if(updating) return;
  202 + applyMaterial = b;
  203 + SimulateSpectrum();
  204 + UpdateDisplay();
  205 +}
  206 +void on_cmbMaterial_currentIndexChanged(int i) {
  207 + if(updating) return;
  208 +
  209 + currentMaterial = i;
  210 + SetMaterial();
  211 + SimulateSpectrum();
  212 + UpdateDisplay();
  213 + refreshUI();
  214 +}
  215 +
  216 +//optical parameters
  217 +void on_spinCondNAi_valueChanged(double d) {
  218 + cNAi = d;
  219 + SimulateSpectrum();
  220 + UpdateDisplay();
  221 +}
  222 +void on_spinCondNAo_valueChanged(double d) {
  223 + cNAo = d;
  224 + SimulateSpectrum();
  225 + UpdateDisplay();
  226 +}
  227 +void on_spinObjNAi_valueChanged(double d) {
  228 + oNAi = d;
  229 + SimulateSpectrum();
  230 + UpdateDisplay();
  231 +}
  232 +void on_spinObjNAo_valueChanged(double d) {
  233 + oNAo = d;
  234 + SimulateSpectrum();
  235 + UpdateDisplay();
  236 +}
  237 +void on_radTransmissionOptics_clicked(bool d) {
  238 + ui.spinCondNAi->setEnabled(true);
  239 + ui.spinCondNAo->setEnabled(true);
  240 + opticsMode = TransmissionOpticsType;
  241 + SimulateSpectrum();
  242 + UpdateDisplay();
  243 +}
  244 +void on_radReflectionOptics_clicked(bool d) {
  245 + ui.spinCondNAi->setEnabled(false);
  246 + ui.spinCondNAo->setEnabled(false);
  247 + ui.radDisplayAbsorbance->setEnabled(false);
  248 + ui.radDisplayIntensity->setChecked(true);
  249 + opticsMode = ReflectionOpticsType;
  250 + SimulateSpectrum();
  251 + UpdateDisplay();
  252 +}
  253 +void on_chkPointDetector_clicked(bool b) {
  254 + if(b)
  255 + {
  256 + pointDetector = true;
  257 + ui.spinObjectiveSamples->setEnabled(false);
  258 + }
  259 + else
  260 + {
  261 + pointDetector = false;
  262 + ui.spinObjectiveSamples->setEnabled(true);
  263 + }
  264 +
  265 + SimulateSpectrum();
  266 + UpdateDisplay();
  267 +}
  268 +
  269 +void on_spinObjectiveSamples_valueChanged(int i) {
  270 + objectiveSamples = i;
  271 + SimulateSpectrum();
  272 + UpdateDisplay();
  273 +}
  274 +
  275 +//Fitting
  276 +void on_spinMaxIter_valueChanged(int i) {
  277 + maxFitIter = i;
  278 +}
  279 +void on_spinError_valueChanged(double d) {
  280 + minMSE = d;
  281 +}
  282 +void on_spinI0Scale_valueChanged(double d) {
  283 + scaleI0 = d;
  284 + SimulateSpectrum();
  285 + UpdateDisplay();
  286 +}
  287 +void on_spinRefSlope_valueChanged(double d) {
  288 + refSlope = d;
  289 + UpdateDisplay();
  290 +}
  291 +
  292 +//display settings
  293 +
  294 +//Buttons
  295 +void on_btnFit_clicked() {
  296 + FitDisplay();
  297 + refreshUI();
  298 +}
  299 +void on_btnSave_clicked() {
  300 + SaveState();
  301 +}
  302 +void on_btnReset_clicked() {
  303 + SetDefaults();
  304 + SimulateSpectrum();
  305 + UpdateDisplay();
  306 + refreshUI();
  307 +}
  308 +void on_btnResetK_clicked() {
  309 + ChangeAbsorbance();
  310 + SimulateSpectrum();
  311 + UpdateDisplay();
  312 +}
  313 +void on_btnEstimateK_clicked() {
  314 + EstimateMaterial();
  315 + SimulateSpectrum();
  316 + UpdateDisplay();
  317 +}
  318 +void on_btnDistortion_clicked() {
  319 + //ComputeDistortion();
  320 + //DistortionMap();
  321 + cout<<"Distortion"<<endl;
  322 + distortionDialog->show();
  323 +}
  324 +void on_btnTimings_clicked() {
  325 + PD.PrintResults(cout);
  326 +}
  327 +
  328 +//menu items
  329 +void on_mnuLoadReference_triggered() {
  330 + QString fileName = QFileDialog::getOpenFileName(this, tr("Open Reference Spectrum"));
  331 +
  332 + if(fileName != QString::null) {
  333 + RefSpectrum.clear();
  334 + RefSpectrum.push_back(LoadSpectrum(fileName.toAscii().data()));
  335 + }
  336 + UpdateDisplay();
  337 +}
  338 +
  339 +void on_mnuLoadMaterial_triggered() {
  340 +
  341 + //first load the imaginary part
  342 + QString fileName = QFileDialog::getOpenFileName(this, tr("Open Material Spectrum"));
  343 +
  344 + //exit if no file was selected
  345 + /*if(kFileName == QString::null)
  346 + return;
  347 +
  348 + QString nFileName = QFileDialog::getOpenFileName(this, tr("Open Imaginary (n) Spectrum"));*/
  349 +
  350 + //request the material name
  351 + QString matName = QInputDialog::getText(this, tr("Material Name"), tr("Enter material name:"));
  352 +
  353 + //if a real part was given, load both
  354 + /*if(nFileName != QString::null)
  355 + LoadMaterial(kFileName.toAscii().data(), nFileName.toAscii().data(), matName.toAscii().data());
  356 + else
  357 + LoadMaterial(kFileName.toAscii().data(), matName.toAscii().data());*/
  358 + LoadMaterial(fileName.toAscii().data(), matName.toAscii().data());
  359 +
  360 + //add the new material to the combo box
  361 + refreshUI();
  362 +}
  363 +void on_mnuLoadSource_triggered() {
  364 + cout<<"Load source."<<endl;
  365 +}
  366 +void on_chkSourceSpectrum_clicked(bool b) {
  367 +
  368 + useSourceSpectrum = b;
  369 + SimulateSpectrum();
  370 + UpdateDisplay();
  371 +
  372 +}
  373 +
  374 +void on_mnuSaveSim_triggered() {
  375 + //first load the imaginary part
  376 + QString fileName = QFileDialog::getSaveFileName(this, tr("Save Simulated Spectrum"));
  377 + SaveSimulation(fileName.toAscii().data());
  378 +}
  379 +
  380 +/*void on_mnuSaveK_triggered() {
  381 + //first load the imaginary part
  382 + QString fileName = QFileDialog::getSaveFileName(this, tr("Save Imaginary Index of Refraction (k)"));
  383 + SaveK(fileName.toAscii().data());
  384 +}*/
  385 +
  386 +void on_mnuSaveMaterial_triggered() {
  387 + //first load the imaginary part
  388 + QString fileName = QFileDialog::getSaveFileName(this, tr("Save Real Index of Refraction (n)"));
  389 + SaveMaterial(fileName.toAscii().data());
  390 +}
  391 +
  392 +
  393 +
  394 +};
  395 +
  396 +#endif // INTERACTIVEMIE_H
... ...
interactivemie.ui
... ... @@ -23,13 +23,16 @@
23 23 <x>20</x>
24 24 <y>170</y>
25 25 <width>151</width>
26   - <height>161</height>
  26 + <height>191</height>
27 27 </rect>
28 28 </property>
29 29 <property name="title">
30 30 <string>Material</string>
31 31 </property>
32 32 <widget class="QDoubleSpinBox" name="spinScaleK">
  33 + <property name="enabled">
  34 + <bool>false</bool>
  35 + </property>
33 36 <property name="geometry">
34 37 <rect>
35 38 <x>80</x>
... ... @@ -39,13 +42,16 @@
39 42 </rect>
40 43 </property>
41 44 <property name="singleStep">
42   - <double>0.100000000000000</double>
  45 + <double>0.010000000000000</double>
43 46 </property>
44 47 <property name="value">
45 48 <double>1.000000000000000</double>
46 49 </property>
47 50 </widget>
48 51 <widget class="QDoubleSpinBox" name="spinBaseIR">
  52 + <property name="enabled">
  53 + <bool>false</bool>
  54 + </property>
49 55 <property name="geometry">
50 56 <rect>
51 57 <x>80</x>
... ... @@ -67,14 +73,17 @@
67 73 <widget class="QLabel" name="label_8">
68 74 <property name="geometry">
69 75 <rect>
70   - <x>30</x>
  76 + <x>20</x>
71 77 <y>50</y>
72 78 <width>46</width>
73   - <height>13</height>
  79 + <height>21</height>
74 80 </rect>
75 81 </property>
76 82 <property name="text">
77   - <string>base IR</string>
  83 + <string>mean n</string>
  84 + </property>
  85 + <property name="alignment">
  86 + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
78 87 </property>
79 88 </widget>
80 89 <widget class="QDoubleSpinBox" name="spinRadius">
... ... @@ -99,34 +108,40 @@
99 108 <widget class="QLabel" name="label_4">
100 109 <property name="geometry">
101 110 <rect>
102   - <x>30</x>
  111 + <x>20</x>
103 112 <y>20</y>
104 113 <width>46</width>
105   - <height>13</height>
  114 + <height>21</height>
106 115 </rect>
107 116 </property>
108 117 <property name="text">
109 118 <string>radius</string>
110 119 </property>
  120 + <property name="alignment">
  121 + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
  122 + </property>
111 123 </widget>
112 124 <widget class="QLabel" name="label_9">
113 125 <property name="geometry">
114 126 <rect>
115   - <x>30</x>
  127 + <x>20</x>
116 128 <y>80</y>
117 129 <width>46</width>
118   - <height>13</height>
  130 + <height>21</height>
119 131 </rect>
120 132 </property>
121 133 <property name="text">
122   - <string>scale K</string>
  134 + <string>scale k</string>
  135 + </property>
  136 + <property name="alignment">
  137 + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
123 138 </property>
124 139 </widget>
125 140 <widget class="QCheckBox" name="chkApplyMaterial">
126 141 <property name="geometry">
127 142 <rect>
128 143 <x>20</x>
129   - <y>110</y>
  144 + <y>130</y>
130 145 <width>121</width>
131 146 <height>17</height>
132 147 </rect>
... ... @@ -142,12 +157,28 @@
142 157 <property name="geometry">
143 158 <rect>
144 159 <x>20</x>
145   - <y>140</y>
  160 + <y>160</y>
146 161 <width>111</width>
147 162 <height>22</height>
148 163 </rect>
149 164 </property>
150 165 </widget>
  166 + <widget class="QCheckBox" name="chkAdjustIR">
  167 + <property name="geometry">
  168 + <rect>
  169 + <x>20</x>
  170 + <y>110</y>
  171 + <width>101</width>
  172 + <height>17</height>
  173 + </rect>
  174 + </property>
  175 + <property name="text">
  176 + <string>Adjust IR</string>
  177 + </property>
  178 + <property name="checked">
  179 + <bool>false</bool>
  180 + </property>
  181 + </widget>
151 182 </widget>
152 183 <widget class="QGroupBox" name="groupBox_2">
153 184 <property name="geometry">
... ... @@ -644,7 +675,7 @@
644 675 </rect>
645 676 </property>
646 677 <property name="singleStep">
647   - <double>0.100000000000000</double>
  678 + <double>0.010000000000000</double>
648 679 </property>
649 680 </widget>
650 681 <widget class="QDoubleSpinBox" name="spinDispScaleN">
... ... @@ -657,7 +688,7 @@
657 688 </rect>
658 689 </property>
659 690 <property name="singleStep">
660   - <double>0.100000000000000</double>
  691 + <double>0.010000000000000</double>
661 692 </property>
662 693 </widget>
663 694 <widget class="QCheckBox" name="chkNormalize">
... ... @@ -791,7 +822,7 @@
791 822 <property name="geometry">
792 823 <rect>
793 824 <x>20</x>
794   - <y>340</y>
  825 + <y>370</y>
795 826 <width>201</width>
796 827 <height>111</height>
797 828 </rect>
... ... @@ -860,7 +891,7 @@
860 891 </rect>
861 892 </property>
862 893 <property name="text">
863   - <string>Estimate K</string>
  894 + <string>Estimate k</string>
864 895 </property>
865 896 </widget>
866 897 <widget class="QPushButton" name="btnResetK">
... ... @@ -873,7 +904,7 @@
873 904 </rect>
874 905 </property>
875 906 <property name="text">
876   - <string>Reset K</string>
  907 + <string>Reset k</string>
877 908 </property>
878 909 </widget>
879 910 <widget class="QLabel" name="label_5">
... ... @@ -913,8 +944,7 @@
913 944 <string>Save</string>
914 945 </property>
915 946 <addaction name="mnuSaveSim"/>
916   - <addaction name="mnuSaveK"/>
917   - <addaction name="mnuSaveN"/>
  947 + <addaction name="mnuSaveMaterial"/>
918 948 </widget>
919 949 <widget class="QMenu" name="menuVersion_0_6">
920 950 <property name="title">
... ... @@ -954,9 +984,9 @@
954 984 <string>k</string>
955 985 </property>
956 986 </action>
957   - <action name="mnuSaveN">
  987 + <action name="mnuSaveMaterial">
958 988 <property name="text">
959   - <string>n</string>
  989 + <string>Material</string>
960 990 </property>
961 991 </action>
962 992 <action name="mnuLoadSource">
... ...
kPMMA.txt
  1 +nu k
1 2 600 0.0241342
2 3 602 0.027446631
3 4 604 0.02823961
... ...
kPTFE.txt 0 โ†’ 100644
  1 +nu k
  2 +898.665771 0.119797
  3 +902.522705 0.113611
  4 +906.379639 0.106711
  5 +910.236572 0.099793
  6 +914.093506 0.099635
  7 +917.950439 0.101204
  8 +921.807373 0.104875
  9 +925.664307 0.107064
  10 +929.52124 0.103106
  11 +933.378174 0.102888
  12 +937.235107 0.105524
  13 +941.092041 0.112168
  14 +944.948975 0.118147
  15 +948.805908 0.123335
  16 +952.662842 0.125731
  17 +956.519775 0.123265
  18 +960.376709 0.123469
  19 +964.233643 0.121685
  20 +968.090576 0.12018
  21 +971.94751 0.118345
  22 +975.804443 0.115624
  23 +979.661377 0.115624
  24 +983.518311 0.115935
  25 +987.375244 0.117921
  26 +991.232178 0.12058
  27 +995.089111 0.126018
  28 +998.946045 0.135758
  29 +1002.802979 0.149488
  30 +1006.659912 0.166032
  31 +1010.516846 0.184224
  32 +1014.373779 0.199554
  33 +1018.230713 0.205409
  34 +1022.087646 0.208976
  35 +1025.94458 0.209979
  36 +1029.801514 0.204706
  37 +1033.658447 0.195665
  38 +1037.515381 0.185283
  39 +1041.372314 0.177356
  40 +1045.229248 0.171783
  41 +1049.086182 0.168174
  42 +1052.943115 0.165209
  43 +1056.800049 0.164215
  44 +1060.656982 0.164634
  45 +1064.513916 0.167807
  46 +1068.37085 0.175054
  47 +1072.227783 0.183043
  48 +1076.084717 0.192604
  49 +1079.94165 0.201534
  50 +1083.798584 0.209008
  51 +1087.655518 0.216408
  52 +1091.512451 0.224841
  53 +1095.369385 0.230546
  54 +1099.226318 0.228466
  55 +1103.083252 0.221409
  56 +1106.940186 0.212899
  57 +1110.797119 0.205085
  58 +1114.654053 0.195571
  59 +1118.510986 0.189145
  60 +1122.36792 0.190001
  61 +1126.224854 0.195114
  62 +1130.081787 0.206932
  63 +1133.938721 0.231471
  64 +1137.795654 0.277626
  65 +1141.652588 0.362189
  66 +1145.509521 0.508769
  67 +1149.366455 0.675979
  68 +1153.223389 0.742934
  69 +1157.080322 0.713568
  70 +1160.937256 0.634251
  71 +1164.794189 0.538205
  72 +1168.651123 0.451822
  73 +1172.508057 0.371445
  74 +1176.36499 0.304973
  75 +1180.221924 0.272547
  76 +1184.078857 0.278284
  77 +1187.935791 0.311813
  78 +1191.792725 0.370434
  79 +1195.649658 0.456571
  80 +1199.506592 0.571005
  81 +1203.363525 0.690027
  82 +1207.220459 0.768029
  83 +1211.077393 0.801994
  84 +1214.934326 0.81201
  85 +1218.79126 0.815038
  86 +1222.648193 0.807314
  87 +1226.505249 0.790257
  88 +1230.362061 0.760849
  89 +1234.219116 0.717067
  90 +1238.07605 0.664946
  91 +1241.932861 0.597291
  92 +1245.789917 0.520156
  93 +1249.646851 0.441294
  94 +1253.503784 0.37302
  95 +1257.360718 0.314789
  96 +1261.217651 0.254094
  97 +1265.074585 0.189348
  98 +1268.931519 0.136625
  99 +1272.788452 0.107828
  100 +1276.645386 0.096242
  101 +1280.502319 0.091956
  102 +1284.359253 0.090309
  103 +1288.216187 0.090969
  104 +1292.07312 0.090918
  105 +1295.930054 0.090126
  106 +1299.786987 0.088419
  107 +1303.643921 0.081592
  108 +1307.500854 0.073385
  109 +1311.357788 0.066815
  110 +1315.214722 0.063703
  111 +1319.071655 0.062516
  112 +1322.928589 0.061202
  113 +1326.785522 0.061311
  114 +1330.642456 0.061893
  115 +1334.49939 0.063851
  116 +1338.356323 0.066716
  117 +1342.213257 0.068291
  118 +1346.07019 0.068949
  119 +1349.927124 0.071117
  120 +1353.784058 0.074663
  121 +1357.640991 0.077776
  122 +1361.497925 0.080936
  123 +1365.354858 0.080985
  124 +1369.211792 0.079623
  125 +1373.068726 0.079098
  126 +1376.925659 0.07642
  127 +1380.782593 0.073569
  128 +1384.639526 0.07403
  129 +1388.49646 0.074968
  130 +1392.353394 0.075173
  131 +1396.210327 0.077807
  132 +1400.067261 0.079196
  133 +1403.924194 0.080566
  134 +1407.781128 0.083056
  135 +1411.638062 0.084542
  136 +1415.494995 0.089578
  137 +1419.351929 0.093261
  138 +1423.208862 0.091348
  139 +1427.065796 0.09023
  140 +1430.922729 0.091503
  141 +1434.779663 0.094947
  142 +1438.636597 0.09386
  143 +1442.49353 0.090456
  144 +1446.350464 0.0896
  145 +1450.207397 0.087377
  146 +1454.064331 0.088299
  147 +1457.921265 0.090942
  148 +1461.778198 0.0866
  149 +1465.635132 0.085919
  150 +1469.492065 0.089903
  151 +1473.348999 0.094438
  152 +1477.205933 0.094567
  153 +1481.062866 0.092036
  154 +1484.9198 0.096689
  155 +1488.776733 0.100191
  156 +1492.633667 0.099245
  157 +1496.490601 0.097936
  158 +1500.347534 0.094544
  159 +1504.204468 0.100589
  160 +1508.061401 0.105907
  161 +1511.918335 0.09782
  162 +1515.775269 0.095739
  163 +1519.632202 0.100649
  164 +1523.489136 0.098981
  165 +1527.346069 0.094213
  166 +1531.203003 0.092945
  167 +1535.059937 0.095972
  168 +1538.91687 0.10604
  169 +1542.773804 0.106572
  170 +1546.630737 0.098688
  171 +1550.487671 0.096871
  172 +1554.344604 0.104288
  173 +1558.201538 0.114593
  174 +1562.058472 0.106013
  175 +1565.915405 0.100332
  176 +1569.772339 0.101925
  177 +1573.629272 0.102216
  178 +1577.486206 0.102323
  179 +1581.34314 0.099031
  180 +1585.200073 0.098575
  181 +1589.057007 0.099345
  182 +1592.91394 0.098173
  183 +1596.770874 0.099296
  184 +1600.627808 0.098506
  185 +1604.484741 0.099291
  186 +1608.341675 0.099866
  187 +1612.198608 0.10207
  188 +1616.055542 0.108292
  189 +1619.912476 0.108942
  190 +1623.769409 0.111048
  191 +1627.626343 0.10924
  192 +1631.483276 0.109778
  193 +1635.34021 0.114933
  194 +1639.197144 0.108015
  195 +1643.054077 0.103923
  196 +1646.911011 0.106034
  197 +1650.767944 0.112606
  198 +1654.624878 0.112221
  199 +1658.481812 0.104846
  200 +1662.338745 0.105472
  201 +1666.195679 0.106895
  202 +1670.052612 0.109738
  203 +1673.909546 0.111448
  204 +1677.766479 0.109629
  205 +1681.623413 0.11616
  206 +1685.480347 0.117894
  207 +1689.33728 0.111271
  208 +1693.194214 0.112307
  209 +1697.051147 0.121065
  210 +1700.908081 0.121781
  211 +1704.765015 0.11577
  212 +1708.621948 0.1102
  213 +1712.478882 0.110347
  214 +1716.335815 0.117381
  215 +1720.192749 0.113735
  216 +1724.049683 0.108096
  217 +1727.906738 0.109655
  218 +1731.76355 0.115723
  219 +1735.620605 0.11899
  220 +1739.477539 0.117061
  221 +1743.334473 0.117513
  222 +1747.191406 0.119943
  223 +1751.04834 0.120675
  224 +1754.905273 0.117093
  225 +1758.762207 0.116268
  226 +1762.619141 0.116788
  227 +1766.476074 0.116819
  228 +1770.333008 0.122916
  229 +1774.189941 0.121082
  230 +1778.046875 0.117999
  231 +1781.903809 0.118654
  232 +1785.760742 0.117828
  233 +1789.617676 0.120904
  234 +1793.474609 0.12157
  235 +1797.331543 0.120378
  236 +1801.188477 0.119121
  237 +1805.04541 0.118429
  238 +1808.902344 0.120929
  239 +1812.759277 0.121934
  240 +1816.616211 0.121768
  241 +1820.473145 0.122502
  242 +1824.330078 0.125022
  243 +1828.187012 0.126044
  244 +1832.043945 0.124735
  245 +1835.900879 0.122494
  246 +1839.757812 0.121608
  247 +1843.614746 0.12354
  248 +1847.47168 0.122387
  249 +1851.328613 0.120089
  250 +1855.185547 0.119761
  251 +1859.04248 0.119944
  252 +1862.899414 0.121586
  253 +1866.756348 0.12588
  254 +1870.613281 0.126864
  255 +1874.470215 0.125077
  256 +1878.327148 0.126259
  257 +1882.184082 0.126898
  258 +1886.041016 0.12878
  259 +1889.897949 0.130889
  260 +1893.754883 0.130154
  261 +1897.611816 0.128743
  262 +1901.46875 0.12709
  263 +1905.325684 0.126148
  264 +1909.182617 0.12448
  265 +1913.039551 0.124467
  266 +1916.896484 0.126429
  267 +1920.753418 0.126745
  268 +1924.610352 0.125931
  269 +1928.467285 0.126244
  270 +1932.324219 0.128196
  271 +1936.181152 0.129263
  272 +1940.038086 0.130692
  273 +1943.89502 0.132099
  274 +1947.751953 0.132385
  275 +1951.608887 0.132089
  276 +1955.46582 0.13207
  277 +1959.322754 0.132502
  278 +1963.179688 0.133091
  279 +1967.036621 0.134334
  280 +1970.893555 0.133633
  281 +1974.750488 0.132941
  282 +1978.607422 0.132207
  283 +1982.464355 0.130382
  284 +1986.321289 0.130208
  285 +1990.178223 0.130239
  286 +1994.035156 0.130694
  287 +1997.89209 0.130857
  288 +2001.749023 0.131523
  289 +2005.605957 0.132631
  290 +2009.462891 0.13381
  291 +2013.319824 0.135877
  292 +2017.176758 0.137253
  293 +2021.033691 0.137779
  294 +2024.890625 0.137152
  295 +2028.747559 0.136642
  296 +2032.604492 0.136288
  297 +2036.461426 0.136501
  298 +2040.318359 0.136449
  299 +2044.175293 0.13475
  300 +2048.032227 0.134343
  301 +2051.88916 0.134235
  302 +2055.746094 0.134563
  303 +2059.603027 0.134534
  304 +2063.459961 0.135336
  305 +2067.316895 0.137324
  306 +2071.173828 0.138357
  307 +2075.030762 0.140503
  308 +2078.887695 0.141893
  309 +2082.744629 0.142863
  310 +2086.601562 0.144135
  311 +2090.458496 0.144251
  312 +2094.31543 0.144278
  313 +2098.172363 0.144239
  314 +2102.029297 0.144004
  315 +2105.88623 0.143478
  316 +2109.743164 0.143511
  317 +2113.600098 0.143151
  318 +2117.457031 0.143559
  319 +2121.313965 0.144096
  320 +2125.170898 0.144133
  321 +2129.027832 0.145068
  322 +2132.884766 0.144984
  323 +2136.741699 0.144745
  324 +2140.598633 0.145628
  325 +2144.455566 0.147823
  326 +2148.3125 0.150011
  327 +2152.169434 0.151872
  328 +2156.026367 0.153301
  329 +2159.883301 0.153103
  330 +2163.740234 0.154012
  331 +2167.597168 0.155013
  332 +2171.454102 0.155685
  333 +2175.311035 0.155886
  334 +2179.167969 0.155053
  335 +2183.024902 0.154117
  336 +2186.881836 0.153234
  337 +2190.73877 0.153008
  338 +2194.595703 0.152778
  339 +2198.452637 0.152969
  340 +2202.30957 0.153286
  341 +2206.166504 0.154937
  342 +2210.023438 0.157569
  343 +2213.880371 0.159214
  344 +2217.737305 0.161321
  345 +2221.594238 0.163009
  346 +2225.451172 0.165156
  347 +2229.308105 0.166447
  348 +2233.165039 0.16597
  349 +2237.021973 0.165728
  350 +2240.878906 0.16592
  351 +2244.73584 0.165315
  352 +2248.592773 0.163689
  353 +2252.449707 0.163399
  354 +2256.306641 0.163338
  355 +2260.163574 0.163126
  356 +2264.020508 0.16376
  357 +2267.877441 0.165369
  358 +2271.734375 0.166799
  359 +2275.591309 0.167143
  360 +2279.448242 0.168417
  361 +2283.305176 0.169971
  362 +2287.162109 0.172706
  363 +2291.019043 0.174338
  364 +2294.875977 0.17392
  365 +2298.73291 0.172741
  366 +2302.589844 0.170809
  367 +2306.446777 0.169791
  368 +2310.303711 0.167444
  369 +2314.160645 0.167382
  370 +2318.017578 0.169346
  371 +2321.874512 0.1687
  372 +2325.731445 0.169079
  373 +2329.588379 0.171429
  374 +2333.445312 0.172005
  375 +2337.302246 0.17173
  376 +2341.15918 0.177313
  377 +2345.016113 0.172166
  378 +2348.873047 0.164887
  379 +2352.72998 0.170921
  380 +2356.586914 0.179951
  381 +2360.443848 0.187692
  382 +2364.300781 0.193336
  383 +2368.157715 0.196336
  384 +2372.014648 0.19635
  385 +2375.871582 0.190763
  386 +2379.728516 0.186245
  387 +2383.585449 0.182521
  388 +2387.442383 0.180239
  389 +2391.299316 0.178919
  390 +2395.15625 0.178212
  391 +2399.013184 0.178546
  392 +2402.870117 0.178607
  393 +2406.727051 0.178765
  394 +2410.583984 0.180182
  395 +2414.440918 0.182686
  396 +2418.297852 0.184782
  397 +2422.154785 0.186519
  398 +2426.011719 0.187862
  399 +2429.868652 0.188519
  400 +2433.725586 0.188641
  401 +2437.58252 0.188783
  402 +2441.439453 0.188943
  403 +2445.296387 0.188549
  404 +2449.15332 0.188368
  405 +2453.010254 0.187423
  406 +2456.867432 0.186584
  407 +2460.724121 0.186132
  408 +2464.581299 0.185374
  409 +2468.437988 0.185088
  410 +2472.294922 0.18578
  411 +2476.1521 0.186438
  412 +2480.008789 0.186875
  413 +2483.865967 0.188714
  414 +2487.7229 0.189906
  415 +2491.579834 0.190912
  416 +2495.436768 0.192349
  417 +2499.293701 0.193208
  418 +2503.150635 0.194736
  419 +2507.007568 0.195032
  420 +2510.864502 0.194682
  421 +2514.721436 0.194575
  422 +2518.578369 0.194022
  423 +2522.435303 0.192652
  424 +2526.292236 0.190689
  425 +2530.14917 0.188958
  426 +2534.006104 0.188007
  427 +2537.863037 0.188064
  428 +2541.719971 0.188482
  429 +2545.576904 0.190521
  430 +2549.433838 0.192907
  431 +2553.290771 0.194646
  432 +2557.147705 0.195373
  433 +2561.004639 0.19598
  434 +2564.861572 0.198918
  435 +2568.718506 0.200591
  436 +2572.575439 0.200731
  437 +2576.432373 0.199931
  438 +2580.289307 0.199108
  439 +2584.14624 0.199044
  440 +2588.003174 0.198248
  441 +2591.860107 0.198056
  442 +2595.717041 0.197357
  443 +2599.573975 0.196511
  444 +2603.430908 0.195941
  445 +2607.287842 0.196022
  446 +2611.144775 0.196668
  447 +2615.001709 0.197505
  448 +2618.858643 0.199575
  449 +2622.715576 0.200912
  450 +2626.57251 0.203322
  451 +2630.429443 0.205753
  452 +2634.286377 0.206707
  453 +2638.143311 0.207317
  454 +2642.000244 0.20686
  455 +2645.857178 0.206699
  456 +2649.714111 0.207118
  457 +2653.571045 0.207081
  458 +2657.427979 0.204599
  459 +2661.284912 0.202973
  460 +2665.141846 0.203807
  461 +2668.998779 0.20409
  462 +2672.855713 0.204505
  463 +2676.712646 0.204402
  464 +2680.56958 0.205393
  465 +2684.426514 0.207695
  466 +2688.283447 0.210657
  467 +2692.140381 0.21329
  468 +2695.997314 0.213214
  469 +2699.854248 0.213629
  470 +2703.711182 0.215489
  471 +2707.568115 0.217552
  472 +2711.425049 0.219984
  473 +2715.281982 0.220446
  474 +2719.138916 0.21845
  475 +2722.99585 0.217402
  476 +2726.852783 0.217728
  477 +2730.709717 0.217692
  478 +2734.56665 0.217954
  479 +2738.423584 0.219007
  480 +2742.280518 0.219831
  481 +2746.137451 0.219937
  482 +2749.994385 0.221145
  483 +2753.851318 0.223599
  484 +2757.708252 0.226448
  485 +2761.565186 0.228654
  486 +2765.422119 0.230751
  487 +2769.279053 0.23316
  488 +2773.135986 0.233946
  489 +2776.99292 0.235595
  490 +2780.849854 0.237077
  491 +2784.706787 0.237037
  492 +2788.563721 0.237783
  493 +2792.420654 0.238303
  494 +2796.277588 0.23844
  495 +2800.134521 0.237748
  496 +2803.991455 0.23761
  497 +2807.848389 0.239399
  498 +2811.705322 0.242356
  499 +2815.562256 0.245029
  500 +2819.419189 0.247127
  501 +2823.276123 0.249953
  502 +2827.133057 0.252941
  503 +2830.98999 0.255616
  504 +2834.846924 0.256416
  505 +2838.703857 0.257745
  506 +2842.560791 0.261174
  507 +2846.417725 0.263504
  508 +2850.274658 0.265136
  509 +2854.131592 0.266484
  510 +2857.988525 0.267884
  511 +2861.845459 0.268755
  512 +2865.702393 0.269319
  513 +2869.559326 0.270306
  514 +2873.41626 0.270931
  515 +2877.273193 0.27218
  516 +2881.130127 0.274424
  517 +2884.987061 0.277215
  518 +2888.843994 0.279752
  519 +2892.700928 0.28225
  520 +2896.557861 0.285606
  521 +2900.414795 0.289405
  522 +2904.271729 0.29194
  523 +2908.128662 0.293517
  524 +2911.985596 0.295321
  525 +2915.842529 0.297343
  526 +2919.699463 0.30078
  527 +2923.556396 0.303916
  528 +2927.41333 0.304841
  529 +2931.270264 0.304886
  530 +2935.127197 0.307534
  531 +2938.984131 0.310065
  532 +2942.841064 0.309946
  533 +2946.697998 0.312969
  534 +2950.554932 0.319969
  535 +2954.411865 0.330884
  536 +2958.268799 0.341583
  537 +2962.125732 0.345956
  538 +2965.982666 0.343104
  539 +2969.8396 0.335753
  540 +2973.696533 0.330953
  541 +2977.553467 0.327567
  542 +2981.4104 0.32633
  543 +2985.267334 0.327893
  544 +2989.124268 0.328081
  545 +2992.981201 0.327513
  546 +2996.838135 0.32761
  547 +3000.695068 0.329393
  548 +3004.552002 0.330277
  549 +3008.408936 0.330659
  550 +3012.265869 0.331638
  551 +3016.122803 0.333973
  552 +3019.979736 0.337387
  553 +3023.83667 0.339392
  554 +3027.693604 0.343113
  555 +3031.550537 0.346716
  556 +3035.407471 0.348999
  557 +3039.264404 0.349565
  558 +3043.121338 0.350472
  559 +3046.978271 0.354745
  560 +3050.835205 0.356839
  561 +3054.692139 0.35844
  562 +3058.549072 0.360373
  563 +3062.406006 0.359955
  564 +3066.262939 0.358908
  565 +3070.119873 0.358617
  566 +3073.976807 0.359479
  567 +3077.83374 0.360783
  568 +3081.690674 0.362895
  569 +3085.547607 0.365378
  570 +3089.404541 0.368972
  571 +3093.261475 0.372506
  572 +3097.118408 0.376024
  573 +3100.975342 0.379468
  574 +3104.832275 0.381968
  575 +3108.689209 0.385588
  576 +3112.546143 0.386591
  577 +3116.403076 0.385214
  578 +3120.26001 0.386689
  579 +3124.116943 0.390244
  580 +3127.973877 0.392708
  581 +3131.830811 0.394077
  582 +3135.687744 0.393566
  583 +3139.544678 0.391412
  584 +3143.401611 0.393047
  585 +3147.258545 0.396304
  586 +3151.115479 0.398407
  587 +3154.972412 0.400344
  588 +3158.829346 0.402014
  589 +3162.686279 0.404263
  590 +3166.543213 0.406683
  591 +3170.400146 0.40869
  592 +3174.25708 0.411274
  593 +3178.114014 0.415657
  594 +3181.970947 0.419736
  595 +3185.827881 0.42175
  596 +3189.684814 0.419426
  597 +3193.541748 0.419143
  598 +3197.398682 0.424583
  599 +3201.255615 0.426743
  600 +3205.112549 0.428647
  601 +3208.969482 0.429678
  602 +3212.826416 0.429757
  603 +3216.68335 0.433223
  604 +3220.540283 0.436215
  605 +3224.397217 0.439306
  606 +3228.25415 0.441374
  607 +3232.111084 0.44311
  608 +3235.968018 0.445396
  609 +3239.824951 0.448125
  610 +3243.681885 0.451367
  611 +3247.538818 0.454258
  612 +3251.395752 0.456481
  613 +3255.252686 0.456045
  614 +3259.109619 0.457979
  615 +3262.966553 0.460119
  616 +3266.823486 0.459373
  617 +3270.68042 0.4599
  618 +3274.537354 0.461298
  619 +3278.394287 0.463606
  620 +3282.251221 0.467458
  621 +3286.108154 0.471413
  622 +3289.965088 0.472572
  623 +3293.822021 0.473989
  624 +3297.678955 0.476511
  625 +3301.535889 0.478557
  626 +3305.392822 0.483234
  627 +3309.249756 0.489315
  628 +3313.106689 0.4922
  629 +3316.963623 0.492279
  630 +3320.820557 0.494391
  631 +3324.67749 0.497505
  632 +3328.534424 0.501519
  633 +3332.391357 0.503834
  634 +3336.248291 0.503075
  635 +3340.105225 0.50296
  636 +3343.962158 0.502158
  637 +3347.819092 0.502881
  638 +3351.676025 0.504862
  639 +3355.532959 0.509708
  640 +3359.389893 0.516957
  641 +3363.246826 0.52107
  642 +3367.10376 0.521195
  643 +3370.960693 0.522663
  644 +3374.817627 0.527924
  645 +3378.674561 0.529786
  646 +3382.531494 0.532712
  647 +3386.388428 0.53422
  648 +3390.245361 0.53586
  649 +3394.102295 0.541357
  650 +3397.959229 0.539042
  651 +3401.816162 0.538392
  652 +3405.673096 0.542694
  653 +3409.530029 0.546009
  654 +3413.386963 0.547949
  655 +3417.243896 0.551694
  656 +3421.10083 0.557508
  657 +3424.957764 0.558706
  658 +3428.814697 0.559973
  659 +3432.671631 0.560578
  660 +3436.528564 0.562476
  661 +3440.385498 0.566948
  662 +3444.242432 0.571401
  663 +3448.099609 0.572987
  664 +3451.956299 0.573218
  665 +3455.813232 0.577121
  666 +3459.67041 0.577896
  667 +3463.5271 0.579122
  668 +3467.384277 0.578371
  669 +3471.241211 0.579208
  670 +3475.098145 0.582138
  671 +3478.955078 0.58127
  672 +3482.812012 0.586469
  673 +3486.668945 0.589135
  674 +3490.525879 0.591052
  675 +3494.382812 0.593125
  676 +3498.239746 0.59621
  677 +3502.09668 0.603276
  678 +3505.953613 0.606524
  679 +3509.810547 0.607297
  680 +3513.66748 0.601191
  681 +3517.524414 0.603099
  682 +3521.381348 0.615545
  683 +3525.238281 0.624269
  684 +3529.095215 0.622593
  685 +3532.952148 0.614592
  686 +3536.809082 0.609326
  687 +3540.666016 0.609761
  688 +3544.522949 0.6258
  689 +3548.379883 0.629168
  690 +3552.236816 0.623019
  691 +3556.09375 0.618341
  692 +3559.950684 0.619473
  693 +3563.807617 0.663041
  694 +3567.664551 0.680265
  695 +3571.521484 0.653292
  696 +3575.378418 0.637676
  697 +3579.235352 0.627736
  698 +3583.092285 0.647582
  699 +3586.949219 0.679846
  700 +3590.806152 0.673906
  701 +3594.663086 0.666062
  702 +3598.52002 0.659118
  703 +3602.376953 0.642123
  704 +3606.233887 0.662345
  705 +3610.09082 0.686657
  706 +3613.947754 0.699009
  707 +3617.804688 0.708261
  708 +3621.661621 0.677506
  709 +3625.518555 0.718444
  710 +3629.375488 0.775054
  711 +3633.232422 0.721214
  712 +3637.089355 0.668287
  713 +3640.946289 0.635247
  714 +3644.803223 0.693072
  715 +3648.660156 0.801296
  716 +3652.51709 0.782912
  717 +3656.374023 0.733296
  718 +3660.230957 0.668873
  719 +3664.087891 0.63726
  720 +3667.944824 0.688064
  721 +3671.801758 0.787399
  722 +3675.658691 0.837877
  723 +3679.515625 0.748979
  724 +3683.372559 0.700056
  725 +3687.229492 0.776031
  726 +3691.086426 0.78917
  727 +3694.943359 0.730333
  728 +3698.800293 0.715288
  729 +3702.657227 0.705007
  730 +3706.51416 0.722261
  731 +3710.371094 0.787614
  732 +3714.228027 0.76146
  733 +3718.084961 0.711827
  734 +3721.941895 0.71987
  735 +3725.798828 0.698932
  736 +3729.655762 0.71304
  737 +3733.512695 0.784518
  738 +3737.369629 0.77511
  739 +3741.226562 0.775089
  740 +3745.083496 0.865942
  741 +3748.94043 0.962277
  742 +3752.797363 0.942017
  743 +3756.654297 0.869403
  744 +3760.51123 0.822932
  745 +3764.368164 0.805583
  746 +3768.225098 0.818461
  747 +3772.082031 0.794773
  748 +3775.938965 0.773548
  749 +3779.795898 0.787632
  750 +3783.652832 0.773566
  751 +3787.509766 0.742363
  752 +3791.366699 0.706796
  753 +3795.223633 0.713586
  754 +3799.080566 0.779534
  755 +3802.9375 0.843259
  756 +3806.794434 0.824484
  757 +3810.651367 0.753229
  758 +3814.508301 0.766034
  759 +3818.365234 0.846253
  760 +3822.222168 0.86147
  761 +3826.079102 0.80157
  762 +3829.936035 0.755
  763 +3833.792969 0.791943
  764 +3837.649902 0.869714
  765 +3841.506836 0.868459
  766 +3845.36377 0.758025
  767 +3849.220703 0.758536
  768 +3853.077637 0.911496
0 769 \ No newline at end of file
... ...
kPolyethylene.txt 0 โ†’ 100644
  1 +nu k
  2 +898.665771 0.042801
  3 +902.522705 0.038246
  4 +906.379639 0.040294
  5 +910.236572 0.039488
  6 +914.093506 0.037618
  7 +917.950439 0.03536
  8 +921.807373 0.03278
  9 +925.664307 0.03156
  10 +929.52124 0.028804
  11 +933.378174 0.032099
  12 +937.235107 0.031952
  13 +941.092041 0.033633
  14 +944.948975 0.036991
  15 +948.805908 0.040887
  16 +952.662842 0.044517
  17 +956.519775 0.043966
  18 +960.376709 0.044863
  19 +964.233643 0.044314
  20 +968.090576 0.045241
  21 +971.94751 0.043188
  22 +975.804443 0.039329
  23 +979.661377 0.034324
  24 +983.518311 0.027772
  25 +987.375244 0.024005
  26 +991.232178 0.018819
  27 +995.089111 0.017644
  28 +998.946045 0.01743
  29 +1002.802979 0.01892
  30 +1006.659912 0.022698
  31 +1010.516846 0.025522
  32 +1014.373779 0.027914
  33 +1018.230713 0.028447
  34 +1022.087646 0.030539
  35 +1025.94458 0.030134
  36 +1029.801514 0.030709
  37 +1033.658447 0.030649
  38 +1037.515381 0.027764
  39 +1041.372314 0.024089
  40 +1045.229248 0.017639
  41 +1049.086182 0.013155
  42 +1052.943115 0.007972
  43 +1056.800049 0.004678
  44 +1060.656982 0.002414
  45 +1064.513916 0.000656
  46 +1068.37085 0.000452
  47 +1072.227783 0.000186
  48 +1076.084717 0.00315
  49 +1079.94165 0.005205
  50 +1083.798584 0.009191
  51 +1087.655518 0.012551
  52 +1091.512451 0.013487
  53 +1095.369385 0.01366
  54 +1099.226318 0.012324
  55 +1103.083252 0.011624
  56 +1106.940186 0.009228
  57 +1110.797119 0.007841
  58 +1114.654053 0.005534
  59 +1118.510986 0.003409
  60 +1122.36792 0.001855
  61 +1126.224854 0
  62 +1130.081787 0.000719
  63 +1133.938721 0.001989
  64 +1137.795654 0.005403
  65 +1141.652588 0.008195
  66 +1145.509521 0.012699
  67 +1149.366455 0.01768
  68 +1153.223389 0.021147
  69 +1157.080322 0.025829
  70 +1160.937256 0.029061
  71 +1164.794189 0.032397
  72 +1168.651123 0.034385
  73 +1172.508057 0.036836
  74 +1176.36499 0.03735
  75 +1180.221924 0.035023
  76 +1184.078857 0.033782
  77 +1187.935791 0.032161
  78 +1191.792725 0.032158
  79 +1195.649658 0.031863
  80 +1199.506592 0.033038
  81 +1203.363525 0.035069
  82 +1207.220459 0.037485
  83 +1211.077393 0.041366
  84 +1214.934326 0.045119
  85 +1218.79126 0.04902
  86 +1222.648193 0.050622
  87 +1226.505249 0.053244
  88 +1230.362061 0.054526
  89 +1234.219116 0.054043
  90 +1238.07605 0.053686
  91 +1241.932861 0.051393
  92 +1245.789917 0.049385
  93 +1249.646851 0.045921
  94 +1253.503784 0.043153
  95 +1257.360718 0.041048
  96 +1261.217651 0.039754
  97 +1265.074585 0.038579
  98 +1268.931519 0.037209
  99 +1272.788452 0.037321
  100 +1276.645386 0.036889
  101 +1280.502319 0.038267
  102 +1284.359253 0.039353
  103 +1288.216187 0.040998
  104 +1292.07312 0.042425
  105 +1295.930054 0.04231
  106 +1299.786987 0.042156
  107 +1303.643921 0.04027
  108 +1307.500854 0.038994
  109 +1311.357788 0.035638
  110 +1315.214722 0.031839
  111 +1319.071655 0.027074
  112 +1322.928589 0.022097
  113 +1326.785522 0.019314
  114 +1330.642456 0.016466
  115 +1334.49939 0.01724
  116 +1338.356323 0.019304
  117 +1342.213257 0.020191
  118 +1346.07019 0.020463
  119 +1349.927124 0.022886
  120 +1353.784058 0.024824
  121 +1357.640991 0.026467
  122 +1361.497925 0.032192
  123 +1365.354858 0.03319
  124 +1369.211792 0.032069
  125 +1373.068726 0.029896
  126 +1376.925659 0.025182
  127 +1380.782593 0.020386
  128 +1384.639526 0.01788
  129 +1388.49646 0.017692
  130 +1392.353394 0.01595
  131 +1396.210327 0.018172
  132 +1400.067261 0.017101
  133 +1403.924194 0.01655
  134 +1407.781128 0.018251
  135 +1411.638062 0.019087
  136 +1415.494995 0.025939
  137 +1419.351929 0.030871
  138 +1423.208862 0.033849
  139 +1427.065796 0.035628
  140 +1430.922729 0.0422
  141 +1434.779663 0.051804
  142 +1438.636597 0.054932
  143 +1442.49353 0.058626
  144 +1446.350464 0.063101
  145 +1450.207397 0.074238
  146 +1454.064331 0.099416
  147 +1457.921265 0.209105
  148 +1461.778198 0.321291
  149 +1465.635132 0.28369
  150 +1469.492065 0.267381
  151 +1473.348999 0.253731
  152 +1477.205933 0.128331
  153 +1481.062866 0.06213
  154 +1484.9198 0.05394
  155 +1488.776733 0.057298
  156 +1492.633667 0.056345
  157 +1496.490601 0.05445
  158 +1500.347534 0.054085
  159 +1504.204468 0.058144
  160 +1508.061401 0.064828
  161 +1511.918335 0.055856
  162 +1515.775269 0.052929
  163 +1519.632202 0.059563
  164 +1523.489136 0.05584
  165 +1527.346069 0.048296
  166 +1531.203003 0.043625
  167 +1535.059937 0.046385
  168 +1538.91687 0.056596
  169 +1542.773804 0.054466
  170 +1546.630737 0.043963
  171 +1550.487671 0.041193
  172 +1554.344604 0.048176
  173 +1558.201538 0.058085
  174 +1562.058472 0.049177
  175 +1565.915405 0.041398
  176 +1569.772339 0.042723
  177 +1573.629272 0.042759
  178 +1577.486206 0.040069
  179 +1581.34314 0.034118
  180 +1585.200073 0.031186
  181 +1589.057007 0.031601
  182 +1592.91394 0.030593
  183 +1596.770874 0.030831
  184 +1600.627808 0.028967
  185 +1604.484741 0.02833
  186 +1608.341675 0.028289
  187 +1612.198608 0.028776
  188 +1616.055542 0.033643
  189 +1619.912476 0.034205
  190 +1623.769409 0.035702
  191 +1627.626343 0.033927
  192 +1631.483276 0.034108
  193 +1635.34021 0.042011
  194 +1639.197144 0.038127
  195 +1643.054077 0.036647
  196 +1646.911011 0.04247
  197 +1650.767944 0.048308
  198 +1654.624878 0.045178
  199 +1658.481812 0.034997
  200 +1662.338745 0.034021
  201 +1666.195679 0.036197
  202 +1670.052612 0.038175
  203 +1673.909546 0.039106
  204 +1677.766479 0.037529
  205 +1681.623413 0.045005
  206 +1685.480347 0.05006
  207 +1689.33728 0.044082
  208 +1693.194214 0.045592
  209 +1697.051147 0.057514
  210 +1700.908081 0.061893
  211 +1704.765015 0.056482
  212 +1708.621948 0.051541
  213 +1712.478882 0.053415
  214 +1716.335815 0.061049
  215 +1720.192749 0.056453
  216 +1724.049683 0.049607
  217 +1727.906738 0.05118
  218 +1731.76355 0.05872
  219 +1735.620605 0.061749
  220 +1739.477539 0.058433
  221 +1743.334473 0.058925
  222 +1747.191406 0.06168
  223 +1751.04834 0.061892
  224 +1754.905273 0.058246
  225 +1758.762207 0.058189
  226 +1762.619141 0.059579
  227 +1766.476074 0.060041
  228 +1770.333008 0.066851
  229 +1774.189941 0.066629
  230 +1778.046875 0.063365
  231 +1781.903809 0.063274
  232 +1785.760742 0.061577
  233 +1789.617676 0.063319
  234 +1793.474609 0.063621
  235 +1797.331543 0.061639
  236 +1801.188477 0.060149
  237 +1805.04541 0.057813
  238 +1808.902344 0.056311
  239 +1812.759277 0.054928
  240 +1816.616211 0.053613
  241 +1820.473145 0.053938
  242 +1824.330078 0.057278
  243 +1828.187012 0.060054
  244 +1832.043945 0.058871
  245 +1835.900879 0.056005
  246 +1839.757812 0.056531
  247 +1843.614746 0.059206
  248 +1847.47168 0.057401
  249 +1851.328613 0.054448
  250 +1855.185547 0.053538
  251 +1859.04248 0.051986
  252 +1862.899414 0.050818
  253 +1866.756348 0.053157
  254 +1870.613281 0.051802
  255 +1874.470215 0.04774
  256 +1878.327148 0.047584
  257 +1882.184082 0.047928
  258 +1886.041016 0.05107
  259 +1889.897949 0.055251
  260 +1893.754883 0.056678
  261 +1897.611816 0.056701
  262 +1901.46875 0.056308
  263 +1905.325684 0.057764
  264 +1909.182617 0.058333
  265 +1913.039551 0.058837
  266 +1916.896484 0.061175
  267 +1920.753418 0.061958
  268 +1924.610352 0.06037
  269 +1928.467285 0.058767
  270 +1932.324219 0.058077
  271 +1936.181152 0.05759
  272 +1940.038086 0.058999
  273 +1943.89502 0.060248
  274 +1947.751953 0.060227
  275 +1951.608887 0.06155
  276 +1955.46582 0.064083
  277 +1959.322754 0.066146
  278 +1963.179688 0.068457
  279 +1967.036621 0.070872
  280 +1970.893555 0.07175
  281 +1974.750488 0.073
  282 +1978.607422 0.074496
  283 +1982.464355 0.076088
  284 +1986.321289 0.077477
  285 +1990.178223 0.077673
  286 +1994.035156 0.078181
  287 +1997.89209 0.077858
  288 +2001.749023 0.077439
  289 +2005.605957 0.077198
  290 +2009.462891 0.078891
  291 +2013.319824 0.082924
  292 +2017.176758 0.085872
  293 +2021.033691 0.087082
  294 +2024.890625 0.087384
  295 +2028.747559 0.08829
  296 +2032.604492 0.08848
  297 +2036.461426 0.088407
  298 +2040.318359 0.089069
  299 +2044.175293 0.089026
  300 +2048.032227 0.088623
  301 +2051.88916 0.087477
  302 +2055.746094 0.08616
  303 +2059.603027 0.083997
  304 +2063.459961 0.081664
  305 +2067.316895 0.079261
  306 +2071.173828 0.077244
  307 +2075.030762 0.076483
  308 +2078.887695 0.075797
  309 +2082.744629 0.075846
  310 +2086.601562 0.075997
  311 +2090.458496 0.076488
  312 +2094.31543 0.076722
  313 +2098.172363 0.077003
  314 +2102.029297 0.077852
  315 +2105.88623 0.077923
  316 +2109.743164 0.078499
  317 +2113.600098 0.0785
  318 +2117.457031 0.078399
  319 +2121.313965 0.077331
  320 +2125.170898 0.075105
  321 +2129.027832 0.073147
  322 +2132.884766 0.070562
  323 +2136.741699 0.068282
  324 +2140.598633 0.067026
  325 +2144.455566 0.066793
  326 +2148.3125 0.06594
  327 +2152.169434 0.065716
  328 +2156.026367 0.067029
  329 +2159.883301 0.069187
  330 +2163.740234 0.072229
  331 +2167.597168 0.073334
  332 +2171.454102 0.07447
  333 +2175.311035 0.076316
  334 +2179.167969 0.077651
  335 +2183.024902 0.077775
  336 +2186.881836 0.076711
  337 +2190.73877 0.07568
  338 +2194.595703 0.074338
  339 +2198.452637 0.073547
  340 +2202.30957 0.072207
  341 +2206.166504 0.070938
  342 +2210.023438 0.071166
  343 +2213.880371 0.072989
  344 +2217.737305 0.075587
  345 +2221.594238 0.077353
  346 +2225.451172 0.079876
  347 +2229.308105 0.082352
  348 +2233.165039 0.086501
  349 +2237.021973 0.091213
  350 +2240.878906 0.093793
  351 +2244.73584 0.096032
  352 +2248.592773 0.096721
  353 +2252.449707 0.096175
  354 +2256.306641 0.096046
  355 +2260.163574 0.095994
  356 +2264.020508 0.095129
  357 +2267.877441 0.094074
  358 +2271.734375 0.093223
  359 +2275.591309 0.092793
  360 +2279.448242 0.09338
  361 +2283.305176 0.094035
  362 +2287.162109 0.096031
  363 +2291.019043 0.098612
  364 +2294.875977 0.101782
  365 +2298.73291 0.104571
  366 +2302.589844 0.106189
  367 +2306.446777 0.108411
  368 +2310.303711 0.111481
  369 +2314.160645 0.115452
  370 +2318.017578 0.1163
  371 +2321.874512 0.116496
  372 +2325.731445 0.117256
  373 +2329.588379 0.117223
  374 +2333.445312 0.118796
  375 +2337.302246 0.118167
  376 +2341.15918 0.120538
  377 +2345.016113 0.115249
  378 +2348.873047 0.105582
  379 +2352.72998 0.106231
  380 +2356.586914 0.117235
  381 +2360.443848 0.125922
  382 +2364.300781 0.125306
  383 +2368.157715 0.127072
  384 +2372.014648 0.127012
  385 +2375.871582 0.116702
  386 +2379.728516 0.10674
  387 +2383.585449 0.101542
  388 +2387.442383 0.098892
  389 +2391.299316 0.096576
  390 +2395.15625 0.094014
  391 +2399.013184 0.091325
  392 +2402.870117 0.088611
  393 +2406.727051 0.085887
  394 +2410.583984 0.084275
  395 +2414.440918 0.083137
  396 +2418.297852 0.082863
  397 +2422.154785 0.083674
  398 +2426.011719 0.083869
  399 +2429.868652 0.084283
  400 +2433.725586 0.085037
  401 +2437.58252 0.086494
  402 +2441.439453 0.087925
  403 +2445.296387 0.08872
  404 +2449.15332 0.088704
  405 +2453.010254 0.088184
  406 +2456.867432 0.088997
  407 +2460.724121 0.088295
  408 +2464.581299 0.086279
  409 +2468.437988 0.084932
  410 +2472.294922 0.083665
  411 +2476.1521 0.0818
  412 +2480.008789 0.080394
  413 +2483.865967 0.080496
  414 +2487.7229 0.080721
  415 +2491.579834 0.082332
  416 +2495.436768 0.084785
  417 +2499.293701 0.087751
  418 +2503.150635 0.090758
  419 +2507.007568 0.092693
  420 +2510.864502 0.095352
  421 +2514.721436 0.098152
  422 +2518.578369 0.100501
  423 +2522.435303 0.101241
  424 +2526.292236 0.100269
  425 +2530.14917 0.097869
  426 +2534.006104 0.095432
  427 +2537.863037 0.093501
  428 +2541.719971 0.092148
  429 +2545.576904 0.093745
  430 +2549.433838 0.095068
  431 +2553.290771 0.095236
  432 +2557.147705 0.095116
  433 +2561.004639 0.095723
  434 +2564.861572 0.098358
  435 +2568.718506 0.100349
  436 +2572.575439 0.102338
  437 +2576.432373 0.104696
  438 +2580.289307 0.107025
  439 +2584.14624 0.108889
  440 +2588.003174 0.110354
  441 +2591.860107 0.110847
  442 +2595.717041 0.110923
  443 +2599.573975 0.110253
  444 +2603.430908 0.10792
  445 +2607.287842 0.108422
  446 +2611.144775 0.110512
  447 +2615.001709 0.112134
  448 +2618.858643 0.111506
  449 +2622.715576 0.111099
  450 +2626.57251 0.11527
  451 +2630.429443 0.118538
  452 +2634.286377 0.121323
  453 +2638.143311 0.122503
  454 +2642.000244 0.121947
  455 +2645.857178 0.122436
  456 +2649.714111 0.122898
  457 +2653.571045 0.123706
  458 +2657.427979 0.12365
  459 +2661.284912 0.123909
  460 +2665.141846 0.12298
  461 +2668.998779 0.121291
  462 +2672.855713 0.118508
  463 +2676.712646 0.113969
  464 +2680.56958 0.112845
  465 +2684.426514 0.11388
  466 +2688.283447 0.115424
  467 +2692.140381 0.115946
  468 +2695.997314 0.116087
  469 +2699.854248 0.11892
  470 +2703.711182 0.123892
  471 +2707.568115 0.127081
  472 +2711.425049 0.127712
  473 +2715.281982 0.129201
  474 +2719.138916 0.130355
  475 +2722.99585 0.132832
  476 +2726.852783 0.136051
  477 +2730.709717 0.137992
  478 +2734.56665 0.139079
  479 +2738.423584 0.139874
  480 +2742.280518 0.142823
  481 +2746.137451 0.14439
  482 +2749.994385 0.144809
  483 +2753.851318 0.146405
  484 +2757.708252 0.149177
  485 +2761.565186 0.152907
  486 +2765.422119 0.156536
  487 +2769.279053 0.160128
  488 +2773.135986 0.163716
  489 +2776.99292 0.170169
  490 +2780.849854 0.176736
  491 +2784.706787 0.182123
  492 +2788.563721 0.18825
  493 +2792.420654 0.195435
  494 +2796.277588 0.203335
  495 +2800.134521 0.209338
  496 +2803.991455 0.216905
  497 +2807.848389 0.224688
  498 +2811.705322 0.231271
  499 +2815.562256 0.240789
  500 +2819.419189 0.252931
  501 +2823.276123 0.268691
  502 +2827.133057 0.288805
  503 +2830.98999 0.319675
  504 +2834.846924 0.37317
  505 +2838.703857 0.490491
  506 +2842.560791 0.752726
  507 +2846.417725 1.278588
  508 +2850.274658 3.547169
  509 +2854.131592 1.864663
  510 +2857.988525 1.020072
  511 +2861.845459 0.678025
  512 +2865.702393 0.520933
  513 +2869.559326 0.455058
  514 +2873.41626 0.442317
  515 +2877.273193 0.468809
  516 +2881.130127 0.52601
  517 +2884.987061 0.601824
  518 +2888.843994 0.6806
  519 +2892.700928 0.756426
  520 +2896.557861 0.831596
  521 +2900.414795 0.907269
  522 +2904.271729 1.0234
  523 +2908.128662 1.20281
  524 +2911.985596 1.481329
  525 +2915.842529 2.010163
  526 +2919.699463 8.159303
  527 +2923.556396 8.159303
  528 +2927.41333 8.159303
  529 +2931.270264 8.159303
  530 +2935.127197 1.344721
  531 +2938.984131 0.846779
  532 +2942.841064 0.599405
  533 +2946.697998 0.462005
  534 +2950.554932 0.384985
  535 +2954.411865 0.339581
  536 +2958.268799 0.311217
  537 +2962.125732 0.293415
  538 +2965.982666 0.280584
  539 +2969.8396 0.266669
  540 +2973.696533 0.25436
  541 +2977.553467 0.24508
  542 +2981.4104 0.238963
  543 +2985.267334 0.23609
  544 +2989.124268 0.234872
  545 +2992.981201 0.233873
  546 +2996.838135 0.232613
  547 +3000.695068 0.233535
  548 +3004.552002 0.233868
  549 +3008.408936 0.232737
  550 +3012.265869 0.233329
  551 +3016.122803 0.234665
  552 +3019.979736 0.235345
  553 +3023.83667 0.236011
  554 +3027.693604 0.236947
  555 +3031.550537 0.238511
  556 +3035.407471 0.241039
  557 +3039.264404 0.240936
  558 +3043.121338 0.239143
  559 +3046.978271 0.238718
  560 +3050.835205 0.24097
  561 +3054.692139 0.245612
  562 +3058.549072 0.247351
  563 +3062.406006 0.247046
  564 +3066.262939 0.248492
  565 +3070.119873 0.251256
  566 +3073.976807 0.25365
  567 +3077.83374 0.253988
  568 +3081.690674 0.252814
  569 +3085.547607 0.253247
  570 +3089.404541 0.256518
  571 +3093.261475 0.257485
  572 +3097.118408 0.256107
  573 +3100.975342 0.258556
  574 +3104.832275 0.261868
  575 +3108.689209 0.262195
  576 +3112.546143 0.26374
  577 +3116.403076 0.264531
  578 +3120.26001 0.266315
  579 +3124.116943 0.271453
  580 +3127.973877 0.272884
  581 +3131.830811 0.273801
  582 +3135.687744 0.274658
  583 +3139.544678 0.27568
  584 +3143.401611 0.278555
  585 +3147.258545 0.278531
  586 +3151.115479 0.280644
  587 +3154.972412 0.282855
  588 +3158.829346 0.282387
  589 +3162.686279 0.283106
  590 +3166.543213 0.285258
  591 +3170.400146 0.287859
  592 +3174.25708 0.2904
  593 +3178.114014 0.294073
  594 +3181.970947 0.292664
  595 +3185.827881 0.291102
  596 +3189.684814 0.295654
  597 +3193.541748 0.300153
  598 +3197.398682 0.304076
  599 +3201.255615 0.304851
  600 +3205.112549 0.304563
  601 +3208.969482 0.305357
  602 +3212.826416 0.306796
  603 +3216.68335 0.310194
  604 +3220.540283 0.31221
  605 +3224.397217 0.313876
  606 +3228.25415 0.314126
  607 +3232.111084 0.313369
  608 +3235.968018 0.315882
  609 +3239.824951 0.317707
  610 +3243.681885 0.31754
  611 +3247.538818 0.319288
  612 +3251.395752 0.321948
  613 +3255.252686 0.324138
  614 +3259.109619 0.326708
  615 +3262.966553 0.32804
  616 +3266.823486 0.3278
  617 +3270.68042 0.329835
  618 +3274.537354 0.33465
  619 +3278.394287 0.337762
  620 +3282.251221 0.340154
  621 +3286.108154 0.342881
  622 +3289.965088 0.345075
  623 +3293.822021 0.347906
  624 +3297.678955 0.350114
  625 +3301.535889 0.351199
  626 +3305.392822 0.351983
  627 +3309.249756 0.3562
  628 +3313.106689 0.36275
  629 +3316.963623 0.366295
  630 +3320.820557 0.36812
  631 +3324.67749 0.370943
  632 +3328.534424 0.373606
  633 +3332.391357 0.374156
  634 +3336.248291 0.377316
  635 +3340.105225 0.381299
  636 +3343.962158 0.382803
  637 +3347.819092 0.384863
  638 +3351.676025 0.387344
  639 +3355.532959 0.391755
  640 +3359.389893 0.396881
  641 +3363.246826 0.401809
  642 +3367.10376 0.40365
  643 +3370.960693 0.405394
  644 +3374.817627 0.408003
  645 +3378.674561 0.406788
  646 +3382.531494 0.410868
  647 +3386.388428 0.416363
  648 +3390.245361 0.418181
  649 +3394.102295 0.418514
  650 +3397.959229 0.420373
  651 +3401.816162 0.425953
  652 +3405.673096 0.427757
  653 +3409.530029 0.430295
  654 +3413.386963 0.432285
  655 +3417.243896 0.4355
  656 +3421.10083 0.440059
  657 +3424.957764 0.438144
  658 +3428.814697 0.438745
  659 +3432.671631 0.440176
  660 +3436.528564 0.441479
  661 +3440.385498 0.446113
  662 +3444.242432 0.454693
  663 +3448.099609 0.458408
  664 +3451.956299 0.453192
  665 +3455.813232 0.453524
  666 +3459.67041 0.454045
  667 +3463.5271 0.453562
  668 +3467.384277 0.454329
  669 +3471.241211 0.453832
  670 +3475.098145 0.455571
  671 +3478.955078 0.458273
  672 +3482.812012 0.463572
  673 +3486.668945 0.467153
  674 +3490.525879 0.468294
  675 +3494.382812 0.467316
  676 +3498.239746 0.46946
  677 +3502.09668 0.476743
  678 +3505.953613 0.480509
  679 +3509.810547 0.481056
  680 +3513.66748 0.477007
  681 +3517.524414 0.476513
  682 +3521.381348 0.48312
  683 +3525.238281 0.494273
  684 +3529.095215 0.498595
  685 +3532.952148 0.489976
  686 +3536.809082 0.483772
  687 +3540.666016 0.483548
  688 +3544.522949 0.497348
  689 +3548.379883 0.507212
  690 +3552.236816 0.503781
  691 +3556.09375 0.497842
  692 +3559.950684 0.492978
  693 +3563.807617 0.529133
  694 +3567.664551 0.56289
  695 +3571.521484 0.538575
  696 +3575.378418 0.509557
  697 +3579.235352 0.488392
  698 +3583.092285 0.49707
  699 +3586.949219 0.539608
  700 +3590.806152 0.551493
  701 +3594.663086 0.545023
  702 +3598.52002 0.545352
  703 +3602.376953 0.531468
  704 +3606.233887 0.545
  705 +3610.09082 0.574529
  706 +3613.947754 0.583345
  707 +3617.804688 0.601032
  708 +3621.661621 0.576763
  709 +3625.518555 0.59285
  710 +3629.375488 0.666404
  711 +3633.232422 0.629983
  712 +3637.089355 0.574148
  713 +3640.946289 0.534971
  714 +3644.803223 0.56094
  715 +3648.660156 0.676182
  716 +3652.51709 0.677093
  717 +3656.374023 0.626823
  718 +3660.230957 0.571434
  719 +3664.087891 0.525168
  720 +3667.944824 0.557497
  721 +3671.801758 0.650441
  722 +3675.658691 0.720812
  723 +3679.515625 0.656422
  724 +3683.372559 0.584071
  725 +3687.229492 0.639159
  726 +3691.086426 0.689051
  727 +3694.943359 0.635556
  728 +3698.800293 0.611035
  729 +3702.657227 0.600736
  730 +3706.51416 0.59881
  731 +3710.371094 0.659889
  732 +3714.228027 0.659443
  733 +3718.084961 0.602004
  734 +3721.941895 0.604124
  735 +3725.798828 0.590578
  736 +3729.655762 0.583357
  737 +3733.512695 0.655091
  738 +3737.369629 0.667907
  739 +3741.226562 0.649775
  740 +3745.083496 0.722164
  741 +3748.94043 0.828452
  742 +3752.797363 0.834798
  743 +3756.654297 0.7622
  744 +3760.51123 0.704227
  745 +3764.368164 0.680495
  746 +3768.225098 0.692232
  747 +3772.082031 0.675462
  748 +3775.938965 0.640782
  749 +3779.795898 0.651172
  750 +3783.652832 0.648195
  751 +3787.509766 0.620286
  752 +3791.366699 0.587595
  753 +3795.223633 0.584694
  754 +3799.080566 0.646239
  755 +3802.9375 0.710322
  756 +3806.794434 0.709429
  757 +3810.651367 0.642264
  758 +3814.508301 0.626551
  759 +3818.365234 0.709295
  760 +3822.222168 0.752153
  761 +3826.079102 0.703719
  762 +3829.936035 0.641066
  763 +3833.792969 0.653867
  764 +3837.649902 0.732171
  765 +3841.506836 0.760431
  766 +3845.36377 0.661533
  767 +3849.220703 0.611614
  768 +3853.077637 0.757909
0 769 \ No newline at end of file
... ...
main.cpp
... ... @@ -8,15 +8,19 @@ using namespace std;
8 8 #include <QGraphicsPixmapItem>
9 9 #include <QLayout>
10 10 #include "qtSpectrumDisplay.h"
  11 +//#include "qwtSpectrumDisplay.h"
11 12 #include "globals.h"
12 13 #include "rtsGUIConsole.h"
13 14 #include "PerformanceData.h"
14 15 #include <complex>
  16 +#include <sstream>
15 17 //#include <direct.h>
16 18  
  19 +
17 20 PerformanceData PD;
18 21  
19 22 qtSpectrumDisplay* gpSpectrumDisplay;
  23 +//qwtSpectrumDisplay* SpectrumDisplay;
20 24  
21 25 QGraphicsScene* distortionScene = NULL;
22 26 QGraphicsView* distortionWindow = NULL;
... ... @@ -43,6 +47,9 @@ double dNu = 2;
43 47 double aMin = 0;
44 48 double aMax = 1;
45 49  
  50 +double nMag = 1.0;
  51 +double kMax = 1.0;
  52 +
46 53 double scaleI0 = 1.0;
47 54 double refSlope = 0.0;
48 55  
... ... @@ -67,7 +74,7 @@ double cA = 1.0;
67 74 //vector<SpecPair> NMaterial;
68 75 bool applyMaterial = true;
69 76 vector<Material> MaterialList;
70   -int currentMaterial = 0;
  77 +int currentMaterial = -1;
71 78  
72 79 //optical parameters
73 80 double cNAi = 0.0;
... ... @@ -91,93 +98,106 @@ void TempSimSpectrum()
91 98 temp.A = sin((double)i/200);
92 99 SimSpectrum.push_back(temp);
93 100 }
94   -}
  101 + }
95 102  
96   -void UpdateDisplay(){
  103 + void UpdateDisplay() {
97 104 gpSpectrumDisplay->updateGL();
  105 + //SpectrumDisplay->replot();
98 106 }
99 107  
100   -void LoadMaterial(string fileNameK, string fileNameN, string materialName)
  108 +void LoadMaterial(string fileName, string materialName)
101 109 {
102   - Material newMaterial;
103   - newMaterial.name = materialName;
104   -
105   - vector<SpecPair> KMaterial = LoadSpectrum(fileNameK.c_str());
106   - vector<SpecPair> NMaterial = LoadSpectrum(fileNameN.c_str());
107   -
108   - //make sure that the sizes are the same
109   - if(KMaterial.size() != NMaterial.size()){
110   - cout<<"Error, material properties don't match."<<endl;
111   - exit(1);
  110 + //open the file
  111 + ifstream inFile(fileName.c_str());
  112 + if(!inFile)
  113 + {
  114 + cout<<"Error loading material: "<<fileName<<endl;
  115 + return;
112 116 }
113 117  
114   - complex<double> eta;
115   - //int j;
116   - for(unsigned int i=0; i<KMaterial.size(); i++){
117   - newMaterial.nu.push_back(KMaterial[i].nu);
118   - eta = complex<double>(NMaterial[i].A, KMaterial[i].A);
119   - newMaterial.eta.push_back(eta);
  118 + Material newMaterial;
  119 + newMaterial.validN = false;
  120 + newMaterial.validK = false;
  121 + //read the header
  122 + string units;
  123 + getline(inFile, units, '\t');
  124 + char c = 0;
  125 + while(c != '\n')
  126 + {
  127 + inFile.get(c);
  128 + if(c == 'n') newMaterial.validN = true;
  129 + if(c == 'k') newMaterial.validK = true;
120 130 }
121   - MaterialList.push_back(newMaterial);
122   -}
123   -
124   -void LoadMaterial(string fileNameK, string materialName){
125 131  
126   - //load the material absorbance
127   - vector<SpecPair> KMaterial = LoadSpectrum(fileNameK.c_str());
128   - vector<SpecPair> NMaterial;
129   - //KMaterial = LoadSpectrum("eta_TolueneK.txt");
  132 + //read the entire refractive index (both real and imaginary)
  133 + float nu;
  134 + float n;
  135 + float k;
130 136  
131   - //compute the real IR using Kramers Kronig
132   - //copy the absorbance values into a linear array
133   - double* k = (double*)malloc(sizeof(double) * KMaterial.size());
134   - double* n = (double*)malloc(sizeof(double) * KMaterial.size());
135   - for(unsigned int i=0; i<KMaterial.size(); i++)
136   - k[i] = KMaterial[i].A;
  137 + while(inFile>>nu)
  138 + {
  139 + n = 1.0;
  140 + k = 0.0;
  141 + if(newMaterial.validN)
  142 + inFile>>n;
  143 + if(newMaterial.validK)
  144 + inFile>>k;
  145 + //ignore the rest of the line
  146 + inFile.ignore();
  147 +
  148 + newMaterial.nu.push_back(nu);
  149 + newMaterial.eta.push_back(complex<double>(n, k));
  150 + }
137 151  
138   - //use Kramers Kronig to determine the real part of the index of refraction
139   - cudaKramersKronig(n, k, KMaterial.size(), KMaterial[0].nu, KMaterial.back().nu, baseIR);
140   - SpecPair temp;
141   - for(unsigned int i=0; i<KMaterial.size(); i++)
  152 + //iterate through the material to compute the necessary bounds for display
  153 + float minN = 9999;
  154 + float maxN = -9999;
  155 + float sumN = 0;
  156 + float maxK = 0;
  157 + for(int i = 0; i<newMaterial.nu.size(); i++)
142 158 {
143   - temp.nu = KMaterial[i].nu;
144   - temp.A = n[i];
145   - NMaterial.push_back(temp);
  159 + n = newMaterial.eta[i].real();
  160 + k = newMaterial.eta[i].imag();
  161 +
  162 + if(n < minN) minN = n;
  163 + if(n > maxN) maxN = n;
  164 + if(k > maxK) maxK = k;
  165 + sumN += n;
146 166 }
  167 + float meanN = sumN / newMaterial.nu.size();
147 168  
148   - //create the material
149   - Material newMaterial;
  169 + nMag = max(maxN - meanN, meanN - minN);
  170 + kMax = maxK;
  171 + baseIR = meanN;
  172 +
  173 + //set the name of the material object
150 174 newMaterial.name = materialName;
151   - complex<double> eta;
152   - for(unsigned int i=0; i<KMaterial.size(); i++){
153   - newMaterial.nu.push_back(KMaterial[i].nu);
154   - eta = complex<double>(NMaterial[i].A, KMaterial[i].A);
155   - newMaterial.eta.push_back(eta);
156   - }
157 175  
  176 + //add it to the material list
158 177 MaterialList.push_back(newMaterial);
  178 + currentMaterial = MaterialList.size() - 1;
159 179 }
160 180  
161 181 void LoadSource(string fileNameSource)
162 182 {
163   - SourceSpectrum = LoadSpectrum(fileNameSource);
  183 + SourceSpectrum = LoadSpectrum(fileNameSource);
164 184 }
165 185  
166 186 void ResampleSource()
167 187 {
168 188 //clear the current resampled spectrum
169 189 SourceResampled.clear();
170   -
  190 +
171 191 //get the number of source and material samples
172 192 int nMatSamples = EtaK.size();
173 193 int nSourceSamples = SourceSpectrum.size();
174   -
  194 +
175 195 float nu, I;
176 196 for(int i=0; i<nMatSamples; i++)
177 197 {
178 198 SpecPair newSample;
179 199 newSample.nu = EtaK[i].nu;
180   -
  200 +
181 201 //iterate through the SourceSpectrum to find the bounding wavelengths
182 202 if(newSample.nu < SourceSpectrum[0].nu)
183 203 newSample.A = 0.0;
... ... @@ -188,20 +208,20 @@ void ResampleSource()
188 208 int k=1;
189 209 while(SourceSpectrum[k].nu < newSample.nu)
190 210 k++;
191   -
  211 +
192 212 //interpolate
193 213 float a = (newSample.nu - SourceSpectrum[k-1].nu)/(SourceSpectrum[k].nu - SourceSpectrum[k-1].nu);
194 214 newSample.A = a * SourceSpectrum[k].A + (1.0 - a) * SourceSpectrum[k-1].A;
195 215 }
196   -
  216 +
197 217 //insert the new spectral point into the resampled spectrum
198 218 SourceResampled.push_back(newSample);
199 219 //cout<<newSample.nu<<" "<<newSample.A<<endl;
200 220 }
201   -
  221 +
202 222 }
203 223  
204   -void FitDisplay(){
  224 +void FitDisplay() {
205 225 double minA = 99999.0;
206 226 double maxA = -99999.0;
207 227 double k, n;
... ... @@ -265,7 +285,7 @@ void FitDisplay(){
265 285 UpdateDisplay();
266 286 }
267 287  
268   -void ChangeAbsorbance(){
  288 +void ChangeAbsorbance() {
269 289  
270 290 //compute the real part of the index of refraction
271 291  
... ... @@ -289,9 +309,9 @@ void ChangeAbsorbance(){
289 309  
290 310 //load the imaginary IR from the absorbance data
291 311 double nu;
292   - for(int i=0; i<nSamples; i++){
  312 + for(int i=0; i<nSamples; i++) {
293 313 nu = MaterialList[currentMaterial].nu[i];
294   - if(nu >= nuMin && nu <= nuMax){
  314 + if(nu >= nuMin && nu <= nuMax) {
295 315 temp.nu = nu;
296 316 temp.A = k[i];
297 317 EtaK.push_back(temp);
... ... @@ -309,6 +329,7 @@ void SetMaterial()
309 329 {
310 330 EtaK.clear();
311 331 EtaN.clear();
  332 + if(currentMaterial == -1) return;
312 333  
313 334 int nSamples = MaterialList[currentMaterial].eta.size();
314 335 double nu;
... ... @@ -317,7 +338,7 @@ void SetMaterial()
317 338 //initialize the current nuMin and nuMax values
318 339 nuMin = MaterialList[currentMaterial].nu[0];
319 340 nuMax = nuMin;
320   - for(int i=0; i<nSamples; i++){
  341 + for(int i=0; i<nSamples; i++) {
321 342 nu = MaterialList[currentMaterial].nu[i];
322 343 //if(nu >= nuMin && nu <= nuMax){
323 344  
... ... @@ -325,14 +346,14 @@ void SetMaterial()
325 346 if(nu < nuMin) nuMin = nu;
326 347 if(nu > nuMax) nuMax = nu;
327 348  
328   - temp.nu = nu;
329   - temp.A = MaterialList[currentMaterial].eta[i].imag();
330   - EtaK.push_back(temp);
331   - temp.A = MaterialList[currentMaterial].eta[i].real();
332   - EtaN.push_back(temp);
  349 + temp.nu = nu;
  350 + temp.A = MaterialList[currentMaterial].eta[i].imag();
  351 + EtaK.push_back(temp);
  352 + temp.A = MaterialList[currentMaterial].eta[i].real();
  353 + EtaN.push_back(temp);
333 354 }
334 355 cA = 1.0;
335   -
  356 +
336 357 //resample the source spectrum
337 358 if(SourceSpectrum.size() != 0)
338 359 ResampleSource();
... ... @@ -348,22 +369,33 @@ int main(int argc, char *argv[])
348 369 //load the default project file (any previous optical settings)
349 370 LoadState();
350 371  
  372 +
351 373 //load the default materials
352   - LoadMaterial("eta_TolueneK.txt", "eta_TolueneN.txt", "Toluene");
  374 + LoadMaterial("etaToluene.txt", "Toluene");
353 375 LoadMaterial("kPMMA.txt", "PMMA");
354   - LoadMaterial("eta_polystyreneK.txt", "Polystyrene");
  376 + LoadMaterial("kPolyethylene.txt", "Polyethylene");
  377 + LoadMaterial("kPTFE.txt", "Teflon");
  378 +
  379 +
  380 + //LoadMaterial("eta_TolueneK.txt", "eta_TolueneN.txt", "Toluene");
  381 + //LoadMaterial("kPMMA.txt", "PMMA");
  382 + //LoadMaterial("eta_polystyreneK.txt", "Polystyrene");
355 383 //LoadMaterial("../../../../data/materials/rtsSU8_k.txt", "../../../../data/materials/rtsSU8_n.txt", "SU8");
356 384 SetMaterial();
357   -
  385 +
  386 +
358 387 //load a mid-infrared source
359 388 LoadSource("source_midIR.txt");
  389 +
360 390 ResampleSource();
361 391  
362 392 //compute the analytical solution for the Mie scattered spectrum
363 393 SimulateSpectrum();
364 394  
365 395 QApplication a(argc, argv);
366   -
  396 +
  397 + //SpectrumDisplay = new qwtSpectrumDisplay();
  398 +
367 399 InteractiveMie w;
368 400 w.show() ;
369 401 w.move(0, 0);
... ... @@ -385,6 +417,8 @@ int main(int argc, char *argv[])
385 417 gpSpectrumDisplay->move(uiFrame.width(), 0);
386 418 gpSpectrumDisplay->show();
387 419  
  420 +
  421 +
388 422 //distortion dialog box
389 423 distortionDialog = new qtDistortionDialog();
390 424 distortionDialog->move(0, 0);
... ...
qtDistortionDialog.cpp
1   -#include "qtDistortionDialog.h"
2   -
3   -qtDistortionDialog::qtDistortionDialog(QWidget *parent, Qt::WFlags flags)
4   - : QDialog(parent, flags)
5   -{
6   - ui.setupUi(this);
7   -}
8   -
9   -qtDistortionDialog::~qtDistortionDialog()
10   -{
11   - updating = false;
  1 +#include "qtDistortionDialog.h"
  2 +
  3 +qtDistortionDialog::qtDistortionDialog(QWidget *parent, Qt::WFlags flags)
  4 + : QDialog(parent, flags)
  5 +{
  6 + ui.setupUi(this);
  7 +}
  8 +
  9 +qtDistortionDialog::~qtDistortionDialog()
  10 +{
  11 + updating = false;
12 12 }
... ...
qtDistortionDialog.h
... ... @@ -17,18 +17,18 @@ extern QGraphicsPixmapItem* pixmapItem;
17 17  
18 18 class qtDistortionDialog : public QDialog
19 19 {
20   - Q_OBJECT
  20 + Q_OBJECT
21 21  
22 22 public:
23   - qtDistortionDialog(QWidget *parent = 0, Qt::WFlags flags = 0);
24   - ~qtDistortionDialog();
25   - bool updating;
  23 + qtDistortionDialog(QWidget *parent = 0, Qt::WFlags flags = 0);
  24 + ~qtDistortionDialog();
  25 + bool updating;
26 26  
27 27 private:
28   - Ui::DistortionDialogClass ui;
  28 + Ui::DistortionDialogClass ui;
29 29  
30 30 public slots:
31   - void on_btnComputeDistortionMap_clicked(){
  31 + void on_btnComputeDistortionMap_clicked() {
32 32  
33 33 int steps = 100;
34 34  
... ... @@ -49,7 +49,7 @@ public slots:
49 49 //compute the extrema
50 50 float minDistortion = 99999;
51 51 float maxDistortion = distortionMap[0];
52   - for(int i=1; i<steps*steps; i++){
  52 + for(int i=1; i<steps*steps; i++) {
53 53 if(distortionMap[i] < minDistortion && distortionMap[i] > 0)
54 54 minDistortion = distortionMap[i];
55 55 if(distortionMap[i] > maxDistortion)
... ... @@ -62,11 +62,14 @@ public slots:
62 62 float intensity;
63 63 float v;
64 64 for(i=0; i<steps; i++)
65   - for(o=0; o<steps; o++){
  65 + for(o=0; o<steps; o++) {
66 66 v = distortionMap[o * steps + i];
67 67 intensity = (v - minDistortion) / (maxDistortion - minDistortion) * 255;
68 68  
69   - if(intensity < 0) {cout<<"low intensity"<<endl; intensity = 0;}
  69 + if(intensity < 0) {
  70 + cout<<"low intensity"<<endl;
  71 + intensity = 0;
  72 + }
70 73  
71 74 //QColor color(intensity, (float)o / (float)steps * 255, (float)i / (float)steps * 255);
72 75 QColor color(intensity, intensity, intensity);
... ...
qtSpectrumDisplay.cpp
1   -#include <QtGui>
2   -#include <QtOpenGL/QtOpenGL>
3   -#include <GL/glu.h>
4   -
5   -#include <math.h>
6   -
7   -#include "qtSpectrumDisplay.h"
8   -
9   -qtSpectrumDisplay::qtSpectrumDisplay(QWidget *parent)
10   - : QGLWidget(parent)
11   -{
12   - object = 0;
13   - xRot = 0;
14   - yRot = 0;
15   - zRot = 0;
16   -
17   - qtGreen = QColor::fromCmykF(0.40, 0.0, 1.0, 0.0);
18   - qtPurple = QColor::fromCmykF(0.39, 0.39, 0.0, 0.0);
19   -}
20   -
21   -qtSpectrumDisplay::~qtSpectrumDisplay()
22   -{
23   - makeCurrent();
24   - glDeleteLists(object, 1);
25   -}
26   -
27   -QSize qtSpectrumDisplay::minimumSizeHint() const
28   -{
29   - return QSize(50, 50);
30   -}
31   -
32   -QSize qtSpectrumDisplay::sizeHint() const
33   -{
34   - return QSize(400, 400);
35   -}
36   -
37   -void qtSpectrumDisplay::initializeGL()
38   -{
39   - qglClearColor(qtPurple.dark());
40   - //object = makeObject();
41   - glShadeModel(GL_FLAT);
42   - glEnable(GL_DEPTH_TEST);
43   - glEnable(GL_CULL_FACE);
44   -}
45   -
46   -void qtSpectrumDisplay::printWavenumber(int xPos)
47   -{
48   - int viewParams[4];
49   - glGetIntegerv(GL_VIEWPORT, viewParams);
50   -
51   - float a = (float)xPos/(float)viewParams[2];
52   -
53   - int wn = a * (nuMax - nuMin) + nuMin;
54   - cout<<wn<<endl;
55   -
56   -
57   -
58   -}
59   -
60   -void qtSpectrumDisplay::paintGL()
  1 +#include <QtGui>
  2 +#include <QtOpenGL/QtOpenGL>
  3 +#include <GL/glu.h>
  4 +
  5 +#include <math.h>
  6 +
  7 +#include "qtSpectrumDisplay.h"
  8 +
  9 +int axisMargins = 50;
  10 +
  11 +qtSpectrumDisplay::qtSpectrumDisplay(QWidget *parent)
  12 + : QGLWidget(parent)
  13 +{
  14 + object = 0;
  15 + xRot = 0;
  16 + yRot = 0;
  17 + zRot = 0;
  18 +
  19 + qtGreen = QColor::fromCmykF(0.40, 0.0, 1.0, 0.0);
  20 + qtPurple = QColor::fromCmykF(0.39, 0.39, 0.0, 0.0);
  21 +}
  22 +
  23 +qtSpectrumDisplay::~qtSpectrumDisplay()
  24 +{
  25 + makeCurrent();
  26 + glDeleteLists(object, 1);
  27 +}
  28 +
  29 +QSize qtSpectrumDisplay::minimumSizeHint() const
61 30 {
62   - //prepare the projection (orthographic, bounded by spectral values)
63   - glMatrixMode(GL_PROJECTION);
64   - glLoadIdentity();
65   - gluOrtho2D(nuMin, nuMax, aMin, aMax);
66   - glMatrixMode(GL_MODELVIEW);
  31 + return QSize(50, 50);
  32 +}
  33 +
  34 +QSize qtSpectrumDisplay::sizeHint() const
  35 +{
  36 + return QSize(400, 400);
  37 +}
  38 +
  39 +void qtSpectrumDisplay::initializeGL()
  40 +{
  41 + //qglClearColor(qtPurple.dark());
  42 + glClearColor(0.0, 0.0, 0.0, 0.0);
  43 + //object = makeObject();
  44 + glShadeModel(GL_FLAT);
  45 + glEnable(GL_DEPTH_TEST);
  46 + glEnable(GL_CULL_FACE);
  47 +}
  48 +
  49 +void qtSpectrumDisplay::printWavenumber(int xPos)
  50 +{
  51 + int viewParams[4];
  52 + glGetIntegerv(GL_VIEWPORT, viewParams);
  53 +
  54 + float a = (float)xPos/(float)viewParams[2];
  55 +
  56 + int wn = a * (nuMax - nuMin) + nuMin;
  57 + cout<<wn<<endl;
  58 +
  59 +
  60 +
  61 +}
  62 +
  63 +void qtSpectrumDisplay::paintGL()
  64 +{
  65 +
  66 + //************* Draw Absorbance/Intensity **************************
  67 + //get the window size
  68 + int w = width();
  69 + int h = height();
  70 + glViewport(50, 30, w, h);
  71 +
  72 + //prepare the projection for spectra (orthographic, bounded by spectral values)
  73 + glMatrixMode(GL_PROJECTION);
  74 + glLoadIdentity();
  75 + gluOrtho2D(nuMin, nuMax, aMin, aMax);
  76 + glMatrixMode(GL_MODELVIEW);
67 77 glLoadIdentity();
68 78  
69 79 //clear the screen
70   - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
71   -
72   - //set the line width
73   - glLineWidth(2);
74   -
75   - //draw the simulated spectrum (in white)
76   - if(dispSimSpec)
77   - {
78   - glColor3f(1.0, 1.0, 1.0);
79   - glBegin(GL_LINE_STRIP);
80   - for(unsigned int i=0; i<SimSpectrum.size(); i++)
81   - glVertex2f(SimSpectrum[i].nu, SimSpectrum[i].A);
82   - glEnd();
  80 + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  81 +
  82 + //set the line width
  83 + glLineWidth(1);
  84 +
  85 + //draw the simulated spectrum (in white)
  86 + if(dispSimSpec)
  87 + {
  88 + glColor3f(1.0, 1.0, 1.0);
  89 + glBegin(GL_LINE_STRIP);
  90 + for(unsigned int i=0; i<SimSpectrum.size(); i++)
  91 + glVertex2f(SimSpectrum[i].nu, SimSpectrum[i].A);
  92 + glEnd();
  93 + }
  94 + //draw the reference spectrum in gray
  95 + if(dispRefSpec && RefSpectrum.size() > 0)
  96 + {
  97 + glColor3f(0.5, 0.5, 0.5);
  98 + glBegin(GL_LINE_STRIP);
  99 + float nu;
  100 + for(unsigned int i=0; i<RefSpectrum[currentSpec].size(); i++)
  101 + {
  102 + nu = RefSpectrum[currentSpec][i].nu;
  103 + glVertex2f(nu, RefSpectrum[currentSpec][i].A + nu * refSlope);
  104 + }
  105 + glEnd();
83 106 }
84   - //draw the reference spectrum in gray
85   - if(dispRefSpec && RefSpectrum.size() > 0)
86   - {
87   - glColor3f(0.5, 0.5, 0.5);
88   - glBegin(GL_LINE_STRIP);
89   - float nu;
90   - for(unsigned int i=0; i<RefSpectrum[currentSpec].size(); i++)
91   - {
92   - nu = RefSpectrum[currentSpec][i].nu;
93   - glVertex2f(nu, RefSpectrum[currentSpec][i].A + nu * refSlope);
94   - }
95   - glEnd();
96   - }
97   -
98   - //draw the material properties
99   -
100   - //change the viewport properties (materials are plotted on a different scale)
101 107  
102 108 //compute the maximum k and n
103 109 int nSamples = MaterialList[currentMaterial].eta.size();
104 110 float maxK = 0.0;
105 111 float maxN = 0.0;
106 112 float thisN, thisK;
107   - for(int i=0; i<nSamples; i++)
  113 +
  114 +
  115 +
  116 + //************* Draw k **************************
  117 + //change the viewport properties and draw n
  118 + glMatrixMode(GL_PROJECTION);
  119 + glLoadIdentity();
  120 + gluOrtho2D(nuMin, nuMax, 0.0, kMax);
  121 + //glMatrixMode(GL_MODELVIEW);
  122 + //glLoadIdentity();
  123 +
  124 + float nu;
  125 + if(dispMatK)
  126 + {
  127 +
  128 + glColor3f(1.0, 0.0, 0.0);
  129 + glBegin(GL_LINE_STRIP);
  130 + for(int i=0; i<nSamples; i++)
  131 + {
  132 + nu = MaterialList[currentMaterial].nu[i];
  133 + glVertex2f(nu, MaterialList[currentMaterial].eta[i].imag());
  134 + }
  135 + glEnd();
  136 + }
  137 + if(dispSimK)
108 138 {
109   - thisN = fabs(MaterialList[currentMaterial].eta[i].real() - 1.49);
110   - if(thisN > maxN)
111   - maxN = thisN;
112   - thisK = fabs(MaterialList[currentMaterial].eta[i].imag());
113   - if(thisK > maxK)
114   - thisK = maxK;
  139 + glColor3f(1.0, 1.0, 0.0);
  140 + glBegin(GL_LINE_STRIP);
  141 + for(unsigned int i=0; i<EtaK.size(); i++)
  142 + {
  143 + nu = EtaK[i].nu;
  144 + glVertex2f(nu, EtaK[i].A);
  145 + }
  146 + glEnd();
115 147 }
116   - cout<<maxN<<"---------"<<maxK<<endl;
117 148  
  149 + //************* Draw n **************************
  150 + //change the viewport properties and draw n
  151 + glMatrixMode(GL_PROJECTION);
  152 + glLoadIdentity();
  153 + if(nMag < 0.1) nMag = 0.1;
  154 + gluOrtho2D(nuMin, nuMax, baseIR - nMag, baseIR + nMag);
  155 + if(dispMatN)
  156 + {
  157 + glColor3f(0.0, 1.0, 0.0);
  158 + glBegin(GL_LINE_STRIP);
  159 + for(int i=0; i<nSamples; i++)
  160 + {
  161 + nu = MaterialList[currentMaterial].nu[i];
  162 + glVertex2f(nu, MaterialList[currentMaterial].eta[i].real());
  163 + }
  164 + glEnd();
  165 + }
  166 + if(dispSimN)
  167 + {
  168 + glColor3f(0.0, 1.0, 1.0);
  169 + glBegin(GL_LINE_STRIP);
  170 + for(unsigned int i=0; i<EtaN.size(); i++)
  171 + {
  172 + nu = EtaN[i].nu;
  173 + glVertex2f(nu, EtaN[i].A);
  174 + }
  175 + glEnd();
  176 + }
118 177  
119   - glMatrixMode(GL_PROJECTION);
120   - glLoadIdentity();
121   - gluOrtho2D(nuMin, nuMax, aMin, aMax);
122   -
123   -
124   - float nu;
125   - //display absorbance
126   - if(dispMatK)
127   - {
128   -
129   - glColor3f(1.0, 0.0, 0.0);
130   - glBegin(GL_LINE_STRIP);
131   - for(int i=0; i<nSamples; i++){
132   - nu = MaterialList[currentMaterial].nu[i];
133   - glVertex2f(nu, MaterialList[currentMaterial].eta[i].imag() * dispScaleK);
134   - }
135   - glEnd();
136   - }
137   - if(dispSimK)
138   - {
139   - glColor3f(1.0, 1.0, 0.0);
140   - glBegin(GL_LINE_STRIP);
141   - for(unsigned int i=0; i<EtaK.size(); i++){
142   - glVertex2f(EtaK[i].nu, EtaK[i].A * dispScaleK);
143   - }
144   - glEnd();
145   -}
146   -
147   -//display refractive index (real)
148   -if(dispMatN)
149   -{
150   - glColor3f(0.0, 1.0, 0.0);
151   - glBegin(GL_LINE_STRIP);
152   - for(int i=0; i<nSamples; i++){
153   - nu = MaterialList[currentMaterial].nu[i];
154   - glVertex2f(nu, (MaterialList[currentMaterial].eta[i].real() - baseIR) * dispScaleN);
155   - }
156   - glEnd();
157   -}
158   -if(dispSimN)
159   -{
160   - glColor3f(0.0, 1.0, 1.0);
161   - glBegin(GL_LINE_STRIP);
162   - for(unsigned int i=0; i<EtaN.size(); i++)
163   - glVertex2f(EtaN[i].nu, (EtaN[i].A - baseIR) * dispScaleN);
164   - glEnd();
165   -}
166   -
167   -
168   -glCallList(object);
169   -
170   -glFlush();
171   -
172   -//display the values at the mouse location
173   -renderText(50, 50, "test");
174   -}
175   -
176   -void qtSpectrumDisplay::resizeGL(int width, int height)
177   -{
178   - int side = qMin(width, height);
179   - glViewport(0, 0, width, height);
180   -
181   -}
182   -
183   -void qtSpectrumDisplay::mousePressEvent(QMouseEvent *event)
184   -{
185   - lastPos = event->pos();
186   -
187   - if(event->buttons() & Qt::LeftButton)
188   - {
189   - int wn = 0;
190   - printWavenumber(event->x());
191   - }
192   -}
193   -
194   -void qtSpectrumDisplay::mouseMoveEvent(QMouseEvent *event)
195   -{
196   - int dx = event->x() - lastPos.x();
197   - int dy = event->y() - lastPos.y();
198   -
199   - lastPos = event->pos();
200   -}
201   -
202   -void qtSpectrumDisplay::quad(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2,
203   - GLdouble x3, GLdouble y3, GLdouble x4, GLdouble y4)
204   -{
205   - qglColor(qtGreen);
206   -
207   - glVertex3d(x1, y1, -0.05);
208   - glVertex3d(x2, y2, -0.05);
209   - glVertex3d(x3, y3, -0.05);
210   - glVertex3d(x4, y4, -0.05);
211   -
212   - glVertex3d(x4, y4, +0.05);
213   - glVertex3d(x3, y3, +0.05);
214   - glVertex3d(x2, y2, +0.05);
215   - glVertex3d(x1, y1, +0.05);
216   -}
217   -
218   -void qtSpectrumDisplay::normalizeAngle(int *angle)
219   -{
220   - while (*angle < 0)
221   - *angle += 360 * 16;
222   - while (*angle > 360 * 16)
223   - *angle -= 360 * 16;
  178 +
  179 + glCallList(object);
  180 +
  181 + glFlush();
  182 +
  183 + //*********************** Display axes values ****************************
  184 +
  185 +
  186 + ostringstream buff;
  187 + glViewport(0, 0, w, h);
  188 + int nDivs = 11;
  189 + glColor3f(1.0, 1.0, 1.0);
  190 + for(int i = 0; i < nDivs; i++)
  191 + {
  192 + float divStep = (aMax - aMin)/(nDivs - 1);
  193 + float pixStep = (float)(h - 10)/(nDivs - 1);
  194 +
  195 + buff<<aMin + i * divStep;
  196 + renderText(0, h - i * pixStep, buff.str().c_str());
  197 + buff.clear(); buff.str("");
  198 + }
  199 +}
  200 +
  201 +void qtSpectrumDisplay::resizeGL(int width, int height)
  202 +{
  203 + int side = qMin(width, height);
  204 +
  205 +
  206 +}
  207 +
  208 +void qtSpectrumDisplay::mousePressEvent(QMouseEvent *event)
  209 +{
  210 + lastPos = event->pos();
  211 +
  212 + if(event->buttons() & Qt::LeftButton)
  213 + {
  214 + int wn = 0;
  215 + printWavenumber(event->x());
  216 + }
  217 +}
  218 +
  219 +void qtSpectrumDisplay::mouseMoveEvent(QMouseEvent *event)
  220 +{
  221 + int dx = event->x() - lastPos.x();
  222 + int dy = event->y() - lastPos.y();
  223 +
  224 + lastPos = event->pos();
  225 +}
  226 +
  227 +void qtSpectrumDisplay::quad(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2,
  228 + GLdouble x3, GLdouble y3, GLdouble x4, GLdouble y4)
  229 +{
  230 + qglColor(qtGreen);
  231 +
  232 + glVertex3d(x1, y1, -0.05);
  233 + glVertex3d(x2, y2, -0.05);
  234 + glVertex3d(x3, y3, -0.05);
  235 + glVertex3d(x4, y4, -0.05);
  236 +
  237 + glVertex3d(x4, y4, +0.05);
  238 + glVertex3d(x3, y3, +0.05);
  239 + glVertex3d(x2, y2, +0.05);
  240 + glVertex3d(x1, y1, +0.05);
  241 +}
  242 +
  243 +void qtSpectrumDisplay::normalizeAngle(int *angle)
  244 +{
  245 + while (*angle < 0)
  246 + *angle += 360 * 16;
  247 + while (*angle > 360 * 16)
  248 + *angle -= 360 * 16;
224 249 }
... ...
qtSpectrumDisplay.h
1   - #ifndef GLWIDGET_H
2   - #define GLWIDGET_H
3   -
4   -#include <QtOpenGL/QGLWidget>
5   -#include "globals.h"
6   -
7   - class qtSpectrumDisplay : public QGLWidget
8   - {
9   - Q_OBJECT
10   -
11   - public:
12   - qtSpectrumDisplay(QWidget *parent = 0);
13   - ~qtSpectrumDisplay();
14   -
15   - QSize minimumSizeHint() const;
16   - QSize sizeHint() const;
17   -
18   - public slots:
19   - /*void setXRotation(int angle);
20   - void setYRotation(int angle);
21   - void setZRotation(int angle);*/
22   -
23   - signals:
24   - void xRotationChanged(int angle);
25   - void yRotationChanged(int angle);
26   - void zRotationChanged(int angle);
27   -
28   - protected:
29   - void initializeGL();
30   - void paintGL();
31   - void resizeGL(int width, int height);
32   - void mousePressEvent(QMouseEvent *event);
33   - void mouseMoveEvent(QMouseEvent *event);
34   -
35   - private:
36   - //GLuint makeObject();
37   - void quad(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2,
38   - GLdouble x3, GLdouble y3, GLdouble x4, GLdouble y4);
39   - //void extrude(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);
40   - void normalizeAngle(int *angle);
41   - void printWavenumber(int wn);
42   -
43   - GLuint object;
44   - int xRot;
45   - int yRot;
46   - int zRot;
47   - QPoint lastPos;
48   - QColor qtGreen;
49   - QColor qtPurple;
50   - };
51   -
52   - #endif
53 1 \ No newline at end of file
  2 +#ifndef GLWIDGET_H
  3 +#define GLWIDGET_H
  4 +
  5 +#include <QtOpenGL/QGLWidget>
  6 +#include "globals.h"
  7 +
  8 +class qtSpectrumDisplay : public QGLWidget
  9 +{
  10 + Q_OBJECT
  11 +
  12 +public:
  13 + qtSpectrumDisplay(QWidget *parent = 0);
  14 + ~qtSpectrumDisplay();
  15 +
  16 + QSize minimumSizeHint() const;
  17 + QSize sizeHint() const;
  18 +
  19 +public slots:
  20 + /*void setXRotation(int angle);
  21 + void setYRotation(int angle);
  22 + void setZRotation(int angle);*/
  23 +
  24 +signals:
  25 + void xRotationChanged(int angle);
  26 + void yRotationChanged(int angle);
  27 + void zRotationChanged(int angle);
  28 +
  29 +protected:
  30 + void initializeGL();
  31 + void paintGL();
  32 + void resizeGL(int width, int height);
  33 + void mousePressEvent(QMouseEvent *event);
  34 + void mouseMoveEvent(QMouseEvent *event);
  35 +
  36 +private:
  37 + //GLuint makeObject();
  38 + void quad(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2,
  39 + GLdouble x3, GLdouble y3, GLdouble x4, GLdouble y4);
  40 + //void extrude(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);
  41 + void normalizeAngle(int *angle);
  42 + void printWavenumber(int wn);
  43 +
  44 + GLuint object;
  45 + int xRot;
  46 + int yRot;
  47 + int zRot;
  48 + QPoint lastPos;
  49 + QColor qtGreen;
  50 + QColor qtPurple;
  51 +};
  52 +
  53 +#endif
... ...