Thermoacoustic Stability of Quasi-One-Dimensional Flows–Part I: Analytical and Numerical Formulation