Ocean
Ocean::EquationT< T > Class Template Reference

This class provides several functions to solve equations with different degree using floating point values with the precission specified by type T. More...

Static Public Member Functions

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...
 

Detailed Description

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
TType of passed floating point values
See also
Equation, EquationF, EquationD.

Member Function Documentation

◆ 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
aA parameter, with range (-infinity, infinity) \ {0}, (must not be 0)
bB parameter, with range (-infinity, infinity)
cC parameter, with range (-infinity, infinity)
dD parameter, with range (-infinity, infinity)
x1First resulting solution, with range (-infinity, infinity)
x2Second resulting solution, with range (-infinity, infinity)
x3Third resulting solution, with range (-infinity, infinity)
Returns
Number of solutions

◆ solveLinear()

template<typename T >
bool Ocean::EquationT< T >::solveLinear ( const T  a,
const T  b,
T &  x 
)
static

Solves a linear eqation with the form:
ax + b = 0.

Parameters
aA parameter, with range (-infinity, infinity) \ {0}, (must not be 0)
bB parameter, with range (-infinity, infinity)
xResulting 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
aA parameter, with range (-infinity, infinity) \ {0}, (must not be 0)
bB parameter, with range (-infinity, infinity)
cC parameter, with range (-infinity, infinity)
x1First resulting solution, with range (-infinity, infinity)
x2Second 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
aA parameter, with range (-infinity, infinity) \ {0}, (must not be 0)
bB parameter, with range (-infinity, infinity)
cC parameter, with range (-infinity, infinity)
dD parameter, with range (-infinity, infinity)
eE parameter, with range (-infinity, infinity)
xArray 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: