Mathematical modeling of light curves of RHESSI and AGILE terrestrial gamma-ray flashes