Hello everybody
function z=self_energy_summationticww=linspace(0,10,100);for l=1:100S(l)=integral(@(q)Gamma_0(q,ww(l)),0,10,'AbsTol',1e-6,'RelTol',1e-3,'ArrayValued',true);endplot(ww,S)function y1=Gamma_0(q,w)z2=load('Tc_Tmatrix_ordered.txt');tt=z2(741,1);T_c=z2(741,2);mu=z2(741,3);k=1;N=-1000:1000;nn=10^4;fun1=@(a,q) a.*tanh((a.^2-mu)./(2*T_c)).*log((2*a.^2+2*a.*q+q.^2-2*mu-1i*2*pi*N*T_c)./(2*a.^2-2*a.*q+q.^2-2*mu-1i*2*pi*N*T_c))./q-2;R= T_c*q./k.*log((-k.^2+2*k.*q-q.^2+mu+1i.*(2*pi*N*T_c-w))./(-k.^2-2*k.*q-q.^2+mu+1i.*(2*pi*N*T_c-w))).*1./((tt+integral(@(a)fun1(a,q),0,nn,'AbsTol',1e-6,'RelTol',1e-3,'ArrayValued',true)));y1=sum(R);endTime = tocend
On the first step I reduced the relative tolerance of integral calculations. But even on my computer with 24 Gb RAM and Intel I7 processor I can't finish these calculations during the 24 hours. My question: is it possible to improve the performance of this code and reduced the time?
Best Answer