This class provides several functions to solve equations with different degree using floating point values with the precission specified by type T.
More...
|
static bool | solveLinear (const T a, const T b, T &x) |
| Solves a linear eqation with the form:
ax + b = 0. More...
|
|
static bool | solveQuadratic (const T a, const T b, const T c, T &x1, T &x2) |
| Solves an quadratic equation with the form:
ax^2 + bx + c = 0. More...
|
|
static unsigned int | solveCubic (const T a, const T b, const T c, const T d, T &x1, T &x2, T &x3) |
| Solves a cubic equation with the from:
ax^3 + bx^2 + cx + d = 0. More...
|
|
static unsigned int | solveQuartic (const T a, const T b, const T c, const T d, const T e, T *x) |
| Solves a quartic equation with the form:
ax^4 + bx^3 + cx^2 + dx + e = 0. More...
|
|
template<typename T>
class Ocean::EquationT< T >
This class provides several functions to solve equations with different degree using floating point values with the precission specified by type T.
- Template Parameters
-
T | Type of passed floating point values |
- See also
- Equation, EquationF, EquationD.
◆ solveCubic()
template<typename T >
unsigned int Ocean::EquationT< T >::solveCubic |
( |
const T |
a, |
|
|
const T |
b, |
|
|
const T |
c, |
|
|
const T |
d, |
|
|
T & |
x1, |
|
|
T & |
x2, |
|
|
T & |
x3 |
|
) |
| |
|
static |
Solves a cubic equation with the from:
ax^3 + bx^2 + cx + d = 0.
- Parameters
-
a | A parameter, with range (-infinity, infinity) \ {0}, (must not be 0) |
b | B parameter, with range (-infinity, infinity) |
c | C parameter, with range (-infinity, infinity) |
d | D parameter, with range (-infinity, infinity) |
x1 | First resulting solution, with range (-infinity, infinity) |
x2 | Second resulting solution, with range (-infinity, infinity) |
x3 | Third resulting solution, with range (-infinity, infinity) |
- Returns
- Number of solutions
◆ solveLinear()
Solves a linear eqation with the form:
ax + b = 0.
- Parameters
-
a | A parameter, with range (-infinity, infinity) \ {0}, (must not be 0) |
b | B parameter, with range (-infinity, infinity) |
x | Resulting solution |
- Returns
- True, if succeeded
◆ solveQuadratic()
template<typename T >
bool Ocean::EquationT< T >::solveQuadratic |
( |
const T |
a, |
|
|
const T |
b, |
|
|
const T |
c, |
|
|
T & |
x1, |
|
|
T & |
x2 |
|
) |
| |
|
static |
Solves an quadratic equation with the form:
ax^2 + bx + c = 0.
- Parameters
-
a | A parameter, with range (-infinity, infinity) \ {0}, (must not be 0) |
b | B parameter, with range (-infinity, infinity) |
c | C parameter, with range (-infinity, infinity) |
x1 | First resulting solution, with range (-infinity, infinity) |
x2 | Second resulting solution, with range (-infinity, infinity) |
- Returns
- True, if succeeded
◆ solveQuartic()
template<typename T >
unsigned int Ocean::EquationT< T >::solveQuartic |
( |
const T |
a, |
|
|
const T |
b, |
|
|
const T |
c, |
|
|
const T |
d, |
|
|
const T |
e, |
|
|
T * |
x |
|
) |
| |
|
static |
Solves a quartic equation with the form:
ax^4 + bx^3 + cx^2 + dx + e = 0.
- Parameters
-
a | A parameter, with range (-infinity, infinity) \ {0}, (must not be 0) |
b | B parameter, with range (-infinity, infinity) |
c | C parameter, with range (-infinity, infinity) |
d | D parameter, with range (-infinity, infinity) |
e | E parameter, with range (-infinity, infinity) |
x | Array with at least four scalar values receiving the (at most) four solutions |
- Returns
- Number of solutions
y^4 + alpha * y^2 + beta * y + gamma = 0
The documentation for this class was generated from the following file: