1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!--Converted with LaTeX2HTML 98.1p1 release (March 2nd, 1998)
originally by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds
* revised and updated by: Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>Defining Derivative Information</TITLE>
<META NAME="description" CONTENT="Defining Derivative Information">
<META NAME="keywords" CONTENT="userman">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<LINK REL="STYLESHEET" HREF="userman.css">
<LINK REL="next" HREF="node55.html">
<LINK REL="previous" HREF="node53.html">
<LINK REL="up" HREF="node52.html">
<LINK REL="next" HREF="node55.html">
</HEAD>
<BODY >
<!--Navigation Panel-->
<A NAME="tex2html1214"
HREF="node55.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
SRC="/usr/lib/latex2html/icons.gif/next_motif.gif"></A>
<A NAME="tex2html1211"
HREF="node52.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
SRC="/usr/lib/latex2html/icons.gif/up_motif.gif"></A>
<A NAME="tex2html1205"
HREF="node53.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
SRC="/usr/lib/latex2html/icons.gif/previous_motif.gif"></A>
<A NAME="tex2html1213"
HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
SRC="/usr/lib/latex2html/icons.gif/contents_motif.gif"></A>
<BR>
<B> Next:</B> <A NAME="tex2html1215"
HREF="node55.html">Defining Information About an</A>
<B> Up:</B> <A NAME="tex2html1212"
HREF="node52.html">Installing a New Dynamical</A>
<B> Previous:</B> <A NAME="tex2html1206"
HREF="node53.html">Defining the Equations of</A>
<BR>
<BR>
<!--End of Navigation Panel-->
<H2><A NAME="SECTION00622000000000000000"> </A><A NAME="dfdx"> </A><A NAME="1991"> </A>
<BR>
Defining Derivative Information
</H2>
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<A NAME="1992"> </A>.
<P>
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 <A HREF="node53.html#bball"><IMG ALIGN="BOTTOM" BORDER="1" ALT="[*]"
SRC="/usr/lib/latex2html/icons.gif/cross_ref_motif.gif"></A>.
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.
<P>
We now continue with the bouncing ball example by defining the Jacobian of <I>f</I>.
At the <I>j</I>th instant of time, the Jacobian is
<BR><P></P>
<DIV ALIGN="CENTER">
<!-- MATH: \begin{displaymath}
\left( \begin{array}{cc}
\partial{f_1}/\partial{\phi_j} & \partial{f_1}/\partial{v_j} \\
\partial{f_2}/\partial{\phi_j} & \partial{f_2}/\partial{v_j} \\
\end{array} \right) = \left( \begin{array}{cc}
1 & 1 \\
\gamma \sin( \phi_j + v_j) & \alpha + \gamma \sin(\phi_j + v_j)
\end{array} \right)
\end{displaymath} -->
71#71
</DIV>
<BR CLEAR="ALL">
<P></P>
Find the section of the file bball_def.c which reads
<PRE>
/* ------------------------------------------------------------------------
function used to define the Jacobian
------------------------------------------------------------------------ */
/*
int user_jac(m,x,p)
double **m, *x, *p;
{
}
*/
</PRE>
Using a text editor, modify this code segment to read
<PRE>
/* ------------------------------------------------------------------------
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;
}
</PRE>
<P>
The routine which calls bball_jac() sends in a matrix and two arrays which contain the
current state and the current parameters for
<!-- MATH: $f_{\alpha, \gamma}$ -->
72#72.
When bball_jac() returns, it has filled
the matrix with the numerical Jacobian for
<!-- MATH: $Df_{\alpha, \gamma}$ -->
73#73
evaluated at the current state.
As remarked previously, writing a Jacobian routine is optional.
<P>
<HR>
<!--Navigation Panel-->
<A NAME="tex2html1214"
HREF="node55.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next"
SRC="/usr/lib/latex2html/icons.gif/next_motif.gif"></A>
<A NAME="tex2html1211"
HREF="node52.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up"
SRC="/usr/lib/latex2html/icons.gif/up_motif.gif"></A>
<A NAME="tex2html1205"
HREF="node53.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous"
SRC="/usr/lib/latex2html/icons.gif/previous_motif.gif"></A>
<A NAME="tex2html1213"
HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents"
SRC="/usr/lib/latex2html/icons.gif/contents_motif.gif"></A>
<BR>
<B> Next:</B> <A NAME="tex2html1215"
HREF="node55.html">Defining Information About an</A>
<B> Up:</B> <A NAME="tex2html1212"
HREF="node52.html">Installing a New Dynamical</A>
<B> Previous:</B> <A NAME="tex2html1206"
HREF="node53.html">Defining the Equations of</A>
<!--End of Navigation Panel-->
<ADDRESS>
<I>John Lapeyre</I>
<BR><I>1998-09-04</I>
</ADDRESS>
</BODY>
</HTML>
|