The quadratic formula is used to solve a very specific type of equation, called a quadratic equation. These equations are usually written in the following form: ax2 + bx + c = 0 The Quadratic Formula x = ( -b ± √( b^2 - 4ac ) ) / ( 2a ) Where a, b, and c are constants with a ≠ 0. (If a = 0, the equation is a linear equation.) The discriminant is the part of the formula in the square root. If the value of the discriminant is zero then the equation has a single real root. If the value of the discriminant is positive then the equation has two real roots. If the value of the discriminant is negative, then the equation has two complex roots. Write a program that finds the roots of the quadratic equation using the Quadratic Formula. Write a function named discriminant in the file, Disc.py, to calculate and return the discriminant of the formula. Let the main function call the discriminant function and then calculate the solution(s) of the equation. Do not calculate the solutions in the discriminant functions. Allow the user to run the program as many times as possible until a sentinel value of zero (0), has been entered for the coefficient A. Include the recommended minimum documentation for each function. See the program one template for more details. Do not use any global variables. Run your program at least four times with the data below. Copy and paste the output to a file. Run 1 Run 2 Run 3 Run 4 a = 1 a = 1 a = 2 a = 4 b = 2 b = -12 b = 9 b = 6 c = -8 c = 36 c = -5 c = 20
COSC 1336 –
Program 8 – Simple Functions
Write in Python Program:
The quadratic formula is used to solve a very specific type of equation, called a quadratic equation. These equations are usually written in the following form:
ax2 + bx + c = 0
The Quadratic Formula
x = ( -b ± √( b^2 - 4ac ) ) / ( 2a )
Where a, b, and c are constants with a ≠ 0. (If a = 0, the equation is a linear equation.)
The discriminant is the part of the formula in the square root. If the value of the discriminant is zero then the equation has a single real root. If the value of the discriminant is positive then the equation has two real roots. If the value of the discriminant is negative, then the equation has two complex roots.
Write a program that finds the roots of the quadratic equation using the Quadratic Formula. Write a function named discriminant in the file, Disc.py, to calculate and return the discriminant of the formula. Let the main function call the discriminant function and then calculate the solution(s) of the equation. Do not calculate the solutions in the discriminant functions. Allow the user to run the program as many times as possible until a sentinel value of zero (0), has been entered for the coefficient A. Include the recommended minimum documentation for each function. See the program one template for more details.
Do not use any global variables.
Run your program at least four times with the data below. Copy and paste the output to a file.
Run 1 Run 2 Run 3 Run 4
a = 1 a = 1 a = 2 a = 4
b = 2 b = -12 b = 9 b = 6
c = -8 c = 36 c = -5 c = 20
Please read the requirements and follow them.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 8 images