1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Kramers-Kronig Mathematica code

  1. Apr 13, 2013 #1
    1. The problem statement, all variables and given/known data

    I'm trying to write Mathematica code to use Kramers-Kronig on a csv file with 2 columns. Column 1 is h(eV). It goes from 0 to 6, in increments of 0.1. Column 2 is alpha (cm^-1).
    In the equation below, I'm guessing column 1 is Ω. But what should I put in for ω?

    2. Relevant equations


    (Source: http://www.rp-photonics.com/kramers_kronig_relations.html)
    3. The attempt at a solution

    Code (Text):
    c = 300000000;

    data = Import[
       "kk.csv", "CSV"];
    column1 = data[[All, 1]];
    column2 = data[[All, 2]];

    output :=
     1 + (c )/(pi) NIntegrate[
        column2/(column1^2 - omega^2), {column1, 0.1, 0, infinity},
        Method -> "PrincipalValue", Exclusions -> Automatic]

    Plot[output, {column1, 0, 6}, AxesOrigin -> {0, 0}]
  2. jcsd
  3. Apr 17, 2013 #2


    User Avatar
    Science Advisor
    Homework Helper

    It's been a while so I've forgotten most about this stuff, but I noticed that [itex]\Omega[/itex] is your integration variable. Also column1 is a defined list and your integration variable is supposed to be a dummy, I think, so I'm not sure what you have written will actually work.

    Since [itex]\omega[/itex] (lower-case omega) is the variable on the left hand side, I would expect that you get a function, i.e.
    Code (Text):

    output := Function[\[omega], (* NIntegrate expression *)]
    Plot[output, {\[omega], ..., ...}]
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted