My Math Forum  

Go Back   My Math Forum > High School Math Forum > Algebra

Algebra Pre-Algebra and Basic Algebra Math Forum


Reply
 
LinkBack Thread Tools Display Modes
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.
ashokec is offline  
 
May 21st, 2013, 02:24 AM   #2
Senior Member
 
MarkFL's Avatar
 
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:

MarkFL is offline  
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
ashokec is offline  
May 21st, 2013, 11:28 AM   #4
Global Moderator
 
Joined: Dec 2006

Posts: 19,294
Thanks: 1685

skipjack is online now  
May 21st, 2013, 12:31 PM   #5
Math Team
 
agentredlum's Avatar
 
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 <a, bi> corresponds to the real vector <a, b> in the cartesian real plane.





It uses arccos instead of arctan but i doubt this method is simpler than the others offered.

agentredlum is offline  
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
Thanks for the reply.
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 <a, bi> corresponds to the real vector <a, b> in the cartesian real plane.





It uses arccos instead of arctan but i doubt this method is simpler than the others offered.

ashokec is offline  
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
ashokec is offline  
May 21st, 2013, 11:54 PM   #8
Math Team
 
agentredlum's Avatar
 
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.

agentredlum is offline  
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

Without absolute the answer it's getting add complex number.
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.

ashokec is offline  
May 22nd, 2013, 06:57 AM   #10
Math Team
 
agentredlum's Avatar
 
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
Without absolute the answer it's getting add complex number.
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.

agentredlum is offline  
Reply

  My Math Forum > High School Math Forum > Algebra

Tags
angles, complex, difference, find, num



Search tags for this page
Click on a term to search for related topics.
Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Vectors to find angles razzatazz Algebra 3 March 11th, 2013 02:21 PM
find the angles MATHS FRIEND Algebra 5 September 11th, 2012 06:08 AM
Find two angles with the angle between them Zak Algebra 1 August 8th, 2012 05:49 AM
Trig Ids Part 1: Sum and Difference Angles farmtalk Trigonometry 6 May 12th, 2011 07:57 PM
The difference between two complementary angles is 79° rune2402 Algebra 2 March 21st, 2008 10:22 AM





Copyright © 2018 My Math Forum. All rights reserved.