Motion of objects connected by a string or pulley