# I have a list of separation/displacement vectors, how can I calculate the location vectors?

I need to calculate some location vectors which from separationdisplacemen vectors which are generated from the formula $\vec{R}_{i+1} - \vec{R}_{i}$, where $\vec{R}_{i}$ being a location vector.

A little background: I have some monomers where I have their separation vectors, but what I want to get is the monomer locations.

How can I do this? Maybe a toy example can help me understand this a bit better.

EDIT:

I am given a list of separation vectors from a function called frc. Here is the help print out:

This function generates nruns configurations of a length N polymer,
using the freely rotating chain model with fixed bond angle theta.
It is returned as a single 3 x N x nruns tensor of separation vectors.
The first dimension is the x,y,z coordinates; the second specifies which
monomer on the chain; and the third specifies which configuration.

• You need to provide more information. Do all of these separation or displacement vectors involve displacements from the same reference point? – user93237 Oct 29 '16 at 4:39

I assume you mean something like this:

where the $\hat{r}_i$ are the separation vectors and you want to calculate the vector $\hat{R}$. The answer is simply that $\hat{R}$ is the sum of all the vector that lead up to it so in this case:

$$\hat{R} = \hat{r}_0 + \hat{r}_1 + \hat{r}_2 + \hat{r}_3 + \hat{r}_4 + \hat{r}_5$$

The only catch is that you need to use vector addition when adding the vectors. You don't say how you're given the separation vectors, i.e. in what format, but they are often given as their $x$, $y$ and $z$ components:

$$\hat{r} = \left(r_x, r_y, r_z \right)$$

In this case you add the vectors simply by adding their components, so for example;

$$\hat{a} + \hat{b} = \left( x_a + x_b, y_a + y_b, z_a + z_b \right)$$

• Thanks John, I actually have to calculate the locations for each monomer in this freely rotating chain. I can calculate the end to end or R when I sum up each of the location vectors. So the real question is how can I calculate the locations of each of the monomers when I am given a list of separation vectors in the format (x,y,z) – Kevin Oct 29 '16 at 6:00
• @Kevin: The location of the $n$th monomer (relative to whatever end of the chain you start at) is just $R_n = r_0 + r_1 +\, ...\, + r_n$. – John Rennie Oct 29 '16 at 6:03
• Ah! okay, so I can do something like cumulative sum (of the separation vector) along the chain and get my location for each monomer. Thanks! – Kevin Oct 29 '16 at 6:08
• @Kevin: yes, exactly. – John Rennie Oct 29 '16 at 6:11