In N-body simulations the force calculated between particles representing a
given mass distribution is usually softened, to diminish the effect of gra
ininess. In this paper we study the effect of such a smoothing, with the ai
m of finding an optimal value of the softening parameter. As already shown
by Merritt, for too small a softening the estimates of the forces will be t
oo noisy, while for too large a softening the force estimates are systemati
cally misrepresented. In between there is an optimal softening, for which t
he forces in the configuration best approach the true forces. The value of
this optimal softening depends both on the mass distribution and on the num
ber of particles used to represent it. For a higher number of particles the
optimal softening is smaller. More concentrated mass distributions necessi
tate smaller softening, but the softened forces are never as good an approx
imation of the true forces as for non-centrally concentrated configurations
. We give good estimates of the optimal softening for homogeneous spheres,
Plummer spheres and Dehnen spheres. We also give a rough estimate of this q
uantity for other mass distributions, based on the harmonic mean distance t
o the kth neighbour (k=1,...,12), the mean being taken over all particles i
n the configuration. Comparing homogeneous Ferrers' ellipsoids of different
shapes we show that the axial ratios do not influence the value of the opt
imal softening. Finally we compare two different types of softening, a spli
ne softening and a generalization of the standard Plummer softening to high
er values of the exponent. We find that the spline softening fares roughly
as well as the higher powers of the power-law softening and both give a bet
ter representation of the forces than the standard Plummer softening.