error checking added and calculates quadratics and three vectors