\(\newcommand{\W}[1]{ \; #1 \; }\) \(\newcommand{\R}[1]{ {\rm #1} }\) \(\newcommand{\B}[1]{ {\bf #1} }\) \(\newcommand{\D}[2]{ \frac{\partial #1}{\partial #2} }\) \(\newcommand{\DD}[3]{ \frac{\partial^2 #1}{\partial #2 \partial #3} }\) \(\newcommand{\Dpow}[2]{ \frac{\partial^{#1}}{\partial {#2}^{#1}} }\) \(\newcommand{\dpow}[2]{ \frac{ {\rm d}^{#1}}{{\rm d}\, {#2}^{#1}} }\)
atan2¶
View page sourceAD Two Argument Inverse Tangent Function¶
Syntax¶
theta =
atan2
( y , x )Purpose¶
Determines an angle \(\theta \in [ - \pi , + \pi ]\) such that
\begin{eqnarray}
\sin ( \theta ) & = & y / \sqrt{ x^2 + y^2 } \\
\cos ( \theta ) & = & x / \sqrt{ x^2 + y^2 }
\end{eqnarray}
y¶
The argument y has one of the following prototypes
const AD
< Base > & yconst VecAD
< Base >:: reference &
yx¶
The argument x has one of the following prototypes
const AD
< Base > & xconst VecAD
< Base >:: reference &
xtheta¶
The result theta has prototype
AD
< Base > theta
Operation Sequence¶
The AD of Base operation sequence used to calculate theta is Independent of x and y .
Example¶
The file atan2.cpp contains an example and test of this function.