Answered step by step
Verified Expert Solution
Link Copied!

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 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
image text in transcribed

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

Hands-On Database

Authors: Steve Conger

2nd Edition

0133024415, 978-0133024418

More Books

Students also viewed these Databases questions

Question

Explain the focus of safety programs.

Answered: 1 week ago

Question

Describe the consequences of musculoskeletal disorders.

Answered: 1 week ago