Prev Next Index-> contents reference index search external Up-> CppAD Appendix Theory ReverseTheory log_reverse Appendix-> Faq directory Theory glossary Bib wish_list whats_new deprecated compare_c numeric_ad addon License Theory-> ForwardTheory ReverseTheory reverse_identity ReverseTheory-> exp_reverse log_reverse sqrt_reverse sin_cos_reverse atan_reverse asin_reverse acos_reverse tan_reverse erf_reverse log_reverse Headings

$\newcommand{\W}[1]{ \; #1 \; } \newcommand{\R}[1]{ {\rm #1} } \newcommand{\B}[1]{ {\bf #1} } \newcommand{\D}[2]{ \frac{\partial #1}{\partial #2} } \newcommand{\DD}[3]{ \frac{\partial^2 #1}{\partial #2 \partial #3} } \newcommand{\Dpow}[2]{ \frac{\partial^{#1}}{\partial {#2}^{#1}} } \newcommand{\dpow}[2]{ \frac{ {\rm d}^{#1}}{{\rm d}\, {#2}^{#1}} }$
Logarithm Function Reverse Mode Theory
We use the reverse theory standard math function definition for the functions $H$ and $G$. The zero order forward mode formula for the logarithm is $$z^{(0)} = F( x^{(0)} )$$ and for $j > 0$, $$z^{(j)} = \frac{1}{ \bar{b} + x^{(0)} } \frac{1}{j} \left( j x^{(j)} - \sum_{k=1}^{j-1} k z^{(k)} x^{(j-k)} \right)$$ where $$\bar{b} = \left\{ \begin{array}{ll} 0 & \R{if} \; F(x) = \R{log}(x) \\ 1 & \R{if} \; F(x) = \R{log1p}(x) \end{array} \right.$$ We note that for $j > 0$ $$\begin{array}{rcl} \D{ z^{(j)} } { x^{(0)} } & = & - \frac{1}{ \bar{b} + x^{(0)} } \frac{1}{ \bar{b} + x^{(0)} } \frac{1}{j} \left( j x^{(j)} - \sum_{k=1}^{j-1} k z^{(k)} x^{(j-k)} \right) \\ & = & - \frac{z^{(j)}}{ \bar{b} + x^{(0)} } \end{array}$$ Removing the zero order partials are given by $$\begin{array}{rcl} \D{H}{ x^{(0)} } & = & \D{G}{ x^{(0)} } + \D{G}{ z^{(0)} } \D{ z^{(0)} }{ x^{(0)} } \\ & = & \D{G}{ x^{(0)} } + \D{G}{ z^{(0)} } \frac{1}{ \bar{b} + x^{(0)} } \end{array}$$ For orders $j > 0$ and for $k = 1 , \ldots , j-1$ $$\begin{array}{rcl} \D{H}{ x^{(0)} } & = & \D{G}{ x^{(0)} } + \D{G}{ z^{(j)} } \D{ z^{(j)} }{ x^{(0)} } \\ & = & \D{G}{ x^{(0)} } - \D{G}{ z^{(j)} } \frac{ z^{(j)} }{ \bar{b} + x^{(0)} } \\ \D{H}{ x^{(j)} } & = & \D{G}{ x^{(j)} } + \D{G}{ z^{(j)} } \D{ z^{(j)} }{ x^{(j)} } \\ & = & \D{G}{ x^{(j)} } + \D{G}{ z^{(j)} } \frac{1}{ \bar{b} + x^{(0)} } \\ \D{H}{ x^{(j-k)} } & = & \D{G}{ x^{(j-k)} } - \D{G}{ z^{(j)} } \frac{1}{ \bar{b} + x^{(0)} } \frac{k}{j} z^{(k)} \\ \D{H}{ z^{(k)} } & = & \D{G}{ z^{(k)} } - \D{G}{ z^{(j)} } \frac{1}{ \bar{b} + x^{(0)} } \frac{k}{j} x^{(j-k)} \end{array}$$
Input File: omh/appendix/theory/log_reverse.omh