<?xml version='1.0'?>
<?xml-stylesheet type='text/xsl' href='pmathml.xsl'?>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<title>pycppad-20100319: A Python Algorithm Derivative Package</title>
<meta name="description" id="description" content="pycppad-20100319: A Python Algorithm Derivative Package"/>
<link rel='icon' type='image/png' href='_favicon.png'/>
<meta name="keywords" id="keywords" content=" Ad python algorithmic differentiation automatic pycppad "/>
<style type='text/css'>
body { color : black }
body { background-color : white }
A:link { color : blue }
A:visited { color : purple }
A:active { color : purple }
</style>
<script type='text/javascript' language='JavaScript' src='_pycppad_xml.js'>
</script>
</head>
<body>
<table><tr>
<td>
<a href="../home.htm" target="_top"><img border="0" src="_image.gif"/></a>
</td>
<td>Prev</td><td><a href="_contents_xml.htm" target="_top">Next</a>
</td><td>
<select onchange='choose_across0(this)'>
<option>Index-&gt;</option>
<option>contents</option>
<option>reference</option>
<option>index</option>
<option>search</option>
<option>external</option>
</select>
</td>
<td>
<select onchange='choose_up0(this)'>
<option>Up-&gt;</option>
<option>pycppad</option>
</select>
</td>
<td>
<select onchange='choose_down0(this)'>
<option>pycppad-&gt;</option>
<option>install</option>
<option>get_started.py</option>
<option>example</option>
<option>ad_variable</option>
<option>ad_function</option>
<option>two_levels.py</option>
<option>runge_kutta_4</option>
<option>whats_new_10</option>
<option>license</option>
</select>
</td>
<td>
<select onchange='choose_current0(this)'>
<option>Headings-&gt;</option>
<option>License</option>
<option>Syntax</option>
<option>Purpose</option>
<option>Simple Example</option>
<option>Features</option>
<option>Contents</option>
</select>
</td>
</tr></table><br/>
<center><b><big><big>pycppad-20100319: A Python Algorithm Derivative Package</big></big></b></center>
<table><tr><td align='left'  valign='top'>
</td><td align='left'  valign='top'>
Manual split into sections <code><span style='white-space: nowrap'>&#xA0;&#xA0;</span></code> </td><td align='left'  valign='top'>

	Manual as one web page
</td></tr><tr><td align='left'  valign='top'>

Math displayed using Latex <code><span style='white-space: nowrap'>&#xA0;&#xA0;</span></code> </td><td align='left'  valign='top'>

	<a href="pycppad.htm" target="_top"><span style='white-space: nowrap'>pycppad.htm</span></a>
 <code><span style='white-space: nowrap'>&#xA0;&#xA0;</span></code> </td><td align='left'  valign='top'>

	<a href="_printable.htm" target="_top"><span style='white-space: nowrap'>_printable.htm</span></a>

</td></tr><tr><td align='left'  valign='top'>

Math displayed using MathML <code><span style='white-space: nowrap'>&#xA0;&#xA0;</span></code> </td><td align='left'  valign='top'>

	<a href="pycppad.xml" target="_top"><span style='white-space: nowrap'>pycppad.xml</span></a>
 <code><span style='white-space: nowrap'>&#xA0;&#xA0;</span></code> </td><td align='left'  valign='top'>

	<a href="_printable.xml" target="_top"><span style='white-space: nowrap'>_printable.xml</span></a>

</td></tr>
</table>
<br/>
<b><big><a name="License" id="License">License</a></big></b>

<br/>
<a href="license.xml" target="_top"><span style='white-space: nowrap'>BSD</span></a>


<br/>
<br/>
<b><big><a name="Syntax" id="Syntax">Syntax</a></big></b>

<br/>

<code><font color="blue"><span style='white-space: nowrap'>from&#xA0;pycppad&#xA0;import&#xA0;*</span></font></code>


<br/>
<br/>
<b><big><a name="Purpose" id="Purpose">Purpose</a></big></b>
<br/>
The command above imports a
<a href="http://www.boost.org" target="_top"><span style='white-space: nowrap'>boost::python</span></a>

interface to the C++
<a href="http://en.wikipedia.org/wiki/Automatic_differentiation" target="_top"><span style='white-space: nowrap'>Algorithmic&#xA0;Differentiation&#xA0;(AD)</span></a>

