Reference no: EM132355402
Question
1 You need help to write this programe in python ...#The roots (solutions) to the quadratic equation
ax2 +bx+c = 0 is given by the well-known formula
x = 2a
-b ± √b -4ac
2 Write a program that takes the three coefficients a, b, and c as input, computes and displays the solutions according to the aforementioned formula. Note the ± in the numerator means there are two answers. But this will not apply if a is zero, so that condition must be checked separately; design your program such that:
1. If a = 0 and b = 0 and c = 0, it prints "solution is indeterminate!".
2. If a = 0 and b = 0 but c =/ 0 ,it prints "there is no solution".
3. If a = 0 but b =/ 0 and c =/ 0 , it prints "equation is linear", computes the solution as x = -c/b and display it.
The above formula also fails to work (for real numbers) if the expression under the square root is negative. That expression b ac is called the discriminant of the 2 - 4 quadratic. Define that as a separate variable d and check its sign:
1. If d > 0 then there are two real roots given by the formula above.
2. If d = 0 then the roots are loaded and equal to -b/2a.
3. If d < 0 then there is no real solution (roots are complex numbers).