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を付け加えるものだ。逆運動学でよく登場する以下の定理を紹介する。

定理

三角関数の線形組み合わせが与えられたときの角度

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*} 一次項が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) を得る。