## CAMB: formula for matter power specturm

Use of Cobaya. camb, CLASS, cosmomc, compilers, etc.
Zhuangfei Wang
Posts: 27
Joined: October 09 2021
Affiliation: Simon Fraser University

### CAMB: formula for matter power specturm

Hello, maybe a simple question about the matter power spectrum. I am just having some trouble getting the exact formula of matter power spectrum from CAMB. If I am not mistaken, the expression I have in mind will be:

Code: Select all

outpower = (transfer_var1* transfer_var2)*2*pi*2*h^3/k^3*InitPower
based on the code in "Transfer_GetMatterPowerD" of result.f90:

Code: Select all

atransfer=MTrans%TransferData(s1,ik,itf)*MTrans%TransferData(s2,ik,itf)
matpower(ik) = log(atransfer*k*const_pi*const_twopi*h**3)

However, in the same function, it also uses the calculations below before taking exponential to get the final outpower, which is sort of confusing to me. Could anyone help to explain the reason for these steps? Is my very first formula for PK too simplistic or wrong? Thanks.

Code: Select all


do il=1, npoints
xi=logmink + dlnkh*(il-1)
if (xi < kvals(1)) then
outpower(il)=-30.
cycle
end if
do while ((xi > kvals(llo+1)).and.(llo < MTrans%num_q_trans))
llo=llo+1
if (llo >= MTrans%num_q_trans) exit
end do
if (llo == MTrans%num_q_trans) then
lastix = il
exit
end if
lhi=llo+1
ho=kvals(lhi)-kvals(llo)
a0=(kvals(lhi)-xi)/ho
b0=(xi-kvals(llo))/ho

outpower(il) = a0*matpower(llo)+ b0*matpower(lhi)+((a0**3-a0)* ddmat(llo) &
+(b0**3-b0)*ddmat(lhi))*ho**2/6
end do

do while (lastix <= npoints)
!Do linear extrapolation in the log
!Obviouly inaccurate, non-linear etc, but OK if only using in tails of window functions
outpower(lastix) = 2*outpower(lastix-1) - outpower(lastix-2)
lastix = lastix+1
end do


Antony Lewis
Posts: 1852
Joined: September 23 2004
Affiliation: University of Sussex
Contact:

### Re: CAMB: formula for matter power specturm

This is just spline interpolating onto a grid