The numerical aperture is calculated using the formula: NA = n * sin(θ), where 'n' is the refractive index of the medium between the objective lens and the specimen (usually air, water, or oil), and 'θ' is the half-angle of the maximum cone of light that can enter or exit the lens.