Calculations of relic densities in the early universe