Question: Task 1 : Absolute Difference between roots of Quadratic equations [ 3 0 marks ] There are many kinds of equations to solve in algebra.

Task 1: Absolute Difference between roots of Quadratic equations [30 marks]
There are many kinds of equations to solve in algebra. One of the most common kind of equations are
quadratic equations, which come in the form of ax2+bx+c=0, where x is the variable, and a,b and c
are the coefficients of the equation. In 628AD, Brahmagupta explicitly described the general formula to be:
x=-b+-b2-4ac22a
Assuming that b24ac holds, the equation will have two real roots (which might be equal).
You are given an incomplete code for a Python function rootAbsDiff ) that takes in the three
coefficients a,b, and c of a quadratic equation. You may assume that rootAbsDiff is always called with the
three coefficients such that b24ac. Every time when it is called, rootAbsDiff calculates the two roots of
the equation and returns the absolute difference between the two roots.
You may use the sqrt function from the math library to help you calculate square roots. You might also
use the abs function (which is a built-in function in Python to help you calculate absolute values.)
Complete the definition of rootAbsDiff, and test its correctness in Python shell, as follows:
rootAbsDiff(1,2,1)
0.0
 Task 1: Absolute Difference between roots of Quadratic equations [30 marks]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!