MAGiC  V5.0
Mailleurs Automatiques de Géometries intégrés à la Cao
ot_root_find.h
Aller à la documentation de ce fichier.
1 //####//------------------------------------------------------------
2 //####//------------------------------------------------------------
3 //####// MAGiC
4 //####// Jean Christophe Cuilliere et Vincent FRANCOIS
5 //####// Departement de Genie Mecanique - UQTR
6 //####//------------------------------------------------------------
7 //####// MAGIC est un projet de recherche de l equipe ERICCA
8 //####// du departement de genie mecanique de l Universite du Quebec a Trois Rivieres
9 //####// http://www.uqtr.ca/ericca
10 //####// http://www.uqtr.ca/
11 //####//------------------------------------------------------------
12 //####//------------------------------------------------------------
13 //####//
14 //####// ot_root_find.h
15 //####//
16 //####//------------------------------------------------------------
17 //####//------------------------------------------------------------
18 //####// COPYRIGHT 2000-2024
19 //####// jeu 13 jun 2024 11:54:00 EDT
20 //####//------------------------------------------------------------
21 //####//------------------------------------------------------------
22 
23 #ifndef ot_root_findH
24 #define ot_root_findH
25 
26 #include <math.h>
27 #include <stdio.h>
28 
29 
30 
32 public:
33 
34  typedef double (*Function)(double,void*);
35 
40  static unsigned ZeroBracOut (Function fn, double &x1, double &x2, void* pvData = 0);
41  static unsigned ZeroBracOut (Function fn, double xStart, double xEnd, double &x1, double &x2, void* pvData);
42 
48  static unsigned ZeroBracIn (Function fn, const double &x1, const double &x2,
49  unsigned n, double xb1[], double xb2[], unsigned nb, void* pvData = 0);
50 
55  static double RootBisect (Function fn, const double &x1, const double &x2, const double &xacc, void* pvData = 0);
56 
61  static double RootFlsPos (Function fn, const double &x1, const double &x2,
62  const double &xacc, void* pvData = 0);
63 
64  /* RootNewton (fn, df, x1, x2, xacc)
65  using the newton-raphson method, find the root of fn in [x1, x2] to an
66  accuracy +/-xacc. df gives the 1st derivative of fn. */
67 
68  static double RootNewton (Function fn, Function df,
69  const double &x1, const double &x2, const double &xacc, void* pvData = 0);
70 
71  /* RootSafe (fn, df, x1, x2, xacc)
72  using a combination of newton-raphson and bisection, find the root of fn
73  in [x1, x2] to an accuracy +/-xacc. df gives the 1st derivative of fn. */
74 
75  static double RootSafe (Function fn, Function df,
76  const double &x1, const double &x2, const double &xacc, void* pvData = 0);
77 };
78 #endif
OT_ROOT_FIND_1D::RootNewton
static double RootNewton(Function fn, Function df, const double &x1, const double &x2, const double &xacc, void *pvData=0)
Definition: ot_root_find.cpp:243
OT_ROOT_FIND_1D::RootBisect
static double RootBisect(Function fn, const double &x1, const double &x2, const double &xacc, void *pvData=0)
Definition: ot_root_find.cpp:158
OT_ROOT_FIND_1D::Function
double(* Function)(double, void *)
Definition: ot_root_find.h:34
OT_ROOT_FIND_1D::RootSafe
static double RootSafe(Function fn, Function df, const double &x1, const double &x2, const double &xacc, void *pvData=0)
Definition: ot_root_find.cpp:266
OT_ROOT_FIND_1D::RootFlsPos
static double RootFlsPos(Function fn, const double &x1, const double &x2, const double &xacc, void *pvData=0)
Definition: ot_root_find.cpp:193
OT_ROOT_FIND_1D::ZeroBracOut
static unsigned ZeroBracOut(Function fn, double &x1, double &x2, void *pvData=0)
Definition: ot_root_find.cpp:36
OT_ROOT_FIND_1D::ZeroBracIn
static unsigned ZeroBracIn(Function fn, const double &x1, const double &x2, unsigned n, double xb1[], double xb2[], unsigned nb, void *pvData=0)
Definition: ot_root_find.cpp:134
OT_ROOT_FIND_1D
Definition: ot_root_find.h:31