Question: Implementing Kramers-Kronig Transform

I am trying to model reflectivity data at a Mn-doped GaAs interface and hence I need to create a Kramers-Kronig Transform to determine the depth-dependent complex value of the index of refraction at specific beam energies.  The integral I am trying to solve is the following:
f[1](omega) = P(2/(Pi)*(∫)[0]^(infinity)(u*f[2](u))/(u^(2) - omega^(2))du),

where P stands for the Cauchy Principal Value, and f1 and f2 are the real and imaginary parts of this complex-valued scattering factor I need to compute.  To do this, I imported data, manipulated it and plotted it, from which I produced a spline interpolation, which is evidently piecewise.  The function f2 is exactly this spline interpolation, but I am having trouble evaluating the integral due to the ambiguity of the expression in given regions.  I used the split command in the Integration Tools package to try and only have to solve the spline functions on each region, but I cannot get this to work.  Does anyone have any suggestions on how I can get this to work? Ill paste my source code so you can see:

F2 := Spline(X, Y, t);

plot(F2, t = Min .. Max);

F := unapply(F2, t);

C := 1.92599/F(9.73291*10^17);

F := C*F2;

plot(F, t = Min .. Max);

F := unapply(F, t);

Fext := piecewise(t < Min, F(Min)*(t/Min)^2, `and`(t >= Min, t <= Max), F(t), t > Max, F(Max)*(t/Max)^(-2));

plot(Fext, t = .99*Min .. 1.01*Max);

Fext := unapply(Fext, t);

with*IntegrationTools;

Fmod := 2*int[u*Fext(u)/(u^2-omega^2), u = 0 .. infinity, CauchyPrincipalValue]/Pi;

Fmod := Split(Fmod, [X[j], j = 1 .. 301]);

Fmod := unapply(eval(Fmod), omega);

Fmod(Min);

Thank you in advance.  I'll clarify anything if necessary.

Please Wait...