Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

Ruffini's theroem for polynomial in c++

+4 votes
asked Oct 17, 2021 by Leonardo Tedeschi (160 points)
I need help in order to do a program that solve polynomials with ruffini theorem

2 Answers

+1 vote
answered Oct 17, 2021 by Peter Minarik (101,360 points)
edited Oct 20, 2021 by Peter Minarik

I'm not a mathematician. I am not familiar with the Ruffini Theorem.

After a quick search, this is what I found: https://en.wikipedia.org/wiki/Abel%E2%80%93Ruffini_theorem

The Ruffini Theorem states that

there is no solution in radicals to general polynomial equations of degree five or higher with arbitrary coefficients.

Based on this it is not clear how you want to use this theorem to help you solve polynomials.

Could you please elaborate?

Or are you simply after a program that calculates the solution of a quadratic equation?

0 votes
answered Oct 18, 2021 by Rodrigo Lanes Meneses (140 points)

I guess you mean Ruffini's Rule.
It's also called Briot-Ruffini algorithm.

What it does?

The algorithm consists in reduce a polynomial degree in 1 unit, dividing a polynomial expression by a (x-x0) in the following way:

First, let the polynomial expression be f(x) = a1xn + a2xn-1+ ... + an-1x2 + anx1.

x| a1  a2  a3 ... an-1  an
___________________
      a1  b    c   ...  z     0   

Note that the first coefficient under a1 is also a1 and the one under ais 0.

the values of a1, b, c, ..., z will be the coefficients of the reduced  polynomial, g(x) = a1xn-1 + bxn-2+ ... + yx2 + zx1, due to f(x) = g(x) * (x-x0).

The coefficients of g(x), (b, c, ..., y and z) are calculated by multiplying the number at it's left side for x0, then sum it with the number above it. See the following way:
b = a1 * x+ a2
c = b * x0 + a3
d = c * x0 + a4
...
z = y * x0 + an-1

Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and receive answers from other members of the community.
...