lines 6-101 of file: lib/python/cppad_py/fun_reverse.py # {xrst_begin py_fun_reverse} # {xrst_spell # xq # yq # } # {xrst_comment_ch #} # # # Reverse Mode AD # ############### # # Syntax # ****** # *xq* = *f*\ ``.reverse`` ( *q* , *yq* ) # # f # * # This is either a # :ref:`d_fun` or # :ref:`a_fun` function object # and is effectively constant; i.e., not changed. # # Notation # ******** # # f(x) # ==== # We use the notation :math:`f: \B{R}^n \rightarrow \B{R}^m` # for the function corresponding to *f* . # Note that *n* is the size of :ref:`ax` # and *m* is the size of :ref:`ay` # in to the constructor for *f* . # # X(t), S # ======= # This is the same function as # :ref:`x(t)` in the previous call to # *f*\ ``.forward`` . # We use :math:`S \in \B{R}^{n \times q}` to denote the Taylor coefficients # of :math:`X(t)`. # # Y(t), T # ======= # This is the same function as # :ref:`y(t)` in the previous call to # *f*\ ``.forward`` . # We use :math:`T \in \B{R}^{m \times q}` to denote the Taylor coefficients # of :math:`Y(t)`. # We also use the notation :math:`T(S)` to express the fact that # the Taylor coefficients for :math:`Y(t)` are a function of the # Taylor coefficients of :math:`X(t)`. # # G(T) # ==== # We use the notation :math:`G : \B{R}^{m \times p} \rightarrow \B{R}` # for a function that the calling routine chooses. # # q # * # This argument has type ``int`` and is positive. # It is the number of the Taylor coefficient (for each variable) # that we are computing the derivative with respect to. # It must be greater than zero, and less than or equal # the number of Taylor coefficient stored in *f* ; i.e., # :ref:`f_size_order()`. # # yq # ** # If *f* is a ``d_fun`` ( ``a_fun`` ) object, *yq* # is a numpy vector with ``float`` ( ``a_double`` ) elements, # *m* rows and *q* columns. # For 0 <= *i* < *m* and 0 <= *k* < *q* , # *yq* [ *i* , *k* ] is the partial derivative of # :math:`G(T)` with respect to the *k*-th order Taylor coefficient # for the *i*-th component function; i.e., # the partial derivative of :math:`G(T)` w.r.t. :math:`Y_i^{(k)} (t) / k !`. # # xq # ** # The result is a numpy vector with ``float`` ( ``a_double`` ) elements, # *n* rows and *q* columns. # For 0 <= *j* < *n* and 0 <= *k* < *q* , # *xq* [ *j* , *k* ] is the partial derivative of # :math:`G(T(S))` with respect to the *k*-th order Taylor coefficient # for the *j*-th component function; i.e., # the partial derivative of # :math:`G(T(S))` w.r.t. :math:`S_j^{(k)} (t) / k !`. # # {xrst_toc_hidden # example/python/core/fun_reverse_xam.py # } # Example # ******* # :ref:`fun_reverse_xam.py-name` # # {xrst_end py_fun_reverse}