Is the integral for current correct?

In summary, the conversation discusses using Mathematica to calculate the density of states and current of the Green's function times self energy. The code provided includes plots for both the density of states and current, but it is pointed out that the current plot should be a line with a slope, and the integral over energy is not correctly implemented. The solution is suggested to change the integral to be over the energy variable instead of the angle variable.
  • #1
wondering12
18
0
Hi,
I am using Mathematica to calculate density of states and current of the Green's function times self energy in most simple form. I am not sure if I am getting current integral over energy implemented correctly. Shouldnt first current plot be a line with a slope? Below is my code:
Code:
Remove["Global`*"];//Quiet
ClearAll
inputEta=0.6;inputHop=0.6;inputStep=0.1;inputAngle=1;inputCoup=0.5;inputDrange={0,2.5};inputCrange={0,0.1};range=10;\[Chi]range=4*Pi;

(* plotting density of states *)
greenF[\[Eta]_,t_,\[Theta]_]:=1/(e+I*\[Eta]-2*t*Cos[\[Theta]])
integral[eta_,hopping_,steps_,plotrange_]:=Module[{},ListPlot[Table[{e,-1/Pi*Im[NIntegrate[greenF[eta,hopping,angle],{angle,-Pi,Pi}]]},{e,-range,range,steps}],Joined->True,AxesLabel->{"E","DOS"},PlotRange->Automatic]]//Timing
integral[inputEta,inputHop,inputStep,inputDrange]

(* plotting current *)
(*selfEnergy1=1 ,   greenF1=greenF*selfEnergy1 *)
greenF1[\[Eta]_,t_,\[Theta]_,v_,e_]:=v/(e+I*\[Eta]-2*t*Cos[\[Theta]]);
integral[eta_,hopping_,angle_,coupling_,steps_,plotrange_]:=Module[{},ListPlot[Table[{\[Chi],1/(2*Pi)*Re[NIntegrate[greenF1[eta,hopping,angle,coupling,energy],{energy,-range,range}]]},{\[Chi],-\[Chi]range,\[Chi]range,steps}],Joined->True,AxesLabel->{"\[Chi]","I"},PlotRange->Automatic]]//Timing
integral[inputEta,inputHop,inputStep,inputAngle,inputCoup,inputCrange]

(*selfEnergy2=v*Cos[\[Chi]] ,   greenF1=greenF*selfEnergy1 *)
greenF2[\[Eta]_,t_,\[Theta]_,v_,e_]:=v*Cos[\[Chi]]/(e+I*\[Eta]-2*t*Cos[\[Theta]]);
integral[eta_,hopping_,angle_,coupling_,steps_,plotrange_]:=Module[{},ListPlot[Table[{\[Chi],1/(2*Pi)*Re[NIntegrate[greenF2[eta,hopping,angle,coupling,energy],{energy,-range,range}]]},{\[Chi],-\[Chi]range,\[Chi]range,steps}],Joined->True,AxesLabel->{"\[Chi]","I"},PlotRange->Automatic]]//Timing
integral[inputEta,inputHop,inputStep,inputAngle,inputCoup,inputCrange]
 
Last edited by a moderator:
Physics news on Phys.org
  • #2
The current plots should indeed be a line with a slope, but you have not implemented the integral over energy correctly. The integral should be over the energy variable, not the angle variable. Try changing the following lines:greenF1[\[Eta]_,t_,\[Theta]_,v_,e_]:=v/(e+I*\[Eta]-2*t*Cos[\[Theta]]);integral[eta_,hopping_,angle_,coupling_,steps_,plotrange_]:=Module[{},ListPlot[Table[{\[Chi],1/(2*Pi)*Re[NIntegrate[greenF1[eta,hopping,angle,coupling,energy],{energy,-range,range}]]},{\[Chi],-\[Chi]range,\[Chi]range,steps}],Joined->True,AxesLabel->{"\[Chi]","I"},PlotRange->Automatic]]//Timingto:greenF1[\[Eta]_,t_,\[Theta]_,v_,e_]:=v/(e+I*\[Eta]-2*t*Cos[\[Theta]]);integral[eta_,hopping_,angle_,coupling_,steps_,plotrange_]:=Module[{},ListPlot[Table[{\[Chi],1/(2*Pi)*Re[NIntegrate[greenF1[eta,hopping,energy,coupling,angle],{energy,-range,range}]]},{\[Chi],-\[Chi]range,\[Chi]range,steps}],Joined->True,AxesLabel->{"\[Chi]","I"},PlotRange->Automatic]]//TimingThis should give you the expected result. Hope this helps!
 

1. Is the integral for current always accurate?

The integral for current is generally accurate, but it can be affected by external factors such as resistance in the circuit or fluctuations in the power source.

2. How is the integral for current calculated?

The integral for current is calculated by taking the area under the current-time curve using calculus.

3. Can the integral for current be negative?

Yes, the integral for current can be negative if the current in the circuit changes direction at any point.

4. What are the units of the integral for current?

The units of the integral for current depend on the units of the current and time measurements being used. For example, if the current is measured in amperes and time is measured in seconds, the units of the integral for current would be coulombs (C).

5. How does the integral for current relate to electric charge?

The integral for current is directly related to electric charge, as it represents the total amount of charge that has flowed through a circuit over a given period of time.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
228
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • Special and General Relativity
Replies
1
Views
534
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
4K
Replies
1
Views
1K
  • Differential Equations
Replies
4
Views
4K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
279
Back
Top