Fast Transient Optimization of Gas Pipelines by Analytic Transformation to Linear Programs