-2
What I want is to find the roots of a polynomial. With this, I created a list with the coefficients of the polynomial and another list with the candidates to be roots. I need to test all of them and find the roots. But it’s not working.
Taking a polynomial for example: x² - 5x + 6
p = [6, -5, 1] #coef. do polinômio
candidatos = [-1, 1, -2, 2, -3, +3, -6, +6]
r = []
resultado = 0
i = 0
while i < len(candidatos) + 1:
for coef in p:
resultado = resultado * k[a] + coef #Briot Ruffini
if resultado == 0:
r.append(k[a])
i = i + 1
print(r)
in place of k[a] consider candidates[i]
– André Menezes
Interesting your code, but I can’t use the Math library but I appreciate the help!
– André Menezes