My Math Forum How to find the difference between angles of two complex num

 Algebra Pre-Algebra and Basic Algebra Math Forum

 May 21st, 2013, 02:19 AM #1 Newbie   Joined: May 2013 Posts: 10 Thanks: 0 Hi I need to find the angle between two vectors which are represented by complex numbers using a program. I should not convert these in to polar for because it costs me processor cycles. So, how can I find the angle difference between two complex numbers? Thanks and Regards Last edited by skipjack; April 16th, 2015 at 06:02 PM.
 May 21st, 2013, 02:24 AM #2 Senior Member     Joined: Jul 2010 From: St. Augustine, FL., U.S.A.'s oldest city Posts: 12,193 Thanks: 504 Math Focus: Calculus/ODEs Re: How to find the difference between angles of two complex I would use: $\Delta\theta=\|\tan^{\small{-1}}$$\frac{b_1}{a_1}$$-\tan^{\small{-1}}$$\frac{b_2}{a_2}$$\|$
 May 21st, 2013, 03:51 AM #3 Newbie   Joined: May 2013 Posts: 10 Thanks: 0 Re: How to find the difference between angles of two complex Hi Mark, thanks for reply. Actually I need a method which has less complexity to implement. In this method I need to calculate tan-1 two times which burdens my hardware. Is there any less complex method? Regards Ashok
 May 21st, 2013, 11:28 AM #4 Global Moderator   Joined: Dec 2006 Posts: 19,294 Thanks: 1685 $\|\tan^{\small-1}$$\frac{a_{\small2}b_{\small1}\,-\,a_{\small1}b_{\small2}}{a_{\small1}a_{\small2}\, +\,b_{\small1}b_{\small2}}$$\|$
 May 21st, 2013, 12:31 PM #5 Math Team     Joined: Jul 2011 From: North America, 42nd parallel Posts: 3,372 Thanks: 233 Re: How to find the difference between angles of two complex You can use the dot product, just pretend the numbers are real. In the complex plane, the complex vector corresponds to the real vector in the cartesian real plane. $A \cdot B \= \ |A||B|cos \theta$ $\theta \= \ \| cos^{\tiny -1}$${\frac{A \cdot B}{|A||B|}}$$ \|$ It uses arccos instead of arctan but i doubt this method is simpler than the others offered.
May 21st, 2013, 08:29 PM   #6
Newbie

Joined: May 2013

Posts: 10
Thanks: 0

Re: How to find the difference between angles of two complex

Hi
But I think it won't give negative angles...
Actually I need negative angles too. Is there any method for that?
Regards

Quote:
 Originally Posted by agentredlum You can use the dot product, just pretend the numbers are real. In the complex plane, the complex vector corresponds to the real vector in the cartesian real plane. $A \cdot B \= \ |A||B|cos \theta$ $\theta \= \ \| cos^{\tiny -1}$${\frac{A \cdot B}{|A||B|}}$$ \|$ It uses arccos instead of arctan but i doubt this method is simpler than the others offered.

May 21st, 2013, 10:43 PM   #7
Newbie

Joined: May 2013

Posts: 10
Thanks: 0

Re:

Dear Friend,
Thanks for the solution, it has taken me to better position.
But it is still not meeting my time constraint
Actually I have one more step after this, shifting the phase of second vector based on the angle difference
What is the method to do these steps together ? (with least complexity , so best timing efficiency)

Regards

Quote:
 Originally Posted by skipjack $\|\tan^{\small-1}$$\frac{a_{\small2}b_{\small1}\,-\,a_{\small1}b_{\small2}}{a_{\small1}a_{\small2}\, +\,b_{\small1}b_{\small2}}$$\|$

 May 21st, 2013, 11:54 PM #8 Math Team     Joined: Jul 2011 From: North America, 42nd parallel Posts: 3,372 Thanks: 233 Re: How to find the difference between angles of two complex You are correct of course, I forgot the usual range of arccos, so absolute value not necessary.
May 22nd, 2013, 12:31 AM   #9
Newbie

Joined: May 2013

Posts: 10
Thanks: 0

Re: How to find the difference between angles of two complex

I did like this in Matlab
acos((dot(v1,v2))/(abs(v1)*abs(v2)))
please check if it is correct

Quote:
 Originally Posted by agentredlum You are correct of course, I forgot the usual range of arccos, so absolute value not necessary.

May 22nd, 2013, 06:57 AM   #10
Math Team

Joined: Jul 2011
From: North America, 42nd parallel

Posts: 3,372
Thanks: 233

Re: How to find the difference between angles of two complex

Quote:
Originally Posted by ashokec
I did like this in Matlab
acos((dot(v1,v2))/(abs(v1)*abs(v2)))
please check if it is correct

Quote:
 Originally Posted by agentredlum You are correct of course, I forgot the usual range of arccos, so absolute value not necessary.
Sorry, I don't have MatLab.

I would test the code using

A = <3, 4>

B = <-6.6, 11.2>

If it gives 67.38° as an answer then it's most likely correct. I got those 2 vectors by putting a 5,12,13 triangle on the hypotenuse of a 3,4,5 triangle with its base 3 on the x axis, you can tell that by looking at vector A. Notice the components of B are 'nice' and not some ghastly irrationals.

The test is not a proof that the code works, but I think the vectors A, B are sufficiently diverse to avoid any nasty coincidences for this problem. If you don't get 67.38° then this proves the code doesn't work.

 Tags angles, complex, difference, find, num

,

,

,

,

,

,

,

,

,

,

,

,

,

,

# angle between two complex vectors

Click on a term to search for related topics.
 Thread Tools Display Modes Linear Mode

 Similar Threads Thread Thread Starter Forum Replies Last Post razzatazz Algebra 3 March 11th, 2013 02:21 PM MATHS FRIEND Algebra 5 September 11th, 2012 06:08 AM Zak Algebra 1 August 8th, 2012 05:49 AM farmtalk Trigonometry 6 May 12th, 2011 07:57 PM rune2402 Algebra 2 March 21st, 2008 10:22 AM

 Contact - Home - Forums - Cryptocurrency Forum - Top