Let's develop your numerical chops. You are going to need it for this course and for the rest of your astronomical life. Your programming choice for this course is fortran or C. If you do not know how to program in ANY language let me know IMMEDIATELY. If you have never programmed, or don't know C or fortran, consider getting a book on one of these two languages (C is prefered for the non-initiate -- don't be a dinosaur like me). In general, when you are having problems with coding, take a look at the source code to see if it makes sense; refer to your book/manual. If you're stuck, ask your peers, and as a last resort ask me. I get really cranky debugging other people's code.
Once you get the hang of basic programming, check out Numerical Recipes (The Art of Scientific Programming, by Press, Flannery, Teukolosky, and Vettering [Cambridge Press]) -- affectionately known as Numrec. This book has a vaste number of subroutines for doing simple to sophisticated numberical analysis of data. The source code is located in:
Chapter 4 of Numrec is on numerical integration. Read it closely enough that you understand what is going on. There are a number of schemes for integration. Feel free to choose whatever scheme you'd like. I'd recommend qromb.f which calls polin.f and trapzd.f.
(a) Test your program on a simple analytic function:
The comoving emissivity, commonly refered to as the luminosity density is simply the integral of all luminosity from all sources in a comoving volume, divided by that volume.
All you have to do is integrate the product of the luminosity function of sources and their luminosity over the appropriate range of luminoisity and you're done. The luminosity function -- Phi(M) or Phi(L) -- will be in units of number per comoving volume (typically Mpc^-3 or Gpc^-3). The sources, in one case of particuarly interest are galaxies. A function which describes the composite galaxy luminosity function reasonably well is called the Schecter function:
Now it's time to integrate numerically. Integrate L Phi(L) dL from infinite luminosity down to three limiting luminosities equivalent to {M*+2.5, M*+5, M*+10} for alpha = {-0.75, -1, -1.75}. Clearly you can't integrate from infinite luminosity -- what did you do? Is the integral converging? If not, try integrating L Phi(M) dM.
When you're done with this, calculate the three indefinite integral for these values of alpha. Check your result with the close-form expression for the integral in a few cases. Tabulate the results.