Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Task 1 : Absolute Difference between roots of Quadratic equations [ 3 0 marks ] There are many kinds of equations to solve in algebra.
Task : Absolute Difference between roots of Quadratic equations 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 where is the variable, and and
are the coefficients of the equation. In Brahmagupta explicitly described the general formula to be:
Assuming that 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 and of a quadratic equation. You may assume that rootAbsDiff is always called with the
three coefficients such that 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 builtin function in Python to help you calculate absolute values.
Complete the definition of rootAbsDiff, and test its correctness in Python shell, as follows:
rootAbsDiff
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