I have a quintic function (5th degree polynomial) and I would like to solve it in C++. Is there an implementation or a math library I can use in order to proceed?
-
perhaps this is of interest? http://www.boost.org/doc/libs/1_37_0/libs/math/doc/sf_and_dist/html/math_toolkit/toolkit/internals1/roots2.html – Johan Lundberg Sep 30 '12 at 10:15
-
Can you elaborate on the numerical method comment? – topless Sep 30 '12 at 10:15
-
http://mathworld.wolfram.com/QuinticEquation.html – nhahtdh Sep 30 '12 at 10:17
-
1I don't get the reason for down voting or the close inquiry. – topless Sep 30 '12 at 10:22
3 Answers
Boost has this. Have a look here:
http://www.boost.org/doc/libs/1_51_0/libs/math/doc/sf_and_dist/html/math_toolkit/toolkit/internals1/roots2.html http://www.boost.org/doc/libs/1_51_0/libs/math/doc/sf_and_dist/html/math_toolkit/toolkit/internals2/polynomials.html
Description
These functions solve the root of some function f(x) without the need for the derivatives of f(x). The functions here that use TOMS Algorithm 748 are asymptotically the most efficient known, and have been shown to be optimal for a certain classes of smooth functions.
Alternatively, there is a simple bisection routine which can be useful in its own right in some situations, or alternatively for narrowing down the range containing the root, prior to calling a more advanced algorithm.
Unfortunately these libraries are not beginner friendly, and I could not yet find an example on how to use them. Answer delivered as-is for now. For now, have a look here http://programmingexamples.net/wiki/CPP/Boost/Math/Tools/TOMS748
You should be able to plug in a boost polynomial instead of t.

- 26,184
- 12
- 71
- 97
I have a quintic function (5th degree polyonimial) and I would like to solve it in C++.
There's a problem here, a rather famous one. There's a simple solution to quadratic equations. Cubic equations are a bit tougher. One way to solve them analytically is via Cardano's method. Quartic equations are tougher yet, but still can be solved analytically.
And that's where it ends. There is no formula for the roots of a fifth degree polynomial equation (or higher) that can be written in terms of the coefficients of the polynomial and only uses the standard algebraic operations. An entire branch of mathematics, Galois theory, resulted from one of the proofs that a general purpose analytic solution for quintics does not exist.
What that means is that you will have to resort to numerical root finding techniques.

- 32,454
- 9
- 60
- 108
Maybe this can solve your problem: http://www.gnu.org/software/gsl/manual/html_node/General-Polynomial-Equations.html

- 761
- 5
- 12