Planetary Orbital Evolution due to Tides
Orbital evolution of two objects experiencing tides
All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Modules Pages
InverseFunction.h
Go to the documentation of this file.
1 
11 #ifndef __INVERSE_FUNCTION_H
12 #define __INVERSE_FUNCTION_H
13 
14 #include "../../Core/Functions.h"
15 #include "../../Core/InterpSolutionIterator.h"
16 #include <gsl/gsl_roots.h>
17 
27 private:
30 
33  double __tolerance;
34 
36  gsl_root_fsolver *__solver;
37 
39  gsl_function_fdf __solver_fdf;
40 
42  gsl_function __solver_f;
43 
45  mutable double __target;
46 
48  double __search_min, __search_max;
49 
51  friend double gsl_f(double x, void *params);
52 
54  friend double gsl_df(double x, void *params);
55 
57  friend void gsl_fdf(double x, void *params, double *f, double *df);
58 
59 public:
61  InverseFunction(const OneArgumentDiffFunction &to_invert,
62  double search_min,
63  double search_max,
64  double tolerance = 1e-10);
65 
67  double operator()(double x) const;
68 
70  double range_high() const
71  {
73  "Upper end of inverse function range is unknown."
74  );
75  }
76 
78  double range_low() const
79  {
81  "Lower end of inverse function range is unknown."
82  );
83  }
84 
88  {
90  "Finding all solutinos of an inverse function not implemented."
91  );
92  };
93 
98  const Core::FunctionDerivatives *deriv(double x) const;
99 
100  ~InverseFunction();
101 };
102 
103 #endif
friend double gsl_df(double x, void *params)
GLS format derivative of function to invert.
const Core::OneArgumentDiffFunction & __to_invert
The function being inverted.
gsl_function __solver_f
The f argument used by the GSL solver.
A class representing a once differentiable function of a single argument.
Definition: Functions.h:104
double operator()(double x) const
The value of the function at the given abscissa.
Any runtime error.
Definition: Error.h:61
An iterator over a set of solutions to an interpolating function.
friend void gsl_fdf(double x, void *params, double *f, double *df)
GLS format function and its derivative to invert.
double range_high() const
The lower end of the range over which the function is defined is uknown.
A class representing arbitrary order derivatives of a function.
Definition: Functions.h:66
double __target
The value we are trying to match the function to.
Core::InterpSolutionIterator crossings(double=0) const
An iterator over the abscissas where the function takes the given y value.
InverseFunction(const OneArgumentDiffFunction &to_invert, double search_min, double search_max, double tolerance=1e-10)
Invert the given function.
double __search_min
The range which to search for a solution (must bracket a zero).
The invrse of an existing function.
double range_low() const
The upper end of the range over which the function is defined.
const Core::FunctionDerivatives * deriv(double x) const
Returns a pointer to the derivative of the function.
gsl_function_fdf __solver_fdf
The fdf argument used by the GSL solver.
friend double gsl_f(double x, void *params)
GLS format function to invert.
gsl_root_fsolver * __solver
The GSL derivative-based solver.
double __tolerance
The relative tolerance in the value returned by the function at the best guess for the solution...