  (abridged) Models of many astrophysical gamma-ray sources assume they contain
a homogeneous distribution of electrons that are injected as a power-law in
energy and evolve by interacting with radiation fields, magnetic fields and
particles in the source and by escaping. This problem is particularly
complicated if the radiation fields have higher energy density than the
magnetic field and are sufficiently energetic that inverse Compton scattering
is not limited to the Thomson regime. We present a simple, time-dependent,
semi-analytical solution of the electron kinetic equation that treats both
continuous and impulsive injection, cooling via synchrotron and inverse Compton
radiation, (taking into account Klein-Nishina effects) and energy dependent
particle escape. The kinetic equation for an arbitrary, time-dependent source
function is solved by the method of Laplace transformations. Using an
approximate expression for the energy loss rate that takes into account
synchrotron and inverse Compton losses including Klein-Nishina effects for
scattering off an isotropic photon field with either a power-law or black-body
distribution, we find explicit expressions for the cooling time and escape
probability of individual electrons. This enables the full, time-dependent
solution to be reduced to a single quadrature. From the electron distribution,
we then construct the time-dependent, multi-wavelength emission spectrum. We
compare our solutions with several limiting cases and discuss the general
appearance and temporal behaviour of spectral features (i.e., cooling breaks,
bumps etc.). As a specific example, we model the broad-band energy spectrum of
the open stellar association Westerlund-2 at different times of its evolution,
and compare it with observations.
