Algebraic simplification of circuit models