# Write a vector 's' in x y co-ordinate system

#### jermie

How to write a vector 's' in x y co-ordinate system, as function of (x,y,theta) ? 's' is inclined at an angle of theta to y axis?

#### chiro

Re: Transformation

How to write a vector 's' in x y co-ordinate system, as function of (x,y,theta) ? 's' is inclined at an angle of theta to y axis?
If you are referring to polar co-ordinates, you need to specify the radius of the vector along with the angle it makes.

For a 2D conversion from polar to Cartesian (x,y) we use:

x = r cos(theta)
y = r sin(theta)

For the reverse transformation we use

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

your theta will be a case by case arctan evaluation depending on the quadrant of the point and whether your x value is zero in which case you some odd multiple of pi/2.

#### jermie

Re: Transformation

Thanks Chir
I would like to know, if i can write the any vector inclined at angle theta to y axis as a function of x,y,theta.
i.e, i don't want resolution of the vector into x and y coordinates. as x= s sin(theta);y=scos(theta)

Is s=sqrt(x^2+y^2)[xsin(theta)+ycos(theta)] correct??

Last edited:

#### chiro

Re: Transformation

Thanks Chir
I would like to know, if i can write the any vector inclined at angle theta to y axis as a function of x,y,theta.
i.e, i don't want resolution of the vector into x and y coordinates. as x= s sin(theta);y=scos(theta)

Is s=sqrt(x^2+y^2)[xsin(theta)+ycos(theta)] correct??
If I understand you want basically any vector that makes an angle theta with the x-axis, then basically the "slope" of the vector is simply tan(theta).

r is basically the length of your vector from the point to the origin. In the case of having any vector with the same slope, you basically choose any r that is greater than zero.

I'm not sure exactly what you are asking so i'll just go over the things I think you're asking.

If you want to calculate the slope of the vector (the tangent) and you have the angle, the slope is simply tan(theta).

If you want to write what the vector is in vector form you use

V = r * (i * sin(theta) + j * cos(theta)) where r is the length of the vector and theta is the angle made with the x-axis, and i refers to the "x" basis vector (ie [1,0]) and j refers to the "y" basis vector (ie [0,1]).

Also note that when we talk about polar coordinates our angle is always made with the x-axis in two dimensions.

#### jermie

Re: Transformation

Thanks:) Am working on sloshing in rectangular container subjected to horizontal, vertical and rotational excitation.
Am trying to formulate the boundary conditions incorporating the excitations in it. My problem now is I would like to write rotation component in terms of translation.

#### chiro

Re: Transformation

Thanks:) Am working on sloshing in rectangular container subjected to horizontal, vertical and rotational excitation.
Am trying to formulate the boundary conditions incorporating the excitations in it. My problem now is I would like to write rotation component in terms of translation.
I'm not sure exactly what you are getting at, but I'll take a stab and say you're looking at rotating things about an arbitrary point.

To do this you basically subtract the "point of rotation" from all points you are rotating and then perform a rotation. I'll do the quick derivation for rotations in two dimensions.

Lets say you have an arbitrary point (x,y) that already has an angle theta. We want to rotate the point counterclockwise by adding an angle gamma so that basically the final point has the same length but is an at angle (theta + gamma).

From above we know that:

x = r cos(theta)
y = r sin(theta)

We want to find x' and y' (our new points) which are

x' = r cos(theta + gamma)
y' = r sin(theta + gamma)

We have trigonometric identities for addition of angles in sine and cosine (if you don't know what they are or how they are derived look them up on wiki).

So basically when we expand the x' and y' we get

x' = r * [cos(theta)*cos(gamma) - sin(theta) * sin(gamma)]
y' = r * [sin(theta)*cos(gamma) + sin(gamma)*cos(theta)]

x' = [r * cos(theta) ] * cos(gamma) - [r * sin(theta)] * sin(gamma)]
y' = [r * sin(theta) ] * cos(gamma) + [r * cos(theta)] * sin(gamma)]

Given that x = r * cos(theta) and y = r * sin(theta) we get the equations

x' = x * cos(gamma) - y * sin(gamma)
y' = y * cos(gamma) + x * sin(gamma)

and that is rotation in two dimensions.

This assumes that you're rotating the point about (0,0) but like I said above if you want to rotate the points about an arbitrary point [ say (a,b)] you do the following:

1) Subtract (a,b) from all points
2) Rotate the points using above
3) Add (a,b) back to all points

That's basically all there is to rotation in 2 dimensions. You can do it in three dimensions using the concepts for two dimensions but its actually better to use a rotation axis and an angle rather than doing '2d' rotation multiple times (ie Euler angles).

#### jermie

Re: Transformation

Yeah got it..Thanks..
Problem definition: Moving rectangular tank in X ,Z direction. The tank is subjected to translation in X, Z axis and rotation about X axis.

Now the problem is to write velocity,
U = Ux + Utheta
W= Wz+ Wtheta
Ux - Horizontal displacement term
Wz - Vertical displacement term
Utheta - ,Wtheta - due to rotation

### Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving