next up previous contents
Next: Defining Information About an Up: Installing a New Dynamical Previous: Defining the Equations of   Contents


Defining Derivative Information

If available, DsTool can use analytic information in certain computational routines. Jacobian information is used in root-finding algorithms and for implicitly iterating diffeomorphisms backwards (when an explicit inverse does not exist). Detailed information about these algorithms is found in the DsTool Reference Manual.

If derivative information is not provided by the user, then DsTool will use finite difference-approximations. This section will describe how to write a function which provides an explicit Jacobian for Equation 4.1. Because time is discrete for maps, it does not make sense to define a derivative with respect to time. Currently, DsTool does not make use of derivatives with respect to time and parameters, but we include them for the convenience of the user who wishes to extend the capabilities of DsTool.

We now continue with the bouncing ball example by defining the Jacobian of $f$. At the $j$th instant of time, the Jacobian is

\begin{displaymath}\left( \begin{array}{cc}
\partial{f_1}/\partial{\phi_j} & \p...
... v_j) & \alpha + \gamma \sin(\phi_j + v_j)
\end{array} \right)
\end{displaymath}

Find the section of the file bball_def.c which reads
/* ------------------------------------------------------------------------
   function used to define the Jacobian
   ------------------------------------------------------------------------ */
/*
int user_jac(m,x,p)
double  **m, *x, *p;
{
}
*/
Using a text editor, modify this code segment to read
/* ------------------------------------------------------------------------
   function used to define the Jacobian
   ------------------------------------------------------------------------ */
int bball_jac(m,x,p)
double  **m, *x, *p;
{
   double    temp;

   temp    = p[1] * sin( x[0] + x[1] );
   m[0][0] = 1.0;
   m[0][1] = 1.0;
   m[1][0] = temp;
   m[1][1] = p[0] + temp;
}

The routine which calls bball_jac() sends in a matrix and two arrays which contain the current state and the current parameters for $f_{\alpha, \gamma}$. When bball_jac() returns, it has filled the matrix with the numerical Jacobian for $Df_{\alpha, \gamma}$ evaluated at the current state. As remarked previously, writing a Jacobian routine is optional.


next up previous contents
Next: Defining Information About an Up: Installing a New Dynamical Previous: Defining the Equations of   Contents
2008-05-14