- Related Questions & Answers
- What is the difference between Enumeration interface and enum in Java?
- Absolute and Relative frequency in Pandas
- Absolute Deviation and Absolute Mean Deviation using NumPy
- What is the difference between throw e and throw new Exception(e) in catch block in java?
- What is the difference between selenium and automation?
- What is difference between selenium 1 and Selenium 2
- Difference between import and package in Java?
- Difference between the byte stream and character stream classes in Java?
- Array element with minimum sum of absolute differences?
- Arrange first N natural numbers such that absolute difference between all adjacent elements > 1?
- What is difference between onCreate() and onStart() on Android?
- Print values of ‘a’ in equation (a+b) <= n and a+b is divisible by x
- What is the difference between selenium WebDriver and TestNG?
- What is difference between selenium 2 and selenium 3?
- C Program for Difference between sums of odd and even digits?

- 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