- #1
vatlilithuyetvietnam
- 5
- 0
Hi everybody,
I have a code for Polar function in Bilayer graphene. I compile and run it. Everything is ok but at x=2, the value of Polar function is so large. I don't know why this happens ? Please help me
I have a code for Polar function in Bilayer graphene. I compile and run it. Everything is ok but at x=2, the value of Polar function is so large. I don't know why this happens ? Please help me
Code:
//====================LIBRARY===================================================
#include <stdio.h>
#include <math.h>
#include <conio.h>
//====================CONSTANTS(CGS)============================================
#define pi 3.141592654
#define kB 1.3806503*1e-16
#define hbar 1.0545716*1e-27
#define msao 0.033*9.10938188*1e-28
#define elec 4.80320427*1e-10
#define kappa 2.45
//====================ROUTINE===================================================
double PI(double x,double T1);
//====================MAIN======================================================
double x,T1;
int main()
{
FILE *output;
output=fopen ("Pi.dat","w+" );
// n=2*1e12;
T1=0.01;
for (x=0.; x<=4.; x+=0.1)
{
printf("%f %f\n ",x,PI(x,T1));
fprintf(output,"%f %f\n",x,PI(x,T1));
}
fclose(output);
printf("\nfin\n");
getch();
}
double PI(double x,double T1)
{ double g0,f0,g1,f1,kq;
// x=2*k1*sin(phi/2);
g0=sqrt(4+pow(x,4))/2-log((1+sqrt(1+pow(x,4)/4))/2);
f0=((2+x*x)/2/x)*sqrt(x*x-4)+log((x-sqrt(x*x-4))/(x+sqrt(x*x-4)));
g1=(1+(pow(x,4)/2)-sqrt(1+pow(x,4)/4))/sqrt(1+pow(x,4)/4);
f1=((x*x-1)*(pow(x,4)-5*x*x+2))/(x*sqrt(pow(x*x-4,3)));
if (x>2)
kq=g0-f0+(pi*pi/6)*(T1*T1)*(g1-f1);
else if (x<2)
kq=g0+(pi*pi/6)*(T1*T1)*g1;
else
kq= sqrt(5)-log((1+sqrt(5))/2)-sqrt(pi/4)*(1-sqrt(2))*(-1.4603545)*sqrt(T1)-sqrt(pi)*(1-sqrt(2)/2)*2.612*pow(sqrt(T1),3);
return kq;
}