muMECH  1.0
polynomialRootSolution.h
Go to the documentation of this file.
1 //********************************************************************************************************
2 // code: ### ### ##### #### ## ##
3 // ## ## ######## ## ## ## ## ##
4 // ## ## ## ## ## ### ## ######
5 // ## ## ## ## ## ## ## ## ##
6 // ##### ## ## ##### #### ## ##
7 // ##
8 //
9 // name: polynomialRootSolution.h
10 // author(s): Jan Novak
11 // language: C, C++
12 // license: This program is free software; you can redistribute it and/or modify
13 // it under the terms of the GNU Lesser General Public License as published by
14 // the Free Software Foundation; either version 2 of the License, or
15 // (at your option) any later version.
16 //
17 // This program is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU Lesser General Public License for more details.
21 //
22 // You should have received a copy of the GNU Lesser General Public License
23 // along with this program; if not, write to the Free Software
24 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 //********************************************************************************************************
32 #ifndef MUMECH_POL_ROOTS_SOLU_H
33 #define MUMECH_POL_ROOTS_SOLU_H
34 
35 #include <complex>
36 
37 
38 namespace mumech {
39 
40 //macros and variables definitions
41 #define _MACHINE_EPS_ 1E-100
42 #define _sgrt3div2_ 0.8660254037844386
43 
44 //definition of the complex type
45 typedef struct{
46  double a, b;
47 } _COMPLEX;
48 
51 {
52  public:
57 
58 
61  std::complex<double> * GetCubicPolyRoots( double a, double b, double c, std::complex<double> * roots );
62 
63 
66  std::complex<double>* GetCubicPolyRoots( std::complex<double> a, std::complex<double> b, std::complex<double> c,
67  std::complex<double>* roots );
68 
69 
70  static void GauLegF(double *x, double *w, const int nPoints, const double minLim, const double maxLim);
71  static void GauHerQ(double *x, double *w, const int nPoints);
72 
73 };
74 
75 } // end of namespace mumech
76 
77 #endif // end of MUMECH_POL_ROOTS_SOLU_H
78 
79 /*end of file*/
std::complex< double > * GetCubicPolyRoots(double a, double b, double c, std::complex< double > *roots)
Function gives the analitical solution of cubic furmula of the real coefficients a, b, c x^3 + ax^2 + bx + c = 0.
static void GauLegF(double *x, double *w, const int nPoints, const double minLim, const double maxLim)
virtual ~polynomialRootSolution()
Destructor.
static void GauHerQ(double *x, double *w, const int nPoints)
Class polynomialRootSolution collects functions calculating the roots of polynomial functions...