# Finding the argument of a complex fraction (doing something wrong but not knowing what)

I am working on a problem, and I think that I miss something very simple but I do not get what I am doing wrong.

The problem:

I need to find the argument of the following function (all the variables are real and greater or equal to zero and I work in radians):

$$\arg\left(\frac{1}{\text{a}_1\cdot\left(\omega\text{j}\right)^3+\text{a}_2\cdot\left(\omega\text{j}\right)^2+\text{a}_3\cdot\left(\omega\text{j}\right)+1}\right)=$$ $$\arg\left(\frac{1}{-\text{a}_1\cdot\omega^3\cdot\text{j}-\text{a}_2\cdot\omega^2+\text{a}_3\cdot\omega\cdot\text{j}+1}\right)=$$ $$\arg\left(\frac{1}{1-\text{a}_2\cdot\omega^2+\left(\text{a}_3\cdot\omega-\text{a}_1\cdot\omega^3\right)\cdot\text{j}}\right)\tag1$$

Where $\text{j}^2=i^2=-1$

Using the rules for the agument we can write:

$$\arg\left(1\right)-\arg\left(1-\text{a}_2\cdot\omega^2+\left(\text{a}_3\cdot\omega-\text{a}_1\cdot\omega^3\right)\cdot\text{j}\right)=$$ $$0-\arg\left(1-\text{a}_2\cdot\omega^2+\left(\text{a}_3\cdot\omega-\text{a}_1\cdot\omega^3\right)\cdot\text{j}\right)=$$ $$-\arg\left(1-\text{a}_2\cdot\omega^2+\left(\text{a}_3\cdot\omega-\text{a}_1\cdot\omega^3\right)\cdot\text{j}\right)\tag2$$

Setting $\arg\left(1-\text{a}_2\cdot\omega^2+\left(\text{a}_3\cdot\omega-\text{a}_1\cdot\omega^3\right)\cdot\text{j}\right):=\varphi\left(\omega\right)$.

My work:

I got the following function for the argument:

$$\varphi\left(\omega\right)=\begin{cases} -\arctan\left(\frac{\text{a}_3\omega-\text{a}_1\omega^3}{1-\text{a}_2\omega^2}\right)\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\text{when:}\space\space1>\text{a}_2\omega^2\space\wedge\space\text{a}_3\omega>\text{a}_1\omega^3\\ \\ -\left(\pi+\arctan\left(\left|\frac{\text{a}_3\omega-\text{a}_1\omega^3}{1-\text{a}_2\omega^2}\right|\right)\right)\space\space\space\space\space\text{when:}\space\space1<\text{a}_2\omega^2\space\wedge\space\text{a}_3\omega<\text{a}_1\omega^3\\ \\ -\left(\frac{\pi}{2}+\arctan\left(\left|\frac{1-\text{a}_2\omega^2}{\text{a}_3\omega-\text{a}_1\omega^3}\right|\right)\right)\space\space\space\space\text{when:}\space\space1<\text{a}_2\omega^2\space\wedge\space\text{a}_3\omega>\text{a}_1\omega^3\\ \\ -\left(\frac{3\pi}{2}+\arctan\left(\left|\frac{1-\text{a}_2\omega^2}{\text{a}_3\omega-\text{a}_1\omega^3}\right|\right)\right)\space\space\space\text{when:}\space\space1>\text{a}_2\omega^2\space\wedge\space\text{a}_3\omega<\text{a}_1\omega^3 \end{cases}\tag3$$

But it does not match with the function I got using software, so I'm somewhere wrong in $\left(3\right)$. And I do not find where

• What happened to $a_3$ in your final result? – Jens Jul 19 '18 at 18:27
• Is it $a_2\omega$ or $a_2 \omega^2$? – Jens Jul 19 '18 at 18:35
• @Jens In the final answer I got it right, but not in my problem statement. Now it is correct (thank for your help already!). – Jan Jul 19 '18 at 18:37
• Have you tried the standard way of defining Atan2? – Jens Jul 19 '18 at 19:01
• @Jens That is the thing I used. – Jan Jul 19 '18 at 19:08