How to Implement Kramers-Kronig in Mathematica for CSV Data?

  • Thread starter Thread starter snickersnee
  • Start date Start date
  • Tags Tags
    Code Mathematica
AI Thread Summary
The discussion focuses on implementing Kramers-Kronig relations in Mathematica using CSV data with two columns: energy (h(eV)) and absorption coefficient (alpha). The user is uncertain about how to define the variable ω in their code, which is crucial for the integration process. It is clarified that column 1 represents Ω, while ω should be treated as a dummy variable for the integration. The provided Mathematica code needs adjustments to properly define the output as a function of ω for accurate plotting. The conversation emphasizes the importance of correctly setting up the integration variable to achieve the desired results.
snickersnee
Messages
30
Reaction score
0

Homework Statement



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 ω?

Homework Equations



kk_n.gif


(Source: http://www.rp-photonics.com/kramers_kronig_relations.html)

The Attempt at a Solution



Code:
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}]
 
Physics news on Phys.org
It's been a while so I've forgotten most about this stuff, but I noticed that \Omega 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 \omega (lower-case omega) is the variable on the left hand side, I would expect that you get a function, i.e.
Code:
output := Function[\[omega], (* NIntegrate expression *)]
Plot[output, {\[omega], ..., ...}]
 
Thread 'Help with Time-Independent Perturbation Theory "Good" States Proof'
(Disclaimer: this is not a HW question. I am self-studying, and this felt like the type of question I've seen in this forum. If there is somewhere better for me to share this doubt, please let me know and I'll transfer it right away.) I am currently reviewing Chapter 7 of Introduction to QM by Griffiths. I have been stuck for an hour or so trying to understand the last paragraph of this proof (pls check the attached file). It claims that we can express Ψ_{γ}(0) as a linear combination of...

Similar threads

Back
Top