logo

아크탄젠트2 함수의 정의 📂함수

아크탄젠트2 함수의 정의

정의

아크탄젠트2arc Tangent 2 arctan2:(R2{(0,0)})R\arctan 2 : \left( \mathbb{R}^{2} \setminus \left\{ (0,0) \right\} \right) \to \mathbb{R} 는 다음과 같이 정의된다. arctan2:(rsinθ,rcosθ)θ \arctan 2 : \left( r \sin \theta , r \cos \theta \right) \mapsto \theta r>0r > 0 는 임의의 양수다.

설명

아크탄젠트2는 기계공학 등에서 아크탄젠트 arctan\arctan 로는 부족한 정보를 채우기 위해 사용되는 함수로써, 위치정보 rcosr \cos, rsinr \sin 을 알아도 탄젠트 sincos{{ \sin } \over { \cos }} 가 되며 부호가 사라지는 문제를 보완한다. 정의역에서 알 수 있듯 (0,0)(0,0) 에서는 여전히 정의되지 않는다.

arctan\arctan 과의 차이점

보다시피 아크탄젠트는 (1,1)(1,1)(1,1)(-1,-1) 을 구분하지 못하지만, 아크탄젠트2는 구분할 수 있다.

컨벤션

x=cosx = \cos 이고 y=siny = \sin 이라 할 때 C 언어, 매트랩에서는 θ=arctan2(y,x)\theta = \arctan 2 (y,x) 인데 어떤 곳에서는 또 θ=arctan2(x,y)\theta = \arctan 2 (x,y) 라고 한다. 사인-코사인 순서대로 한다면 arctan2(sin,cos)\arctan 2 (\sin, \cos) 이 자연스럽고 x-y 순서대로 한다면 arctan2(x,y)\arctan 2 (x,y) 가 자연스러운 수준의 차이니까 그때그때 주의하는 수밖에 없다.

이러한 컨벤션의 차이에서도 느낄 수 있듯, 아크탄젠트2는 수학적으로 어떤 큰 의미가 있다기보다는 오로지 실용성 하나를 위해서 2를 붙여쓸 뿐이다. 역기구학inverse Kinematics에서 자주 등장하는 다음의 정리를 소개한다.

정리

삼각함수의 선형결합이 주어졌을 때의 각도

acosθ+bsinθ=c a \cos \theta + b \sin \theta = c 삼각함수선형결합cRc \in \mathbb{R} 와 같다면, 각도 θ\theta 는 다음과 같다. cosθ=ac±b2(a2+b2c2)a2+b2sinθ=b2cab2(a2+b2c2)b(a2+b2)θ=arctan2(sinθ,cosθ) \begin{align*} \cos \theta =& {{ ac \pm \sqrt{ b^{2} \left( a^{2} + b_{2} - c^{2} \right) } } \over { a^{2} + b^{2} }} \\ \sin \theta =& {{ b^{2} c \mp a \sqrt{ b^{2} \left( a^{2} + b^{2} - c^{2} \right) } } \over { b \left( a^{2} + b^{2} \right) }} \\ \theta =& \arctan2 \left( \sin \theta , \cos \theta \right) \end{align*} 특히 c=0c = 0 일 때는 다음과 같이 더 간단한 꼴을 사용할 수 있다. cosθ=±b2a2+b2sinθ=abb2a2+b2θ=arctan2(sinθ,cosθ) \begin{align*} \cos \theta =& \pm \sqrt{ {{ b^{2} } \over { a^{2} + b^{2} }} } \\ \sin \theta =& \mp {{ a } \over { b }} \sqrt{ {{ b^{2} } \over { a^{2} + b^{2} }} } \\ \theta =& \arctan2 \left( \sin \theta , \cos \theta \right) \end{align*}

증명

전략: 근본적으로 근의 공식을 사용할 뿐이다.

근의 공식: 이차방정식 ax2+bx+c=0ax^{2}+bx+c=0 (단, a0a\neq 0)에 대해 x=b±b24ac2a x=\dfrac{ -b\pm \sqrt { b^{2}-4ac } }{2a}


sinθ=1cos2θ\sin \theta = \sqrt{ 1 - \cos^{2} \theta} 이므로 acosθ+bsinθ=c    acosθc=bsinθ    a2cos2θ2accosθ+c2=b2(1cos2θ)    a2cos2θ2accosθ+c2=b2(1cos2θ)    (a2+b2)cos2θ2accosθ+(c2b2)=0 \begin{align*} & a \cos \theta + b \sin \theta = c \\ \implies & a \cos \theta - c = - b \sin \theta \\ \implies & a^{2} \cos^{2} \theta - 2 ac \cos \theta + c^{2} = b^{2} \left( 1 - \cos^{2} \theta \right) \\ \implies & a^{2} \cos^{2} \theta - 2 ac \cos \theta + c^{2} = b^{2} \left( 1 - \cos^{2} \theta \right) \\ \implies & \left( a^{2} + b^{2} \right) \cos^{2} \theta - 2 ac \cos \theta + \left( c^{2} - b^{2} \right) = 0 \end{align*} 1차항이 2의 배수일 때의 근의 공식에 따라 cosθ=ac±a2c2(a2+b2)(c2b2)a2+b2=ac±b2c2+a2b2+b4a2+b2 \begin{align*} \cos \theta =& {{ ac \pm \sqrt{ a^{2} c^{2} - \left( a^{2} + b^{2} \right) \left( c^{2} - b^{2} \right) } } \over { a^{2} + b^{2} }} \\ =& {{ ac \pm \sqrt{ - b^{2} c^{2} + a^{2} b^{2} + b^{4} } } \over { a^{2} + b^{2} }} \end{align*} 한편 sinθ=cacosθb\sin \theta = {{ c - a \cos \theta } \over { b }} 이므로 sinθ=cacosθb=caac±b2(a2+b2c2)a2+b2b=cba2c±ab2(a2+b2c2)b(a2+b2)=c(a2+b2)ba2c±ab2(a2+b2c2)b(a2+b2)=b2c±ab2(a2+b2c2)b(a2+b2) \begin{align*} \sin \theta =& {{ c - a \cos \theta } \over { b }} \\ =& {{ c - a {{ ac \pm \sqrt{ b^{2} \left( a^{2} + b_{2} - c^{2} \right) } } \over { a^{2} + b^{2} }}} \over { b }} \\ =& {{ c } \over { b }} - {{ a^{2} c \pm a \sqrt{ b^{2} \left( a^{2} + b_{2} - c^{2} \right) } } \over { b \left( a^{2} + b^{2} \right) }} \\ =& {{ c \left( a^{2} + b^{2} \right) } \over { b }} - {{ a^{2} c \pm a \sqrt{ b^{2} \left( a^{2} + b_{2} - c^{2} \right) } } \over { b \left( a^{2} + b^{2} \right) }} \\ =& - {{ b^{2} c \pm a \sqrt{ b^{2} \left( a^{2} + b_{2} - c^{2} \right) } } \over { b \left( a^{2} + b^{2} \right) }} \end{align*} 이다. 사인과 코사인을 알았으니 아크탄젠트2에 우리가 원하던 θ=arctan2(sinθ,cosθ)\theta = \arctan2 \left( \sin \theta , \cos \theta \right) 을 얻는다.