# Calculating Kramers-Kronig using Mathematica

First of all, I know there is a Mathematica group in beta, but I don't think the problem of the following is directly a Mathematica issue.

I am trying to calculate the change of the refractive index dnF from the change of absorption daF. Note that l,li,ln is in nm.

The form of the resulting curve is fine (which is a sign for me that there is no Problem with e.g. PrecionGoals), but the order of magnitude is lower by 13 orders of magnitude than the expected one. The MathLab script von Lucarini et. al. "KK Relation in Optical Materials Research" gives the correct values. The formula used here is from the same book and matches the one in German Wikipedia.

Does anyone see my mistake?

c = 300000000;

daF[l_] = 500 * 0.28 Exp[-((l - 500)/90)^2];

dnFpoints = Table[
{
ln,
c/Pi NIntegrate[
daF[li] / ((2 Pi c 10^9 /li)^2 - (2 Pi c 10^9 / ln)^2),
{li, 200, 800},
Method -> {"PrincipalValue"},
Exclusions -> ((2 Pi c 10^9 /li)^2 - (2 Pi c 10^9 / ln)^2) == 0
]
},
{ln, 300, 600}
];

ListPlot[dnFpoints, Filling -> Axis]

-
Why don't you write the formula explicitly and explain what are the input data? I did not spend much time on this, but right now I don't understand why you divide, rather than multiply, by 10^9, if l,li,ln is in nm. –  akhmeteli Feb 15 '12 at 15:05
Sorry, my remark on dividing by 10^9 was silly, please disregard it. –  akhmeteli Feb 15 '12 at 16:09
The formula is the last one on this German Wikipedia article. The English article also explains the backgrounds. –  mcandril Feb 16 '12 at 12:54
Cross-posted from mathematica.stackexchange.com/q/1750 –  Qmechanic Apr 15 '13 at 0:42
No, different problems with the same code. Not talking about the necessity to dig that up more than one year later. –  mcandril Apr 16 '13 at 10:16
It looks like you integrate by $d\lambda$, whereas, according to the formula, you should integrate by $d\Omega$ - this may well give you 13 orders of magnitude.
I am integrating by $\text{d}\lambda$, but also, my denominator is ((2 Pi c 10^9 /li)^2 - (2 Pi c 10^9 / ln)^2). - But I forgot to do the substitution for $\text{d}\Omega$. Dammit, awkward. –  mcandril Feb 20 '12 at 10:23