Question 456779: The common algorithm for calculating the roots of a quadratic equation by the quadratic formula requires considering several special cases in your code, including consideration of special cases when one or more coefficients vanish. Write appropriate comments for this algorithm so that the comments make it easy to see the different cases and how they are handled. Write accompanying documentation to explain the algorithm. Total target answer should be no more than 2 pages
I need help on this ASAP
Tks
Answer by solver91311(24713) (Show Source):
You can put this solution on YOUR website!
Either share the particular "common algorithm" with which you are dealing, or go ask this question on a Computer Science website.
In general though, if your coefficients are a, b, and c, then the cases would be:
1. a = 0; the code should return a message to the user that this is not a quadratic.
2. b = 0, but a and c not equal to zero and the signs on a and c are opposite: the code should return an answer
3. b = 0, but a and c not equal to zero and the signs on a and c are the same: the code should return either "No solution over the reals" or an answer of depending on whether the algorithm is designed to handle complex number roots or not.
4. b = 0 and c = 0, then x = 0.
5. a, b, and c non-zero, then:
5a. if , then and the single root has a multiplicity of 2.
5b. if , then
5c. if , then the algorithm should return either "No solution over the reals" or an answer of depending on whether the algorithm is designed to handle complex number roots or not.
John

My calculator said it, I believe it, that settles it
|
|
|