ESyS-Particle  2.3.4
CubicEquation Class Reference

A class for a cubic equation. Used for eigenvalue calculation on 3D matrices. More...

#include <cube_eq.h>

Public Member Functions

 CubicEquation (double, double, double)
 
set< double > getRealRoots (double)
 

Private Member Functions

double bisect (double, double, double)
 
double f (double)
 

Private Attributes

double m_a
 
double m_b
 
double m_c
 

Detailed Description

A class for a cubic equation. Used for eigenvalue calculation on 3D matrices.

Author
Steffen Abe $Revision$ $Date$

Constructor & Destructor Documentation

◆ CubicEquation()

CubicEquation::CubicEquation ( double  a,
double  b,
double  c 
)

construct cubic equation of the form x^3+ax^2+bx+c

Parameters
acoefficient for x^2
bcoefficient for x
cconstant coefficient

References m_a, m_b, and m_c.

Member Function Documentation

◆ bisect()

double CubicEquation::bisect ( double  x_0,
double  x_1,
double  tol 
)
private

References f().

Referenced by getRealRoots().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ f()

double CubicEquation::f ( double  x)
private

return x^3+ax^2+bx+c

Parameters
x

References m_a, m_b, and m_c.

Referenced by bisect(), and getRealRoots().

Here is the caller graph for this function:

◆ getRealRoots()

set< double > CubicEquation::getRealRoots ( double  tol)

Get the roots. Get one root (r_1) by a bisection method and the other 2 (if real) by solving the quadratic equation resulting from dividing the eqation by (x-r_1). Returns the roots as a STL-set so they are ordered.

Parameters
tolthe precision of the calculation
validreturns the validity of the result, i.e. if valid==false there was no positive root found

References bisect(), f(), m_a, m_b, and m_c.

Referenced by Matrix3::eigen().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_a

double CubicEquation::m_a
private

Referenced by CubicEquation(), f(), and getRealRoots().

◆ m_b

double CubicEquation::m_b
private

Referenced by CubicEquation(), f(), and getRealRoots().

◆ m_c

double CubicEquation::m_c
private

Referenced by CubicEquation(), f(), and getRealRoots().


The documentation for this class was generated from the following files: