I have to use Kramers Kronig relation for wich I know the imaginary part so I want to know the real part of the function, so the formulae I need is $$\Psi_1(y) = \frac{1}{\pi} P \int_{-\infty}^{\infty}\frac{\Psi_2(x)}{x-y}dx$$
where $P$ stands for the principal value and the real part is with subscript 1 and 2 for the imaginary part. If my function is odd the formulae has the following form
$$\Psi_1(y) = \frac{2}{\pi} P \int_{0}^{\infty}x \frac{\Psi_2(x)}{x^2-y^2}dx$$
So here goes the question
My function is
$$\Psi_2(x)= \textrm{sgn}(x)\sqrt{1-\left ( 1-\left (\frac{x}{a} \right )^{2} \right )^2}\Theta\left [ 1- \sqrt{1-\left ( 1-\left (\frac{x}{a} \right )^{2} \right )^2}\right ]$$
where $\textrm{sgn}$ stands for the sign function and $\Theta$ for the Heaviside function.
I'm using Mathematica to solve this. If I use the former formulae I have a complex solution. Here is the code
Integrate[Sign[x] Sqrt[1 - (1 - (x/a)^2)^2]/(x - y) HeavisideTheta[Sqrt[2] a - Abs[x]], {x, -Infinity, Infinity}, Assumptions -> a > 0 && -a Sqrt[2] < y < a Sqrt[2], PrincipalValue -> True]
The answer I get is a complex function and too long to post it.
If I use the latter formulae I get a simpler answer
$$\frac{\pi(a^2-y^2)}{2a^2}$$
Shouldn't both formulas give the same result? Why I get a complex answer in the former formula?
I also tried with the Feynman trick, this is, add $\imath \epsilon$ in the denominator, do the math and then take the limit when $\epsilon$ goes zero
Integrate[Sign[x] Sqrt[1 - (1 - (x/a)^2)^2]/(x - y + I n), {x, -Sqrt[2] a, Sqrt[2] a}, Assumptions -> a > 0 && -a Sqrt[2] < y < a Sqrt[2] && Im[n] == 0, PrincipalValue -> True]
$$\frac{a^2\pi \left [ -2 \sqrt{1-\frac{2a^2}{y^2}} \right ]-y^2\pi\left [ -1+\sqrt{1-\frac{2a^2}{y^2}} \right ]}{a^3\sqrt{\frac{1}{a^2}-\frac{2}{y^2}}}$$
But despite this is real, the solution only exists where it shouldn't be, that is out of my problem space.
Does anybody know how to solve this?
Thanks!