Arcing in AC railways: a mathematical approach