solve a system of equations