0

Someone asked to solve this polynomial just for fun: x^765+x-400
This is my attempt in solving it.

m=zeros(785,1);
mtrans= m'
mtrans(1)=1;
mtrans(784)=1;
mtrans(785)=-400;
roots(mtrans)

However I don't understand my output is it all the roots that this polynomial has? In addition, assuming that the output is a root, when I tried to plug in the numbers it does not equal to 0.

Anonymous
  • 21
  • 6
  • I get 785 roots. Your polynomial has degree 785. So I'd say it's correct, isn't it? Plugging back will give a small number but not necessarily 0, due [to rounding issues](http://stackoverflow.com/questions/686439/why-is-24-0000-not-equal-to-24-0000-in-matlab) – Luis Mendo Mar 29 '17 at 20:38
  • its not even close to zero, thats the problem – Anonymous Mar 29 '17 at 20:42
  • 1
    WIth `x = roots(mtrans)`, I get `max(abs(polyval(mtrans, x)))` equal to `1.4190e-08`. Not that bad, I think – Luis Mendo Mar 29 '17 at 20:43

1 Answers1

1

Use a Newton-Raphson technique. From a polynomial degree of 5, there is no analytical solution. With other words, there is no other way than using optimizer. And the land of optimizer is vast. Newton-Raphson is a very standard technique. In your case you will have n (#polynomial degree) solutions, that means you will have to seek a good one that is insensitive to your initial guess.

Armen Avetisyan
  • 1,140
  • 10
  • 29