1
$\begingroup$

I'm new to Mathematica and I have to solve this problem but all of my approaches are wrong :( So, please can anyone help me with this equation? Here it is: enter image description here

Here is my data : https://pastebin.com/preM342D The data is in ln(sqrt(R)), w And here is my code:

   {R, w} = ToExpression@Import["https://pastebin.com/raw/preM342D"];
f = Interpolation[Transpose[{Flatten[w], Flatten[R]}]]
theta[w_] := 
 theta[w] = 
  2 w/Pi NIntegrate[ f[a]/(a^2 - w^2), {a, 0, 3.2}, 
     Method -> "PrincipalValue", Exclusions -> {(a^2 - w^2) == 0}] // 
   Quiet
DiscretePlot[theta[w], {w, 0.5, 3.5, .25}, AxesOrigin -> {0, 0}, 
 Joined -> True]

P.S. I know that this question was discussed before, but all the answers that were given I can't get to work. Very appreciate for any help

My output looks like this: enter image description here

But it is wrong

$\endgroup$
12
  • $\begingroup$ This is closely related Kramers-Kronig in Mathematica or just a duplicate, isn't it? $\endgroup$
    – Artes
    Mar 5 '20 at 20:06
  • $\begingroup$ What is your output? You include a picture of the equation, but it would be better to include one of your output also. Thank you for providing code with this question! Welcome to mma.SE! $\endgroup$ Mar 5 '20 at 20:15
  • 1
    $\begingroup$ @CATrevillian , thanks for paying attention! I've added my output in the post. $\endgroup$
    – Kirill
    Mar 6 '20 at 13:01
  • $\begingroup$ A standard way to do the Kramers-Kroning is via the Hilbert transform. There is one post here that provides an extensive answer and many test cases. Please, check it out. $\endgroup$
    – yarchik
    Mar 6 '20 at 14:16
  • 4
    $\begingroup$ Does this answer your question? Implementing discrete and continuous Hilbert transforms $\endgroup$
    – yarchik
    Mar 6 '20 at 14:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.