Planetary Orbital Evolution due to Tides
Orbital evolution of two objects experiencing tides
StellarEvolution::LogDerivatives Class Referenceabstract

Calculate dy/dx given dy/dx, dy/dln(x), dln(y)/dx or dln(y)/dln(x). More...

#include <LogDerivatives.h>

+ Inheritance diagram for StellarEvolution::LogDerivatives:
+ Collaboration diagram for StellarEvolution::LogDerivatives:

Public Member Functions

 LogDerivatives (double x=NaN, bool log_y=false)
 Create a derivative for possibly log(functions) of possibly log(arg). More...
 
double order (unsigned deriv_order=1) const
 Returns the deriv_order-th derivative of the quantity. More...
 
- Public Member Functions inherited from Core::FunctionDerivatives
virtual ~FunctionDerivatives ()
 Clean up. More...
 

Protected Member Functions

virtual double calc_deriv (unsigned deriv_order) const =0
 Should be overwritten to calculate the derivatives with respect to either arg or log(arg) as specified on construction. More...
 

Private Member Functions

double transform_log_x_deriv (unsigned order) const
 Correct for differentiating w.r.t. log(arg) instead of arg. More...
 
double transform_log_y_deriv (double uncorrected_derivative, unsigned order) const
 Correct for differentiating of log(quantity) instead of quantity. More...
 

Private Attributes

double __x
 The value of the argument at which derivatives are calculated. More...
 
bool __log_x
 Is the underlying derivative w.r.t. log(argument)? More...
 
bool __log_y
 Is the underlying derivative of log(quantity) More...
 
std::vector< double > __underlying_deriv_values
 Cache for previously computed underlying derivative values. More...
 
std::vector< double > __deriv_values
 Cache for previously computed corrected derivative values. More...
 

Detailed Description

Calculate dy/dx given dy/dx, dy/dln(x), dln(y)/dx or dln(y)/dln(x).

Definition at line 26 of file LogDerivatives.h.

Constructor & Destructor Documentation

◆ LogDerivatives()

StellarEvolution::LogDerivatives::LogDerivatives ( double  x = NaN,
bool  log_y = false 
)
inline

Create a derivative for possibly log(functions) of possibly log(arg).

The created object corrects for the fact that the underlying derivative (defined by the calc_deriv method) may be of the logarithm of a quantity and/or with respect to the logarithm of the argument.

Parameters
xIf not NaN, the underlying derivatives are assumed to be w.r.t. log(x) and should be converted to derivatives w.r.t. x.
log_yShould the underlying derivatives of log(y) be converted to derivatives of y. If false, the underlying derivatives are assumed to be of y itself.

Definition at line 78 of file LogDerivatives.h.

Member Function Documentation

◆ calc_deriv()

virtual double StellarEvolution::LogDerivatives::calc_deriv ( unsigned  deriv_order) const
protectedpure virtual

Should be overwritten to calculate the derivatives with respect to either arg or log(arg) as specified on construction.

Implemented in StellarEvolution::InterpolatedDerivatives, and StellarEvolution::RemoveLogDeriv.

◆ order()

double StellarEvolution::LogDerivatives::order ( unsigned  deriv_order = 1) const
virtual

Returns the deriv_order-th derivative of the quantity.

Implements Core::FunctionDerivatives.

Definition at line 61 of file LogDerivatives.cpp.

◆ transform_log_x_deriv()

double StellarEvolution::LogDerivatives::transform_log_x_deriv ( unsigned  order) const
private

Correct for differentiating w.r.t. log(arg) instead of arg.

Uses the pre-computed array of the derivatives up to the given order in __underlying_deriv_values with respect to ln(x) to return the order-th derivative with respect to x.

Definition at line 13 of file LogDerivatives.cpp.

◆ transform_log_y_deriv()

double StellarEvolution::LogDerivatives::transform_log_y_deriv ( double  uncorrected_derivative,
unsigned  order 
) const
private

Correct for differentiating of log(quantity) instead of quantity.

Uses all lower order pre-computed derivatives in __deriv_values.

Parameters
uncorrected_derivativeThe derivative of log(quantity) w.r.t. argument of the same order. Must already be corrected for log(argument) if necessary.
orderThe order of the derivative being calculated.

Definition at line 34 of file LogDerivatives.cpp.

Member Data Documentation

◆ __deriv_values

std::vector<double> StellarEvolution::LogDerivatives::__deriv_values
mutableprivate

Cache for previously computed corrected derivative values.

Definition at line 40 of file LogDerivatives.h.

◆ __log_x

bool StellarEvolution::LogDerivatives::__log_x
private

Is the underlying derivative w.r.t. log(argument)?

Definition at line 33 of file LogDerivatives.h.

◆ __log_y

bool StellarEvolution::LogDerivatives::__log_y
private

Is the underlying derivative of log(quantity)

Definition at line 33 of file LogDerivatives.h.

◆ __underlying_deriv_values

std::vector<double> StellarEvolution::LogDerivatives::__underlying_deriv_values
mutableprivate

Cache for previously computed underlying derivative values.

Definition at line 40 of file LogDerivatives.h.

◆ __x

double StellarEvolution::LogDerivatives::__x
private

The value of the argument at which derivatives are calculated.

Definition at line 29 of file LogDerivatives.h.


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