DaleSpam said:
If you have any vector in Cartesian coordinates and you want to express it in Cylindrical coordinates then you use:
r = sqrt(x²+y²)
theta = atan(y/x)
z = z
If you have any vector in Cylindrical coordinates and you want to express it in Cartesian coordinates then you use:
x = r cos(theta)
y = r sin(theta)
z = z
It makes no difference whatsoever what the units are nor whether the vector represents position, acceleration, velocity, momentum, etc.
The only trick comes if you have a position as a function of time in Cylindrical coordinates and you want to find the velocity or acceleration as a function of time in the Cylindrical coordinates without converting to and from Cartesian. Then you use the formulas I linked to above.
So radial velocity would be vr = sqrt(vx^2+vy^2). However, for an orbiting body, radial velocity is largely zero, which with that equation would imply that vx and vy are both largely zero, which is not the case.
gabbagabbahey said:
Why are there sign functions in your expression?
To find velocities you need only differentiate withe respect to time:
v_x\equiv\frac{dx}{dt}=\frac{d}{dt}(r\cos\theta)=\frac{dr}{dt}\cos\theta-r\sin\theta\frac{d\theta}{dt}=v_r\cos\theta- v_{\theta}\sin\theta
To get v_y and v_z you just do the same thing to your expressions for y and zTo get v_r and v_{\theta} in terms of Cartesians you just differentiate the expressions for r and \theta with respect to time:
v_r=\frac{dr}{dt}=\frac{d}{dt}\sqrt{x^2+y^2}
v_{\theta}\equiv r\frac{d\theta}{dt}=r\frac{d}{dt} \tan^{-1}\left(\frac{y}{x}\right)=\sqrt{x^2+y^2}\frac{d}{dt} \tan^{-1}\left(\frac{y}{x}\right)
OR you solve the 3 equations you got for v_x, v_y and v_z for v_r, v_theta and v_z the same way you would solve any system of 3 equations for 3 unknowns.
The signs are because x and y become negative and the signs on the velocities need to be right.
Sorry guys if I'm missing the point or I'm not explaining it well enough. Like I said, I really suck at angle conversions and co-ordinate systems etc.
To try to explain things better, I'm attaching a sketch of what I'm trying to do:
I basically start with information in the form x,y,z,vx,vy,vz. I then have to calculate a force for which the equations work in azimuthal and radial values and depend on the azimuthal and radial velocities (in the same units as vx,vy,vz). So I have to first convert vx and vy into rotational velocity and radial velocity. Then the resulting force has to be converted back to the force in x,y,z.
So, vx,vy,vz,v_azimuthal,v_radial all have the same units (i.e. m/s). Theta is calculated by using y/x but since y/x changes sign depending on which quadrant it is in, I've added those sign modifiers to try to make things work.
===============================================================
Edit: Right, I think I've worked out the formulae that I need so I'll post them up on here in case anyone else finds this via search and is as similarly lacking as I am in the angles and conversions departments!
theta = atan(y/x)
v_x = abs(v_radial*cos(theta))*sign(x) + abs(v_rotational*sin(theta))*sign(Cy)
v_y = abs(v_radial*sin(theta))*sign(y) - abs(v_rotational*cos(theta))*sign(Cx)
v_radial = abs(v_x*cos(theta))*sign(x) + abs(v_y*sin(theta))*sign(y)
v_rotational = abs(v_x*sin(theta))*sign(Cy) - abs(v_y*cos(theta))*sign(Cx)
where abs() denotes the absolute value (or modulus) of a number (i.e. -1.5623 -> 1.5623 and +1.2479 -> 1.2479) and sign() gives the sign of a number (i.e. 1.2435 -> 1 and -1.7829 -> -1).
C is a sign factor depending on the direction of rotation. For anticlockwise motion, C is -1, for clockwise motion, C is 1. This is for a system where a body is rotating around another, which is at x = y = 0.
There's probably an easier way of doing this but I'm not bright enough to work it out!