Answered step by step
Verified Expert Solution
Question
1 Approved Answer
write a python program to calculate the roots of ax 2 + bx + c = 0 Insert a test to cover the special cases
write a python program to calculate the roots of ax2 + bx + c = 0
Insert a test to cover the special cases a = 0 and a = b = 0. (Here it would be nice, but not required, to have your code write the solution to a linear equation.)
Insert a test to quit if the roots are not real.
Compute the roots using the standard formula
x = [-b +/- sqrt(b^2 - 4*a*c)]/(2*a)
and using the alternative formula
x = 2*c/[-b -/+ sqrt(b^2 - 4*a*c)]
run the program for these cases
Then run your program for the cases
a = 0.02, b = 2, c = 4 a = 2e-8, b = 3, c = 5 a = 2e-8, b = 8, c = 1e-7
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started