npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0
findRootUsingBisections.hh
Go to the documentation of this file.
1 #ifndef NPSTAT_FINDROOTUSINGBISECTIONS_HH_
2 #define NPSTAT_FINDROOTUSINGBISECTIONS_HH_
3 
4 /*!
5 // \file findRootUsingBisections.hh
6 //
7 // \brief Root finding with the bisection method
8 //
9 // Author: I. Volobouev
10 //
11 // October 2017
12 */
13 
15 
16 namespace npstat {
17  /**
18  // Numerical equation solving for 1-d functions using interval division.
19  //
20  // Input arguments are as follows:
21  //
22  // f -- The functor making up the equation to solve: f(x) == rhs.
23  // The comparison operator "<" must be defined for the Result
24  // type.
25  //
26  // rhs -- The "right hand side" of the equation.
27  //
28  // x0, x1 -- The starting interval for the search.
29  //
30  // tol -- Tolerance parameter. Typically, the found solution
31  // will be within a factor of 1 +- tol of the real one.
32  //
33  // root -- Location where the root will be written. This could
34  // also be a discontinuity point of f(x) or a singularity.
35  //
36  // The function returns "false" in case the initial interval does not
37  // bracket the root. In this case *root is not modified.
38  */
39  template <typename Result, typename Arg1>
41  Result rhs, Arg1 x0, Arg1 x1,
42  Arg1 tol, Arg1* root);
43 }
44 
45 #include "npstat/nm/findRootUsingBisections.icc"
46 
47 #endif // NPSTAT_FINDROOTUSINGBISECTIONS_HH_
Interface definitions and concrete simple functors for a variety of functor-based calculations.
Definition: AbsArrayProjector.hh:14
bool findRootUsingBisections(const Functor1< Result, Arg1 > &f, Result rhs, Arg1 x0, Arg1 x1, Arg1 tol, Arg1 *root)
Definition: SimpleFunctors.hh:58