Function mrpt::math::solve_poly3

Function Documentation

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

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[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 3