  Synchronization is essential for the operation of AC power systems: All
generators in the power grid must rotate with fixed relative phases to enable a
steady flow of electric power. Understanding the conditions for and the
limitations of synchronization is of utmost practical importance. In this
article, we propose a novel approach to compute and analyze the stable
stationary states of a power grid or an oscillator network in terms of a convex
optimization problem. This approach allows to systematically compute \emph{all}
stable states where the phase difference across an edge does not exceed
$\pi/2$.Furthermore, the optimization formulation allows to rigorously
establish certain properties of synchronized states and to bound the error in
the widely used linear power flow approximation.
