  We investigated the effect of inverse Compton scattering in mildly
relativistic static and moving plasmas with low optical depth using Monte Carlo
simulations, and calculated the Sunyaev-Zel'dovich effect in the cosmic
background radiation. Our semi-analytic method is based on a separation of
photon diffusion in frequency and real space. We use Monte Carlo simulation to
derive the intensity and frequency of the scattered photons for a monochromatic
incoming radiation. The outgoing spectrum is determined by integrating over the
spectrum of the incoming radiation using the intensity to determine the correct
weight. This method makes it possible to study the emerging radiation as a
function of frequency and direction. As a first application we have studied the
effects of finite optical depth and gas infall on the Sunyaev-Zel'dovich effect
(not possible with the extended Kompaneets equation) and discuss the parameter
range in which the Boltzmann equation and its expansions can be used. For high
temperature clusters ($k_B T_e \gtrsim 15$ keV) relativistic corrections based
on a fifth order expansion of the extended Kompaneets equation seriously
underestimate the Sunyaev-Zel'dovich effect at high frequencies. The
contribution from plasma infall is less important for reasonable velocities. We
give a convenient analytical expression for the dependence of the cross-over
frequency on temperature, optical depth, and gas infall speed. Optical depth
effects are often more important than relativistic corrections, and should be
taken into account for high-precision work, but are smaller than the typical
kinematic effect from cluster radial velocities.
