Trigonometric Functions

Corrected Arctangent

fatan2(x,y)f_ ext{atan2} left(, x, y , ight)

Compute the corrected arctangent of x,yx, y.

Arguments

ArgumentDescriptionTypeConstraintsNotes
xxR\mathbb{R}
yyR\mathbb{R}

Return

ValueDescriptionTypeConstraintsNotes
θ\thetadirection angleR\mathbb{R}π<θπ-\pi < \theta \leq \pi

Usage

f_{atan2}left(x, y\right)=left{x>0:\tan^{-1}left(rac{y}{x}\right), x<0: left{y<0:\tan^{-1}left(rac{y}{x}\right)-pi,\tan^{-1}left(rac{y}{x}\right)+pi\right}, x=0: left{y>0: rac{pi}{2}, y<0: -rac{pi}{2}, 0\right}, 0\right}
phi=f_{atan2}left(P.x, P.y\right)
left(tcosphi, tsinphi\right)
P=left(0.2, 0.2\right)

Implementation

fatan2(x,y)={x>0:tan1(yx), x<0: {y<0:tan1(yx)π,tan1(yx)+π}, x=0: {y>0: π2, y<0: π2, 0}, 0}f_ ext{atan2} left(, x, y , ight) = left{ x>0: an^{-1}left( rac{y}{x} ight), x<0: left{y<0: an^{-1}left( rac{y}{x} ight)-pi, an^{-1}left( rac{y}{x} ight)+pi ight}, x=0: left{y>0: rac{pi}{2}, y<0: - rac{pi}{2}, 0 ight}, 0 ight}

Dependencies

None