Dynamics of adaptive systems