- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# Absolute difference between sum and product of roots of a quartic equation?

In this section we will see how to get the absolute difference between the sum of the roots and the products of the root of a quartic equation?

The quartic equation is like 𝑎𝑥^{4}+𝑏𝑥^{3}+𝑐𝑥^{2}+𝑑𝑥+𝑒

We can solve the equation and then try to get the product and sum of the roots by some normal process, but that takes much time and that approach is not so efficient. In this kind of equation, we have two formulae. The Sum of roots are always −𝑏∕𝑎 and the product of roots are always 𝑒∕𝑎 . So we have to find only the value of ∣−𝑏∕𝑎− 𝑒∕𝑎∣ ∣

## Algorithm

### rootSumProdDiff(a, b, c, d, e)

begin sum := -b/a prod := e/a return |sum - prod| end

## Example

#include<iostream> #include<cmath> using namespace std; double rootSumProdDiff(double a, double b, double c, double d, double e){ double sum = double(-b/a); double prod = double(e/a); return abs(sum - prod); } main() { double a,b,c,d,e; cout << "Enter a, b, c, d, e for equation ax^4 + bx^3 + cx^2 + dx + e:"; cin >> a >> b >> c >> d >> e; cout << "Difference between sum and product of roots are: " << rootSumProdDiff(a, b, c, d, e); }

## Output

Enter a, b, c, d, e for equation ax^4 + bx^3 + cx^2 + dx + e:8 4 6 4 1 Difference between sum and product of roots are: 0.625

- Related Questions & Answers
- Difference between product and sum of digits of a number in JavaScript
- Difference between sum and product of an array in JavaScript
- Finding roots of a quadratic equation – JavaScript
- Absolute Difference between the Product of Non-Prime numbers and Prime numbers of an Array?
- Absolute Difference between the Sum of Non-Prime numbers and Prime numbers of an Array?
- Java program to find the roots of a quadratic equation
- C++ Program to Find All Roots of a Quadratic Equation
- Java Program to Find all Roots of a Quadratic Equation
- C program to find the Roots of Quadratic equation
- Product sum difference of digits of a number in JavaScript
- Python program to find sum of absolute difference between all pairs in a list
- Maximum sum of absolute difference of any permutation in C++
- Difference Between Product and Process
- Difference between sum of square and square of sum in JavaScript
- How to write a C program to find the roots of a quadratic equation?

Advertisements