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... | |
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.
|
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.
| x | If 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_y | Should 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.
|
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.
|
virtual |
Returns the deriv_order-th derivative of the quantity.
Implements Core::FunctionDerivatives.
Definition at line 61 of file LogDerivatives.cpp.
|
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.
|
private |
Correct for differentiating of log(quantity) instead of quantity.
Uses all lower order pre-computed derivatives in __deriv_values.
| uncorrected_derivative | The derivative of log(quantity) w.r.t. argument of the same order. Must already be corrected for log(argument) if necessary. |
| order | The order of the derivative being calculated. |
Definition at line 34 of file LogDerivatives.cpp.
|
mutableprivate |
Cache for previously computed corrected derivative values.
Definition at line 40 of file LogDerivatives.h.
|
private |
Is the underlying derivative w.r.t. log(argument)?
Definition at line 33 of file LogDerivatives.h.
|
private |
Is the underlying derivative of log(quantity)
Definition at line 33 of file LogDerivatives.h.
|
mutableprivate |
Cache for previously computed underlying derivative values.
Definition at line 40 of file LogDerivatives.h.
|
private |
The value of the argument at which derivatives are calculated.
Definition at line 29 of file LogDerivatives.h.