Solve a system of linear and quadratic equations