NeoPZ
|
Implements a polynomial. Utility. More...
#include <pzpolynomial.h>
Public Member Functions | |
TPZPolynomial () | |
Default constructor. More... | |
TPZPolynomial (const TPZVec< REAL > &coef, const REAL &tol) | |
Constructor based on coef as coefficients and tol as tolerance value. More... | |
TPZPolynomial (const TPZVec< REAL > &coef) | |
Constructor based on coef as coefficients. More... | |
void | SetTolerance (const REAL &tol) |
Sets the tolerance value to computes. More... | |
void | GetTolerance (REAL &tol) |
Gets the tolerance value. More... | |
void | SetCoef (const REAL &c0, const REAL &c1, const REAL &c2, const REAL &c3) |
Sets up four coefficients to polynomial. More... | |
void | SetCoef (const TPZVec< REAL > &coef) |
Sets the coefficients of the polynomial. More... | |
int | GetRoots (const TPZVec< REAL > &coef, TPZVec< REAL > &r) |
On given coefficients computes the roots of the polynomial in r. More... | |
int | GetRoots (TPZVec< REAL > &r) |
Computes the roots of the polynomial in r. More... | |
int | Tartaglia (const TPZVec< REAL > &coef, TPZVec< REAL > &real, REAL &imagem) |
Computes the roots of the cubic polynomial using Tartaglia method (until 3 degree) More... | |
Private Member Functions | |
int | SetRoots () |
Computes the roots of the polynomial and stores into the fReal. More... | |
Private Attributes | |
REAL | fTolerance |
Tolerance value to computes. More... | |
TPZVec< REAL > | fCo |
Polynomial coefficients. More... | |
TPZVec< REAL > | fReal |
Roots of the polynomial. More... | |
REAL | fImagem |
Implements a polynomial. Utility.
Definition at line 19 of file pzpolynomial.h.
TPZPolynomial::TPZPolynomial | ( | ) |
Default constructor.
Definition at line 281 of file pzpolynomial.cpp.
TPZPolynomial::TPZPolynomial | ( | const TPZVec< REAL > & | coef, |
const REAL & | tol | ||
) |
Constructor based on coef as coefficients and tol as tolerance value.
Definition at line 265 of file pzpolynomial.cpp.
References SetCoef(), and SetTolerance().
TPZPolynomial::TPZPolynomial | ( | const TPZVec< REAL > & | coef | ) |
Constructor based on coef as coefficients.
Definition at line 276 of file pzpolynomial.cpp.
References SetCoef().
On given coefficients computes the roots of the polynomial in r.
On given coefficients computes the roots of the polynomial in r, being
Definition at line 162 of file pzpolynomial.cpp.
int TPZPolynomial::GetRoots | ( | TPZVec< REAL > & | r | ) |
Computes the roots of the polynomial in r.
Computes the roots of the polynomial in r, being
Definition at line 150 of file pzpolynomial.cpp.
void TPZPolynomial::GetTolerance | ( | REAL & | tol | ) |
void TPZPolynomial::SetCoef | ( | const REAL & | c0, |
const REAL & | c1, | ||
const REAL & | c2, | ||
const REAL & | c3 | ||
) |
Sets up four coefficients to polynomial.
Sets up four coefficients to polynomial into the fCo.
Definition at line 120 of file pzpolynomial.cpp.
References fabs, and pztopology::SetTolerance().
Referenced by TPZPolynomial().
void TPZPolynomial::SetCoef | ( | const TPZVec< REAL > & | coef | ) |
Sets the coefficients of the polynomial.
Store the given coefficients into fCo.
Definition at line 137 of file pzpolynomial.cpp.
References fabs, and pztopology::SetTolerance().
|
private |
Computes the roots of the polynomial and stores into the fReal.
Sets the roots of the polynomial in r, being
Calculo das outras duas raizes (X[1] e X[2]) b3*x² + b2*x + b1 = 0
Definition at line 169 of file pzpolynomial.cpp.
References fabs, sqrt, teste, and pzgeom::tol.
void TPZPolynomial::SetTolerance | ( | const REAL & | tol | ) |
Sets the tolerance value to computes.
Definition at line 260 of file pzpolynomial.cpp.
References pzgeom::tol.
Referenced by TPZPolynomial().
Computes the roots of the cubic polynomial using Tartaglia method (until 3 degree)
Computes the polynomial roots using Tartaglia method. Returns 0 whether the polynomial is less than third degree.
Returns 1 if the equation has three distinct real roots. Returns 2 if it has three real roots but two of them are same.
Returns -1 if the equation has one real root and two conjudated complex roots.
Definition at line 20 of file pzpolynomial.cpp.
|
private |
Polynomial coefficients.
Definition at line 59 of file pzpolynomial.h.
|
private |
Definition at line 63 of file pzpolynomial.h.
|
private |
Roots of the polynomial.
Definition at line 62 of file pzpolynomial.h.
|
private |
Tolerance value to computes.
Definition at line 56 of file pzpolynomial.h.
Referenced by GetTolerance().