solving quadratic equations with AC method