Monday, February 8, 2021

An Alternative Way of Finding the Angle in a Rectangular to Polar Conversion

An Alternative Way of Finding the Angle in a Rectangular to Polar Conversion


Welcome to a special Monday edition of Eddie’s Math and Calculator Blog. 


The Traditional Method


Often we are required to find polar coordinates of a given point (x,y).   Finding the radius, r, is fairly simple:


r = √(x^2 + y^2) 


When talking about complex numbers, r represents the absolute value of x + yi where i = √-1.


Finding the angle, θ, often uses the formula:


θ = atan(y/x)


In complex numbers, θ represents the argument (arg) function.


On a scientific calculator the range of the arctangent function is ( -90°, 90° ).  (open interval).   In finding the true angle, adjustments will be required:





Let a = atan(y/x). Then: 


Quadrant I (x and y are both positive):  θ = a

Quadrant II (x is negative, y is positive): θ = a + 180°

Quadrant III (x and y are both negative):  θ = a - 180°

Quadrant IV (x is positive, y is negative):  θ = a 


If you are working with radian angle measures, know that 90° = π/2, and 180° = π.


This does not take into consideration situations where either x or y is 0:


If x > 0 and y = 0:  θ = 0°

If x = 0 and y > 0:  θ = 90°

If x < 0 and y = 0:  θ = 180°

If x = 0 and y < 0:  θ = -90°


Is there a shorter way to calculate θ?  


The Vector Method


Consider the point (x, y) as a vector [x, y].   Now draw another vector [x, 0].  In a regular Cartesian coordinate system, angles are measured from the x-axis counter clockwise.  





Let a and b represent two vectors.  Then the angle between two vectors are:


cos θ = (a ● b) / ( ||a|| ||b|| ) = dot(a,b) / ( norm(a) * norm(b) )


with:

dot(a,b) = a1 * b1 + a2 * b2

norm(a) = √(a1^2 + a2^2)

norm(b) = √(b1^2 + b2^2)


Let a = [x, y] and b = [x, 0].  Then:


cos θ = (x^2) / (√(x^2 + y^2) * √(x^2))

cos θ = (x^2) / (√(x^2 + y^2) * x)

cos θ = x / √(x^2 + y^2)

θ = acos( x / √(x^2 + y^2) )


The range of the arccosine function of a calculator is [ 0°, 180° ].  


If y < 0, the angle would be measured clockwise, and therefore I would make the adjustment:

θ = -acos( x / √(x^2 + y^2) )


In summary:

If y ≥ 0, θ = acos( x / √(x^2 + y^2) )

If y < 0, then θ = -acos( x / √(x^2 + y^2) )


Examples:


Find the angle, in degrees, in a rectangular to polar conversions:


Quadrant I  (2, 4):  y ≥ 0:   θ = acos( 2 / √(2^2 + 4^2) ) ≈ 63.43494882°


Quadrant II (-2, 4):  y ≥ 0:    θ = acos( -2 / √((-2)^2 + 4^2) ) ≈ 116.5650512°


Quadrant II (-2, -4):  y < 0:  θ = -acos( (-2) / √((-2)^2 + (-4)^2) ) ≈ -116.5650512°


Quadrant IV (2, -4):  y < 0:  θ = -acos( 2) / √(2^2 + (-4)^2) ) ≈ -63.43494882°


Vector Method for Navigation


In navigation, angles start from true North (up) and rotate clockwise towards East (right).  Angles are measured from 0° to 360°.


Use the vectors [0, N] and [E, N], then the angle between these vectors are:

If E ≥ 0,  θ = acos( N / √(E^2 + N^2))

If E < 0, θ = 360° - acos( N / √(E^2 + N^2))


Note:  This is the first blog entry that I have typed on Google Docs.  I have been using Windows app Wordpad for the last three years.   I am testing Google apps as I am considering buying a Chromebook.


Eddie


All original content copyright, © 2011-2021.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.


Spotlight: Akron Brass FireCalc Pocket Computer

Spotlight: Akron Brass FireCalc Pocket Computer Welcome to a special Monday Edition of Eddie’s Math and Calculator blog. Thi...