Elastic properties of single-walled carbon nanotubes in compression