package
<a href="http://www.coin-or.org/CppAD/CppAD/" target="_top"><span style='white-space: nowrap'>CppAD</span></a>
.

<br/>
<br/>
<b><big><a name="Simple Example" id="Simple Example">Simple Example</a></big></b>

<code><font color="blue">
<br/>
<pre style='display:inline'> 
from pycppad import *
def pycppad_test_get_started() :
  def F(x) :                                   # function to be differentiated
    return exp(-(x[0]**2. + x[1]**2.) / 2.)    # is Gaussian density
  x     = numpy.array( [ 1.,  2.] )
  a_x   = <a href="independent.xml" target="_top">independent</a>(x)
  a_y   = numpy.array( [ F(a_x) ] ) 
  f     = <a href="adfun.xml" target="_top">adfun</a>(a_x, a_y)
  J     = f.<a href="jacobian.xml" target="_top">jacobian</a>(x)                        # J = F'(x)
  assert <a href="abs.xml" target="_top">abs</a>( J[0, 0] + F(x) * x[0] ) &lt; 1e-10  # J[0,0] ~= - F(x) * x[0]
  assert <a href="abs.xml" target="_top">abs</a>( J[0, 1] + F(x) * x[1] ) &lt; 1e-10  # J[0,1] ~= - F(x) * x[1]
</pre>

</font></code>


<br/>
<br/>
<b><big><a name="Features" id="Features">Features</a></big></b>
<br/>
Operator overloading is used to store the operation sequence
corresponding to a python algorithm.
The operation sequence can be evaluated
to obtain new function values or derivatives of arbitrary order.
In addition, multiple levels of AD are supported.
This means that AD derivatives can be used in the definition of a function
which in turn can be differentiated using AD.
See <a href="whats_new_09.xml" target="_top"><span style='white-space: nowrap'>whats_new_09</span></a>
 for a list of recent extensions and bug fixes.

<br/>
<br/>
<b><big><a name="Contents" id="Contents">Contents</a></big></b>
<br/>
<table>
<tr><td><a href="_contents_xml.htm" target="_top">_contents</a></td><td>Table&#xA0;of&#xA0;Contents</td></tr><tr><td><a href="install.xml" target="_top">install</a></td><td>Installing&#xA0;pycppad</td></tr><tr><td><a href="get_started.py.xml" target="_top">get_started.py</a></td><td>get_started:&#xA0;Example&#xA0;and&#xA0;Test</td></tr><tr><td><a href="example.xml" target="_top">example</a></td><td>List&#xA0;of&#xA0;All&#xA0;the&#xA0;pycppad&#xA0;Examples</td></tr><tr><td><a href="ad_variable.xml" target="_top">ad_variable</a></td><td>AD&#xA0;Variable&#xA0;Methods</td></tr><tr><td><a href="ad_function.xml" target="_top">ad_function</a></td><td>AD&#xA0;Function&#xA0;Methods</td></tr><tr><td><a href="two_levels.py.xml" target="_top">two_levels.py</a></td><td>Using&#xA0;Two&#xA0;Levels&#xA0;of&#xA0;AD:&#xA0;Example&#xA0;and&#xA0;Test</td></tr><tr><td><a href="runge_kutta_4.xml" target="_top">runge_kutta_4</a></td><td>Fourth&#xA0;Order&#xA0;Runge&#xA0;Kutta</td></tr><tr><td><a href="whats_new_10.xml" target="_top">whats_new_10</a></td><td>Extensions,&#xA0;Bug&#xA0;Fixes,&#xA0;and&#xA0;Changes&#xA0;During&#xA0;2010</td></tr><tr><td><a href="license.xml" target="_top">license</a></td><td>License</td></tr><tr><td><a href="_reference.xml" target="_top">_reference</a></td><td>Alphabetic&#xA0;Listing&#xA0;of&#xA0;Cross&#xA0;Reference&#xA0;Tags</td></tr><tr><td><a href="_index.xml" target="_top">_index</a></td><td>Keyword&#xA0;Index</td></tr><tr><td><a href="_search_xml.htm" target="_top">_search</a></td><td>Search&#xA0;Python&#xA0;Algorithmic&#xA0;Differentiation&#xA0;Using&#xA0;CppAD</td></tr><tr><td><a href="_external.xml" target="_top">_external</a></td><td>External&#xA0;Internet&#xA0;References</td></tr></table>
<hr/>Input File: doc.omh

</body>
</html>
