Dynamics of collapse of a confined Bose gas