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

  • Thread starter Thread starter snickersnee
  • Start date Start date
  • Tags Tags
    Code Mathematica
Click For Summary
SUMMARY

This discussion focuses on implementing the Kramers-Kronig relations in Mathematica using CSV data. The user is working with a CSV file containing two columns: the first column represents energy (h(eV)) ranging from 0 to 6 eV, and the second column represents absorption coefficient (alpha in cm^-1). The provided Mathematica code attempts to perform numerical integration using NIntegrate, but there are issues with variable definitions and integration setup. The correct approach involves defining omega as a function variable for proper integration.

PREREQUISITES
  • Familiarity with Kramers-Kronig relations in optics
  • Understanding of Mathematica programming and syntax
  • Knowledge of numerical integration techniques in Mathematica
  • Basic understanding of CSV data handling in Mathematica
NEXT STEPS
  • Study the implementation of Kramers-Kronig relations in Mathematica
  • Learn about the NIntegrate function and its options in Mathematica
  • Explore the use of Function and variable definitions in Mathematica
  • Review CSV data import and manipulation techniques in Mathematica
USEFUL FOR

Researchers and students in physics or engineering, particularly those working with optical properties and numerical methods in Mathematica.

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], ..., ...}]
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 6 ·
Replies
6
Views
5K
Replies
2
Views
3K
  • · Replies 34 ·
2
Replies
34
Views
4K
  • · Replies 8 ·
Replies
8
Views
13K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 5 ·
Replies
5
Views
3K