Chapter 1: Problem 18
Given a quadratic equation, $$ a x^{2}+b x+c=0, $$ the two roots are $$ x_{1}=\frac{-b+\sqrt{b^{2}-4 a c}}{2 a}, \quad x_{2}=\frac{-b-\sqrt{b^{2}-4 a c}}{2 a} $$ What are the problems with the following program? $$ \begin{aligned} &a=2 ; b=1 ; c=2 \\ &\text { from math import sqrt } \\ &q=\operatorname{sqrt}(b * b-4 * a * c) \\ &x 1=(-b+q) / 2 * a \\ &x 2=(-b-q) / 2 * a \\ &\text { print } x 1, x 2 \end{aligned} $$
Short Answer
Step by step solution
Key Concepts
These are the key concepts you need to understand to accurately answer the question.