Find polynomial roots (`#include

<mrpt/math/poly_roots.h>`)

// global functions

int mrpt::math::solve_poly3(double* x, double a, double b, double c);
int mrpt::math::solve_poly4(double* x, double a, double b, double c, double d);
int mrpt::math::solve_poly5(double* x, double a, double b, double c, double d, double e);
int mrpt::math::solve_poly4Bi(double* x, double b, double d);
int mrpt::math::solve_poly4De(double* x, double b, double c, double d);
int mrpt::math::solve_poly2(double a, double b, double c, double& r1, double& r2);

Global Functions

int mrpt::math::solve_poly3(double* x, double a, double b, double c)

Solves cubic equation x^3 + a*x^2 + b*x + c = 0.

Returns the number of real roots N <=3. The roots are returned in the first entries of x, i.e. x if N=1, x and x if N=2, etc. Based on poly34.h, by Khashin S.I. http://math.ivanovo.ac.ru/dalgebra/Khashin/index.html - khash2 (at) gmail.com

Parameters:

 x array of size 3
int mrpt::math::solve_poly4(double* x, double a, double b, double c, double d)

Solves quartic equation x^4 + a*x^3 + b*x^2 + c*x + d = 0 by Dekart-Euler method.

Returns the number of real roots N <=4:

• return 4: 4 real roots x, x, x, x, possible multiple roots

• return 2: 2 real roots x, x and complex x+-i*x,

• return 0: two pair of complex roots: x+-i*x, x+-i*x,

The roots are returned in the first entries of x, i.e. x if N=1, x and x if N=2, etc. Based on poly34.h, by Khashin S.I. http://math.ivanovo.ac.ru/dalgebra/Khashin/index.html - khash2 (at) gmail.com

Parameters:

 x array of size 4
int mrpt::math::solve_poly5(
double* x,
double a,
double b,
double c,
double d,
double e
)

Solves equation x^5 + a*x^4 + b*x^3 + c*x^2 + d*x + e = 0.

Returns the number of real roots N <=5. The roots are returned in the first entries of x, i.e. x if N=1, x and x if N=2, etc. Based on poly34.h, by Khashin S.I. http://math.ivanovo.ac.ru/dalgebra/Khashin/index.html - khash2 (at) gmail.com

Parameters:

 x array of size 5
int mrpt::math::solve_poly4Bi(double* x, double b, double d)

Solve equation x^4 + b*x^2 + d = 0.

int mrpt::math::solve_poly4De(double* x, double b, double c, double d)

Solve equation x^4 + b*x^2 + c*x + d = 0.

int mrpt::math::solve_poly2(
double a,
double b,
double c,
double& r1,
double& r2
)

Solves equation a*x^2 + b*x + c = 0.

Returns the number of real roots: either 0 or 2; or 1 if a=0 (in this case the root is in r1). r1, r2 are the roots. (r1<=r2) Based on poly34.h, by Khashin S.I. http://math.ivanovo.ac.ru/dalgebra/Khashin/index.html - khash2 (at) gmail.com