- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies

- 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 Articles
- Difference between product and sum of digits of a number in JavaScript
- Absolute Difference between the Product of Non-Prime numbers and Prime numbers of an Array?
- Difference between sum and product of an array in JavaScript
- Absolute Difference between the Sum of Non-Prime numbers and Prime numbers of an Array?
- Python program to find sum of absolute difference between all pairs in a list
- Maximum sum of absolute difference of any permutation in C++
- Product sum difference of digits of a number in JavaScript
- Difference between an Absolute URL and a Relative URL
- Print all n-digit numbers with absolute difference between sum of even and odd digits is 1 in C++
- Find N integers with given difference between product and sum in C++
- Absolute difference between the first X and last X Digits of N?
- Difference Between Product and Process
- Finding roots of a quadratic equation – JavaScript
- Difference between sum of square and square of sum in JavaScript
- Absolute sum of array elements - JavaScript

Advertisements