  In Smoothed Particles Hydrodynamics (SPH) codes with a large number of
particles, star formation as well as gas and metal restitution from dying stars
can be treated statistically. This approach allows to include detailed chemical
evolution and gas re-ejection with minor computational effort. Here we report
on a new statistical algorithm for star formation and chemical evolution,
especially conceived for SPH simulations with large numbers of particles, and
for parallel SPH codes.
  For the sake of illustration, we present also two astrophysical simulations
obtained with this algorithm, implemented into the Tree-SPH code by Lia &
Carraro (2000). In the first one, we follow the formation of an individual
disc-like galaxy, predict the final structure and metallicity evolution, and
test resolution effects. In the second one we simulate the formation and
evolution of a cluster of galaxies, to demonstrate the capabilities of the
algorithm in investigating the chemo-dynamical evolution of galaxies and of the
intergalactic medium in a cosmological context.
