General theory of elastic stability