---------------------------------------------------- lines 6-41 of file: example/graph/switch_var_dyn.cpp ---------------------------------------------------- {xrst_begin switch_var_dyn.cpp} Switching Between Variables and Dynamic Parameters: Example and Test #################################################################### Function ******** For each :ref:`ADFun-name` object there is a corresponding function :math:`f(x, p)` where :ref:`independent@x` is the vector of independent variables and *p* is the vector of independent :ref:`Independent@dynamic` parameters. Convert a Function to a Graph ***************************** The :ref:`to_graph-name` routine can be used to convert a ``ADFun`` to a graph representation; see :ref:`cpp_ad_graph-name` . Convert a Graph to a Function ***************************** The :ref:`from_graph-name` routine can be used to convert a graph back to a function. During this conversion, it is possible to change dynamic parameters to variables and variables to dynamic parameters; see :ref:`from_graph@dyn2var` and *var2dyn* in the ``from_graph`` documentation. Note that many such conversions can be done using the same ``cpp_ad_graph`` object. Source Code *********** {xrst_literal // BEGIN C++ // END C++ } {xrst_end switch_var_dyn.cpp}