If x1 and x2 are the roots of the quadratic equation ax2 + bx + c = 0, their product is
x1 x2 = c/a. When b is much larger than either a or c, the usual quadratic formula
does a poor job of calculating the root with the smaller absolute value because the
numerator is the difference of two nearly equal quantities
and b. Such
subtractions always reduce the number of significant digits in the answer by the
number of leading significant digits that cancel in the subtraction. Write a program
that calculates the roots of a quadratic equation using the quadratic formula, and
then recalculates the smaller root in absolute value using the formula x2 = c/ax1.
Compare the two sets of roots. Test the program on the following equations.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here