/* This returns the linear power * Delta = 4pi*k^3 P(k)/(2pi)^3 */ double linear_power_spectrum(double xk) { static double *kk,*pknl,*y2,pnorm=-1,ahi,bhi; static int flag=1,nk=1000,prev_cosmology=0; double a,psp,x1[4],y1[4]; int i; if(pnorm<0 || prev_cosmology!=RESET_COSMOLOGY) { pnorm=SIGMA_8/sigmac(8.0); pnorm*=pnorm; prev_cosmology=RESET_COSMOLOGY; } if(ITRANS>0) psp=pow(xk,SPECTRAL_INDX)*pow(transfnc(xk),2.); else psp=pow(xk,SPECTRAL_INDX); // printf("BOO %e %e\n",xk,psp*pnorm); psp=psp*pnorm*xk*xk*xk/(2*PI*PI); return(psp); }
double func_sigmac(double xk) { double xkr,w,psp; if(rad1>0) { xkr = xk*rad1; w = 3*(sin(xkr)-xkr*cos(xkr))/(xkr*xkr*xkr); w = w*w; } else { xkr = -rad1*xk; w = exp(-xkr*xkr); } if(ITRANS>0) psp=pow(xk,SPECTRAL_INDX)*pow(transfnc(xk),2.0); else psp=pow(xk,SPECTRAL_INDX); psp=psp*w*xk*xk; return(psp); }