Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem 1. Quadratic Equations A quadratic equation has the form: a x+bx+c=0 The two solutions (called roots) are given by the formula: _-b+Vb - 4ac
Problem 1. Quadratic Equations A quadratic equation has the form: a x+bx+c=0 The two solutions (called roots) are given by the formula: _-b+Vb - 4ac X12=- 2a (1) Write a program with a loop that : a) solves quadratic equations with coefficients read from the terminal, b) visualizes the corresponding quadratic function y=ax'+bx+c using the matplotlib.pyplot module (replacing module pylab used in the book). Details: 1. The program consists of a main while loop (an infinite loop) in which the user is prompted to enter values for coefficients a, b, and c. Assume the user types valid float numbers from the terminal. The program converts the input to float type and then uses formula (1) above to compute solutions X and X2, as follows: if 5 - 4ac 0 then the solutions are distinct and the program displays "two solutions: followed by the values of Xi and X2. To keep the problem simple we can assume that the user never enters a value for coefficient a that is equal to 0. To stop the loop and end the program the user just types the ENTER key instead of the string for coefficient a
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