# CAMB python convergence power spectrum code

• sunrah

#### sunrah

I'm trying to understand this python CAMB code: http://camb.readthedocs.io/en/latest/CAMBdemo.html
Scroll down to In and In to see it.

It's an integration over chi (comoving distance), yet scipy.integrate.quad is not called. It seems that the fun stuff happens in the last for-loop in In, where they use numpy.dot to take dot product of two arrays. What's going on here? The first array is Delta-Chi (see In) and the second is simply the integrand. So how is this integration? Thanks

I'v been messing around with this and found something interesting:

Python:
from __future__ import division
import numpy as np
import matplotlib.pyplot as plt

xmax = 10
N = 1000
xx = np.linspace(0,xmax,N)

dx = (xx[2:] - xx[:-2])/2
xx = xx[1:-1]
Nx = len(xx)
yy1 = np.arange(0,Nx, dtype=np.float64)
yy2 = []

f = lambda z: z**3

for ix, x in enumerate(xx):
foo = np.linspace(min(xx),x,N-2)**3
yy1[ix] = np.dot(dx, foo)
plt.plot(xx,yy2,label='quad')