Theory and Application of Statistical Energy Analysis