The onset of chaos, a soluble model, and the Josephson-junction equation