Answered step by step
Verified Expert Solution
Link Copied!

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Filing And Computer Database Projects

Authors: Jeffrey Stewart

2nd Edition

007822781X, 9780078227813

Students also viewed these Databases questions

Question

State the importance of control

Answered: 1 week ago

Question

What are the functions of top management?

Answered: 1 week ago

Question

Bring out the limitations of planning.

Answered: 1 week ago

Question

Why should a business be socially responsible?

Answered: 1 week ago