Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Polynomial inverse

I have a polynomial of the fifth order:

y = ax5 + bx4 + cx3 + dx2 + ex + f

The coefficients a-f are known and I need to calculate x for a given y. I could probably use the Newton-Raphson algorithm or similar, but would prefer a non-iterative solution if possible.

Edit: I guess I didn't think this through enough before posting my question. My polynomial coefficients have been calculated from sampled data and in this special case there is only one root. It didn't pass my mind that there, of course, might be five different roots in the general case. I think I will fit the sampled data to an inverse polynomial as well, and use that to calculate x from y.

like image 413
Anlo Avatar asked May 02 '26 16:05

Anlo


1 Answers

Finding roots of polynomials is difficult and tricky. Getting a stable robust algorithm will get you headache. Newton + root removal seems a great idea, but making this work correctly is really painful.

One obvious problem is the stability of the root removal. One other problem is complex roots. One more difficult problem is (numerically) multiple roots, where you lose a lot of precision.

The state-of-art black box algorithm is Jenkins-Traub. However, it is difficult to implement so you will have to find (or pay for) an implementation somewhere.

Nevertheless, if you have access to a linear alebra package, a simple, robust, stable, and efficient way is to compute the eigenvalues of the companion matrix. This is what eg. GSL does.

like image 87
Alexandre C. Avatar answered May 05 '26 07:05

Alexandre C.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!