Determine the Transformation from Cylindrical to Rectangular coordinates

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
5 replies · 2K views
LagrangeEuler
Messages
711
Reaction score
22
In physics is usually defined that in cylindrical coordinates ##\varphi \in [0,2 \pi)##. In relation with Deckart coordinates it is usually written that
[tex]\varphi=\text{arctg}(\frac{y}{x})[/tex].
Problem is of course because arctg takes values from ##-\frac{\pi}{2}## to ##\frac{\pi}{2}##. What is the best way to solve this?
 

Attachments

  • Marej Spiegel cc.png
    Marej Spiegel cc.png
    24.4 KB · Views: 278
Last edited by a moderator:
Physics news on Phys.org
Why do I need to have ##x=0## to get those values of ##\varphi##? I do not understand? I cannot have those values of ##\varphi## with this definition. That is the problem.
 
arctan is periodic with period ##\pi##. To get the correct quadrant, use the signs of x and y. y positive is first or second quadrant and x positive is first or fourth quadrant.
 
  • Like
Likes   Reactions: pasmith
You can't use arctan(y/x) to uniquely determine [itex]\phi[/itex]; both (x,y) and (-x,-y) have the same value of [itex]y/x[/itex] but have [itex]\phi[/itex] values which differ by [itex]\pi[/itex]. You must therefore also consider the signs of [itex]x[/itex] and [itex]y[/itex]:
[tex] \phi(x,y) = \begin{cases}<br /> \arctan\left (\frac yx\right) & x > 0, y \geq 0 \\<br /> \arctan\left (\frac yx\right) + \pi & x < 0 \\<br /> \arctan\left (\frac yx\right) + 2\pi & x > 0, y < 0 \\<br /> \frac{\pi}{2} & x = 0, y > 0 \\<br /> \frac{3\pi}{2} & x = 0 , y < 0 \\<br /> \mbox{undefined} & x = 0, y = 0<br /> \end{cases}[/tex]
 
  • Like
Likes   Reactions: Delta2
I had the same problem when designing an inexpensive rotary encoder. Since the algorithm had to be implemented in hardware, I used the following algorithm set:[itex]\lvert x \rvert > \lvert y\rvert ? \varphi_{0}=\arctan\frac{\lvert y\rvert}{\lvert x\rvert} :\varphi_{0}=\frac{\pi}{2}-\arctan\frac{\lvert x\rvert}{\lvert y\rvert}[/itex] (sorry for the "C" terminology, but if-then-else looks silly in Tex). From there on it was just a matter of determining the quadrant based on the signs of x and y. And in our case x and y could not be 0 at the same time (but in another case I had to deal with such singularities - and decided not to update anything when passing through a singularity).