We compute energy gaps for spin-polarized fractional quantum Hall states in the lowest Landau level (LL) at filling fractions $\ensuremath{\nu}=\frac{1}{3},$ $\frac{2}{5},$ $\frac{3}{7},$ and $\frac{4}{9}$ using exact diagonalization of systems with up to 16 particles and extrapolation to the infinite system-size limit. The gaps calculated for a pure Coulomb interaction and ignoring finite width effects, disorder and LL mixing agree well with the predictions of composite fermion theory provided the logarithmic corrections to the effective mass are included. This is in contrast with previous estimates, which, as we show, overestimated the gaps at $\ensuremath{\nu}=2/5$ and 3/7 by around 15%. We also study the reduction of the gaps as a result of the nonzero width of the two-dimensional (2D) layer. We show that these effects are accurately accounted for using either Gaussian or ``$z\ifmmode\times\else\texttimes\fi{}$ Gaussian'' $(z\mathrm{G})$ trial wave functions, which we show are significantly better variational wave functions than the Fang-Howard wave function. The Gaussian and $z\mathrm{G}$ wave functions give Haldane pseudopotential parameters which agree with those of self-consistent local density approximation calculations to better than $\ifmmode\pm\else\textpm\fi{}0.2%.$ For quantum well parameters typical of heterostructure samples, we find gap reductions of around 20%. The experimental gaps, after accounting heuristically for disorder, are still around 40% smaller than the computed gaps. However, for the case of tetracene layers in metal-insulator-semiconductor (MIS) devices we find that the measured activation gaps are close to those we compute. We discuss possible reasons why the difference between computed and measured activation gaps is larger in GaAs heterostructures than MIS devices. Finally, we present calculations using systems with up to 18 electrons of the gap at $\ensuremath{\nu}=\frac{5}{2}$ including width corrections.