Write a program (script) to solve the quadratic equation ax^2+bx+c=0 for any val
ID: 3649668 • Letter: W
Question
Write a program (script) to solve the quadratic equation ax^2+bx+c=0 for any values of user inputs a, b, and c. Your program should improve on the solution of the book by checking for all input possibilities of a, b, and c including zeros.Explanation / Answer
Remembering that the Quadratic function maps from C -> C, write the equation as az^2 + bz + c = 0, where z = x + yi. a*(x + yi)^2 + b(x + yi) + c = 0 ax^2 - 2axyi - ay^2 + bx + byi + c = 0 The real and imaginary terms must both sum to 0. ax^2 - ay^2 + bx + c = 0 2axyi + byi = 0 Solving for x and y, x = -b / 2a y = ±sqrt(4ac - b^2) / 2a
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.