Planetary Orbital Evolution due to Tides
Orbital evolution of two objects experiencing tides
InverseFunction Class Reference

The invrse of an existing function. More...

#include <InverseFunction.h>

+ Inheritance diagram for InverseFunction:
+ Collaboration diagram for InverseFunction:

Public Member Functions

 InverseFunction (const OneArgumentDiffFunction &to_invert, double search_min, double search_max, double tolerance=1e-10)
 Invert the given function. More...
 
double operator() (double x) const
 The value of the function at the given abscissa. More...
 
double range_high () const
 The lower end of the range over which the function is defined is uknown. More...
 
double range_low () const
 The upper end of the range over which the function is defined. More...
 
Core::InterpSolutionIterator crossings (double=0) const
 An iterator over the abscissas where the function takes the given y value. More...
 
const Core::FunctionDerivativesderiv (double x) const
 Returns a pointer to the derivative of the function. More...
 
- Public Member Functions inherited from Core::OneArgumentFunction< double, double >
virtual ~OneArgumentFunction ()
 Provide a virtual destructor for a virtual class. More...
 

Private Attributes

const Core::OneArgumentDiffFunction__to_invert
 The function being inverted. More...
 
double __tolerance
 The relative tolerance in the value returned by the function at the best guess for the solution. More...
 
gsl_root_fsolver * __solver
 The GSL derivative-based solver. More...
 
gsl_function_fdf __solver_fdf
 The fdf argument used by the GSL solver. More...
 
gsl_function __solver_f
 The f argument used by the GSL solver. More...
 
double __target
 The value we are trying to match the function to. More...
 
double __search_min
 The range which to search for a solution (must bracket a zero). More...
 
double __search_max
 

Friends

double gsl_f (double x, void *params)
 GLS format function to invert. More...
 
double gsl_df (double x, void *params)
 GLS format derivative of function to invert. More...
 
void gsl_fdf (double x, void *params, double *f, double *df)
 GLS format function and its derivative to invert. More...
 

Detailed Description

The invrse of an existing function.

Uses the last returned result as a guess for the next solution, so this class workes best when invoked with consecutive arguments close to each other, like for example evaluating it at the set of ages of a POET solution in ascending/descending order.

In other cases, use set_guess before each query.

Definition at line 26 of file InverseFunction.h.

Constructor & Destructor Documentation

◆ InverseFunction()

InverseFunction::InverseFunction ( const OneArgumentDiffFunction &  to_invert,
double  search_min,
double  search_max,
double  tolerance = 1e-10 
)

Invert the given function.

Definition at line 41 of file InverseFunction.cpp.

Member Function Documentation

◆ crossings()

Core::InterpSolutionIterator InverseFunction::crossings ( double  = 0) const
inlinevirtual

An iterator over the abscissas where the function takes the given y value.

Implements Core::OneArgumentFunction< double, double >.

Definition at line 87 of file InverseFunction.h.

◆ deriv()

const Core::FunctionDerivatives * InverseFunction::deriv ( double  x) const
virtual

Returns a pointer to the derivative of the function.

The use of a pointer allows avoiding potentially expensive copy opertaions.

Implements Core::OneArgumentDiffFunction.

Definition at line 99 of file InverseFunction.cpp.

◆ operator()()

double InverseFunction::operator() ( double  x) const
virtual

The value of the function at the given abscissa.

Implements Core::OneArgumentFunction< double, double >.

Definition at line 66 of file InverseFunction.cpp.

◆ range_high()

double InverseFunction::range_high ( ) const
inlinevirtual

The lower end of the range over which the function is defined is uknown.

Implements Core::OneArgumentFunction< double, double >.

Definition at line 70 of file InverseFunction.h.

◆ range_low()

double InverseFunction::range_low ( ) const
inlinevirtual

The upper end of the range over which the function is defined.

Implements Core::OneArgumentFunction< double, double >.

Definition at line 78 of file InverseFunction.h.

Friends And Related Function Documentation

◆ gsl_df

double gsl_df ( double  x,
void *  params 
)
friend

GLS format derivative of function to invert.

Definition at line 19 of file InverseFunction.cpp.

◆ gsl_f

double gsl_f ( double  x,
void *  params 
)
friend

GLS format function to invert.

Definition at line 10 of file InverseFunction.cpp.

◆ gsl_fdf

void gsl_fdf ( double  x,
void *  params,
double *  f,
double *  df 
)
friend

GLS format function and its derivative to invert.

Definition at line 30 of file InverseFunction.cpp.

Member Data Documentation

◆ __search_min

double InverseFunction::__search_min
private

The range which to search for a solution (must bracket a zero).

Definition at line 48 of file InverseFunction.h.

◆ __solver

gsl_root_fsolver* InverseFunction::__solver
private

The GSL derivative-based solver.

Definition at line 36 of file InverseFunction.h.

◆ __solver_f

gsl_function InverseFunction::__solver_f
private

The f argument used by the GSL solver.

Definition at line 42 of file InverseFunction.h.

◆ __solver_fdf

gsl_function_fdf InverseFunction::__solver_fdf
private

The fdf argument used by the GSL solver.

Definition at line 39 of file InverseFunction.h.

◆ __target

double InverseFunction::__target
mutableprivate

The value we are trying to match the function to.

Definition at line 45 of file InverseFunction.h.

◆ __to_invert

const Core::OneArgumentDiffFunction& InverseFunction::__to_invert
private

The function being inverted.

Definition at line 29 of file InverseFunction.h.

◆ __tolerance

double InverseFunction::__tolerance
private

The relative tolerance in the value returned by the function at the best guess for the solution.

Definition at line 33 of file InverseFunction.h.


The documentation for this class was generated from the following files: