Dynamic stability of ship in waves