Main MRPT website > C++ reference for MRPT 1.9.9
poly_roots.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #pragma once
11 
12 #include <cstdlib>
13 #include <mrpt/utils/mrpt_macros.h>
14 
15 namespace mrpt
16 {
17 namespace math
18 {
19 /** @addtogroup polynomial_roots Find polynomial roots (`#include
20  * <mrpt/math/poly_roots.h>`)
21  * \ingroup mrpt_base_grp
22  * @{ */
23 
24 /** Solves cubic equation `x^3 + a*x^2 + b*x + c = 0`. Returns the number of
25  * real roots `N`<=3.
26  * The roots are returned in the first entries of `x`, i.e. `x[0]` if N=1,
27  * `x[0]` and `x[1]` if N=2, etc.
28  * \param x array of size 3
29  * \note Based on `poly34.h`, by Khashin S.I.
30  * http://math.ivanovo.ac.ru/dalgebra/Khashin/index.html - khash2 (at) gmail.com
31  */
32 int solve_poly3(double* x, double a, double b, double c) noexcept;
33 
34 /** Solves quartic equation `x^4 + a*x^3 + b*x^2 + c*x + d = 0` by Dekart-Euler
35  * method.
36  * Returns the number of real roots `N`<=4:
37  * - return 4: 4 real roots x[0], x[1], x[2], x[3], possible multiple roots
38  * - return 2: 2 real roots x[0], x[1] and complex x[2]+-i*x[3],
39  * - return 0: two pair of complex roots: x[0]+-i*x[1], x[2]+-i*x[3],
40  *
41  * The roots are returned in the first entries of `x`, i.e. `x[0]` if N=1,
42  * `x[0]` and `x[1]` if N=2, etc.
43  * \param x array of size 4
44  * \note Based on `poly34.h`, by Khashin S.I.
45  * http://math.ivanovo.ac.ru/dalgebra/Khashin/index.html - khash2 (at) gmail.com
46  */
47 int solve_poly4(double* x, double a, double b, double c, double d) noexcept;
48 
49 /** Solves equation `x^5 + a*x^4 + b*x^3 + c*x^2 + d*x + e = 0`.
50  * Returns the number of real roots `N`<=5.
51  * The roots are returned in the first entries of `x`, i.e. `x[0]` if N=1,
52  * `x[0]` and `x[1]` if N=2, etc.
53  * \param x array of size 5
54  * \note Based on `poly34.h`, by Khashin S.I.
55  * http://math.ivanovo.ac.ru/dalgebra/Khashin/index.html - khash2 (at) gmail.com
56  */
57 int solve_poly5(
58  double* x, double a, double b, double c, double d, double e) noexcept;
59 
60 /** Solve equation x^4 + b*x^2 + d = 0 */
61 int solve_poly4Bi(double* x, double b, double d) noexcept;
62 /** Solve equation x^4 + b*x^2 + c*x + d = 0 */
63 int solve_poly4De(double* x, double b, double c, double d) noexcept;
64 
65 /** Solves equation `a*x^2 + b*x + c = 0`.
66  * Returns the number of real roots: either 0 or 2; or 1 if a=0 (in this case
67  * the root is in r1).
68  * r1, r2 are the roots. (r1<=r2)
69  * \note Based on `poly34.h`, by Khashin S.I.
70  * http://math.ivanovo.ac.ru/dalgebra/Khashin/index.html - khash2 (at) gmail.com
71  */
72 int solve_poly2(double a, double b, double c, double& r1, double& r2) noexcept;
73 
74 /** @} */
75 
76 } // End of MATH namespace
77 
78 } // End of namespace
int solve_poly5(double *x, double a, double b, double c, double d, double e) noexcept
Solves equation x^5 + a*x^4 + b*x^3 + c*x^2 + d*x + e = 0.
Definition: poly_roots.cpp:388
int solve_poly4De(double *x, double b, double c, double d) noexcept
Solve equation x^4 + b*x^2 + c*x + d = 0.
const GLubyte * c
Definition: glext.h:6313
int 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. ...
Definition: poly_roots.cpp:254
GLubyte GLubyte b
Definition: glext.h:6279
int solve_poly4Bi(double *x, double b, double d) noexcept
Solve equation x^4 + b*x^2 + d = 0.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
GLenum GLint x
Definition: glext.h:3538
GLubyte GLubyte GLubyte a
Definition: glext.h:6279
int solve_poly3(double *x, double a, double b, double c) noexcept
Solves cubic equation x^3 + a*x^2 + b*x + c = 0.
Definition: poly_roots.cpp:29
int solve_poly2(double a, double b, double c, double &r1, double &r2) noexcept
Solves equation a*x^2 + b*x + c = 0.
Definition: poly_roots.cpp:401



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019