py_independent#

View page source

Declare Independent Variables and Start Recording#

Syntax#

ax = cppad_py.independent ( x )
( ax , adynamic ) = cppad_py.independent ( x , dynamic )

x#

This argument is a numpy vector with float elements. It specifies the number of independent variables and their values during the recording. We use nx = x.size to denote the number of independent variables.

dynamic#

This argument is a numpy vector with float elements. It specifies the number of independent dynamic parameters and their values during the recording. We use nd = dynamic.size to denote the number of independent dynamic parameters.

ax#

This result is a numpy vector with a_double elements. This is the vector of independent variables. It has size nx and for i = 0 to n -1

      ax [ i ]. value () == x [ i ]

adynamic#

This result is a numpy vector with a_double elements. This is the vector of independent dynamic parameters. It has size nd and for i = 0 to n -1

      adynamic [ i ]. value () == dynamic [ i ]

Purpose#

This starts a recording of the a_double operations. This recording is terminated, and the information is stored, by calling the d_fun_constructor. It is terminated, and the information is lost, by calling abort_recording.

Example#

Most of the python d_fun examples use this function. The fun_dynamic_xam.py uses the syntax that includes dynamic parameters.