Question: using python 3.9 please!! x= Exercise 4.2: Quadratic equations Consider a quadratic equation ax2 + bx +c=0 that has real solutions. a) Write a program
x= Exercise 4.2: Quadratic equations Consider a quadratic equation ax2 + bx +c=0 that has real solutions. a) Write a program that takes as input the three numbers, a, b, and c, and prints out the two solutions using the standard formula -b + b2 - 4ac 2a Use your program to compute the solutions of 0.001x2 + 1000x +0.001 = 0.1 b) There is another way to write the solutions to a quadratic equation. Multiplying top and bottom of the solution above by -b Fb2 - 4ac, show that the solutions can also be written as 20 x= -b + b2 - 4ac Add further lines to your program to print these values in addition to the earlier ones and again use the program to solve 0.001x2 + 1000x + 0.001 0. What do you see? How do you explain it? c) Using what you have learned, write a new program that calculates both roots of a quadratic equation accurately in all cases. This is a good example of how computers don't always work the way you expect them to. If you simply apply the standard formula for the quadratic equation, the computer will sometimes get the wrong answer. In practice the method you have worked out here is the correct way to solve a quadratic equation on a computer, even though it's more complicated than the standard formula. If you were writing a program that involved solving many quadratic equations this method might be a good candidate for a user- defined function: you could put the details of the solution method inside a function to save yourself the trouble of going through it step by step every time you have a new equation to solve
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
