<?xml version='1.0'?> <?xml-stylesheet type='text/xsl' href='pmathml.xsl'?> <html xmlns='http://www.w3.org/1999/xhtml'> <head> <title>AD Two Argument Inverse Tangent Function</title> <meta name="description" id="description" content="AD Two Argument Inverse Tangent Function"/> <meta name="keywords" id="keywords" content=" tan Ad inverse atan2 "/> <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='_atan2_xml.js'> </script> </head> <body> <table><tr> <td> <a href="http://www.coin-or.org/CppAD/" target="_top"><img border="0" src="_image.gif"/></a> </td> <td><a href="abs.cpp.xml" target="_top">Prev</a> </td><td><a href="atan2.cpp.xml" target="_top">Next</a> </td><td> <select onchange='choose_across0(this)'> <option>Index-></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-></option> <option>CppAD</option> <option>AD</option> <option>ADValued</option> <option>MathOther</option> <option>atan2</option> </select> </td> <td> <select onchange='choose_down3(this)'> <option>AD-></option> <option>Default</option> <option>ad_copy</option> <option>Convert</option> <option>ADValued</option> <option>BoolValued</option> <option>VecAD</option> <option>base_require</option> </select> </td> <td> <select onchange='choose_down2(this)'> <option>ADValued-></option> <option>Arithmetic</option> <option>std_math_ad</option> <option>MathOther</option> <option>CondExp</option> <option>Discrete</option> </select> </td> <td> <select onchange='choose_down1(this)'> <option>MathOther-></option> <option>abs</option> <option>atan2</option> <option>erf</option> <option>pow</option> </select> </td> <td> <select onchange='choose_down0(this)'> <option>atan2-></option> <option>Atan2.cpp</option> </select> </td> <td> <select onchange='choose_current0(this)'> <option>Headings-></option> <option>Syntax</option> <option>Purpose</option> <option>y</option> <option>x</option> <option>theta</option> <option>Operation Sequence</option> <option>Example</option> </select> </td> </tr></table><br/> <center><b><big><big>AD Two Argument Inverse Tangent Function</big></big></b></center> <br/> <b><big><a name="Syntax" id="Syntax">Syntax</a></big></b> <br/> <code><font color="blue"></font></code><i><span style='white-space: nowrap'>theta</span></i><code><font color="blue"><span style='white-space: nowrap'> = atan2(</span></font></code><i><span style='white-space: nowrap'>y</span></i><code><font color="blue"><span style='white-space: nowrap'>, </span></font></code><i><span style='white-space: nowrap'>x</span></i><code><font color="blue"><span style='white-space: nowrap'>)</span></font></code> <br/> <br/> <b><big><a name="Purpose" id="Purpose">Purpose</a></big></b> <br/> Determines an angle <math xmlns="http://www.w3.org/1998/Math/MathML" display="inline"><mrow> <mi mathvariant='normal'>θ</mi> <mo stretchy="false">∈</mo> <mo stretchy="false">[</mo> <mo stretchy="false">-</mo> <mi mathvariant='normal'>π</mi> <mo stretchy="false">,</mo> <mo stretchy="false">+</mo> <mi mathvariant='normal'>π</mi> <mo stretchy="false">]</mo> </mrow></math> such that <math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><mrow> <mtable rowalign="center" ><mtr><mtd columnalign="right" > <mi>sin</mi> <mo stretchy="false">(</mo> <mi mathvariant='normal'>θ</mi> <mo stretchy="false">)</mo> </mtd><mtd columnalign="center" > <mo stretchy="false">=</mo> </mtd><mtd columnalign="left" > <mi mathvariant='italic'>y</mi> <mo stretchy="false">/</mo> <msqrt><mrow><msup><mi mathvariant='italic'>x</mi> <mn>2</mn> </msup> <mo stretchy="false">+</mo> <msup><mi mathvariant='italic'>y</mi> <mn>2</mn> </msup> </mrow> </msqrt> </mtd></mtr><mtr><mtd columnalign="right" > <mi>cos</mi> <mo stretchy="false">(</mo> <mi mathvariant='normal'>θ</mi> <mo stretchy="false">)</mo> </mtd><mtd columnalign="center" > <mo stretchy="false">=</mo> </mtd><mtd columnalign="left" > <mi mathvariant='italic'>x</mi> <mo stretchy="false">/</mo> <msqrt><mrow><msup><mi mathvariant='italic'>x</mi> <mn>2</mn> </msup> <mo stretchy="false">+</mo> <msup><mi mathvariant='italic'>y</mi> <mn>2</mn> </msup> </mrow> </msqrt> </mtd></mtr></mtable> </mrow></math> <br/> <b><big><a name="y" id="y">y</a></big></b> <br/> The argument <i>y</i> has one of the following prototypes <code><font color="blue"><span style='white-space: nowrap'><br/>      const AD<</span></font></code><i><span style='white-space: nowrap'>Base</span></i><code><font color="blue"><span style='white-space: nowrap'>>               &</span></font></code><i><span style='white-space: nowrap'>y</span></i><code><font color="blue"><span style='white-space: nowrap'><br/>      const VecAD<</span></font></code><i><span style='white-space: nowrap'>Base</span></i><code><font color="blue"><span style='white-space: nowrap'>>::reference &</span></font></code><i><span style='white-space: nowrap'>y</span></i><code><font color="blue"><span style='white-space: nowrap'><br/> </span></font></code><br/> <b><big><a name="x" id="x">x</a></big></b> <br/> The argument <i>x</i> has one of the following prototypes <code><font color="blue"><span style='white-space: nowrap'><br/>      const AD<</span></font></code><i><span style='white-space: nowrap'>Base</span></i><code><font color="blue"><span style='white-space: nowrap'>>               &</span></font></code><i><span style='white-space: nowrap'>x</span></i><code><font color="blue"><span style='white-space: nowrap'><br/>      const VecAD<</span></font></code><i><span style='white-space: nowrap'>Base</span></i><code><font color="blue"><span style='white-space: nowrap'>>::reference &</span></font></code><i><span style='white-space: nowrap'>x</span></i><code><font color="blue"><span style='white-space: nowrap'><br/> </span></font></code><br/> <b><big><a name="theta" id="theta">theta</a></big></b> <br/> The result <i>theta</i> has prototype <code><font color="blue"><span style='white-space: nowrap'><br/>      AD<</span></font></code><i><span style='white-space: nowrap'>Base</span></i><code><font color="blue"><span style='white-space: nowrap'>> </span></font></code><i><span style='white-space: nowrap'>theta</span></i><code><font color="blue"><span style='white-space: nowrap'><br/> </span></font></code><br/> <b><big><a name="Operation Sequence" id="Operation Sequence">Operation Sequence</a></big></b> <br/> The AD of <i>Base</i> operation sequence used to calculate <i>theta</i> is <a href="glossary.xml#Operation.Independent" target="_top"><span style='white-space: nowrap'>independent</span></a> of <i>x</i> and <i>y</i>. <br/> <br/> <b><big><a name="Example" id="Example">Example</a></big></b> <br/> The file <a href="atan2.cpp.xml" target="_top"><span style='white-space: nowrap'>Atan2.cpp</span></a> contains an example and test of this function. It returns true if it succeeds and false otherwise. <hr/>Input File: cppad/local/atan2.hpp </body> </html>