Function mrpt::math::solve_poly4

Function Documentation

int mrpt::math::solve_poly4(double *x, double a, double b, double c, double d) noexcept

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[0], x[1], x[2], x[3], possible multiple roots

  • return 2: 2 real roots x[0], x[1] and complex x[2]+-i*x[3],

  • return 0: two pair of complex roots: x[0]+-i*x[1], x[2]+-i*x[3],

The roots are returned in the first entries of x, i.e. x[0] if N=1, x[0] and x[1] if N=2, etc.

Note

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