Mathematical formulations and algorithms for fast and robust power system simulations