- Related Questions & Answers
- Finding roots of a quadratic equation – JavaScript
- Difference between product and sum of digits of a number in JavaScript
- Difference between sum and product of an array in JavaScript
- Absolute Difference between the Product 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
- C program to find the Roots of Quadratic equation
- Absolute Difference between the Sum of Non-Prime numbers and Prime numbers of an Array?
- Product sum difference of digits of a number in JavaScript
- Python program to find sum of absolute difference between all pairs in a list
- Difference Between Product and Process
- Maximum sum of absolute difference of any permutation in C++
- How to write a C program to find the roots of a quadratic equation?
- Difference between sum of square and square of sum in JavaScript
- Absolute difference between the first X and last X Digits of N?

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

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 ∣−𝑏∕𝑎− 𝑒∕𝑎∣ ∣

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

#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); }

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

Advertisements