# Thread: n-body problem with coordinate change

1. I would like to model the motion of the planets as point size masses using matrices. I am not including moons, maybe later...Any help is much appreciated as I work through this

The complete graph with 10 nodes shows 45 edges.

10nodes.jpg

This graph is directed if along every edge the orientation is taken to be X( na to nb < na) is negative.
Numbering the massive bodies, I number starting at 1 for the sun and give pluto node number 10.

Such that

X14 indicates the vector pointing from the sun to mars with the negative direction being toward the sun.

The position of each node in R3 is given by the vector Xi(t) = [Xi1, Xi2, Xi3] with initial positions Xio at t = to.

The force vector F, between any two nodes is Fij and is proportional to the product of the masses of nodes i and j, divided by the ||Xij||^2.

Assume continuous and differentiable in all dimensions.

dx/dt = V
dV/dt = A = d2x/d2t

And Fij(t) = k*mi*mj * (xij hat) / (xij)^2

Even though this matrx Fij is 45 dimensions I can tell that it will be symmetrical and singular, since all terms Fii are zero and that the rank of the matrix will be 44 ( I think) leaving a nullspace of 1 dimension.

will stop here for now as I am having trouble seeing the equation in the form Ax= b. My first thought is to rearrange it in someway but the method is not clear to me. I am seeing exponents in a matrix equation so I am thinking this has to do with eigen values somehow, bu the matrix is singular.

2.

3. Oh and the coordinate change will be later, I want to move the final model in to a rotating coordinate system.

4. I am not clear as to how this is meant to work. What is the physical meaning of the matrix F ? Matrix multiplication Fx will yield another matrix b - what is its meaning ?
Are you attempting to model just the general shape of the solar system ?

5. Yes, I want a way so see the force components from each body on all the other bodies as a function of time later I want to add centripital force to this diagram than ty to cancel it using a different reference frame. My maths are at their limit here so I am not sure what this will look like in the end. I have an idea. Also I just realized that the matrix may not be singular

0 n m
-n 0 p
-m -p 0

reduces to

n n m-p
0 n 2m+p
0 0 -m^2 +p^2 -m^2n +pm/n

(close enough)
which is nonsingular

6. Originally Posted by ReMakeIt
Yes, I want a way so see the force components from each body on all the other bodies as a function of time later I want to add centripital force to this diagram than ty to cancel it using a different reference frame. My maths are at their limit here so I am not sure what this will look like in the end. I have an idea.
Ok, I see.
I don't doubt that this might work, however, I think the transformation matrix to get from state A to state B will become very complicated because the bodies interact with each other as well, not just with the sun. In essence we are going to have a system of differential equations of the form

wherein m is the body masses, q are the position vectors, and F represent the forces between the bodies. The solutions will be the time-parametrized orbits q(t) for each body. This can be rewritten and re-arranged into a matrix equation of rank 10.

7. Just by looking at it, I am beginning to doubt that this system of ODEs has a closed analytical solution. You might get stuck with a numerical model here. The F would be of the form

or something similar, according to Newton ( the q are all vectors, of course ).

8. Yes, the notation is clear, thanks this looks like the perfect problem for me to stretch my brain. Even in the case of a non specific solution the work will be the reward.

9. Originally Posted by ReMakeIt
Yes, the notation is clear, thanks this looks like the perfect problem for me to stretch my brain. Even in the case of a non specific solution the work will be the reward.
I agree, this is sure going to be a challenge !!
Let us know how you get on...I know what the n-body problem looks like, but have never actually attempted a solution, not with anything more than two bodies at a time anyway. I'm quite curious to know how you are going to tackle that system of equations !

10. As far as I know, an exact analytical solution to the n-body problem is impossible (for n > 3). This is why numerical methods are used. What you propose looks like it could be a usable form for use in a simulation (I don't know about efficiency).

11. The complete graph gives this adjacency matrix, A:

0 1 1 1 1 1 1 1 1 1
-1 0 1 1 1 1 1 1 1 1
-1 -1 0 1 1 1 1 1 1 1
-1 -1 -1 0 1 1 1 1 1 1
-1 -1 -1 -1 0 1 1 1 1 1
-1 -1 -1 -1 -1 0 1 1 1 1
-1 -1 -1 -1 -1 -1 0 1 1 1
-1 -1 -1 -1 -1 -1 -1 0 1 1
-1 -1 -1 -1 -1 -1 -1 -1 0 1
-1 -1 -1 -1 -1 -1 -1 -1 -1 0

which has determinate 1, trace 0 and no real eigenvalues
It has full rank and is invertible.

Now I have a question. The mass of each planet if placed in to a vector notation M = [m1,m2...mn], gives the right mass components to the final equations in the form:

MMT

The problem I have with that is that mass is a scalar not a vector so I don't know if mass can be operated on like this and what it means to do so.

And the hadamard product A, MMT gives the matrix B where bij = mi*mj * sign of force.

If it does make sense to work with the matrix this way I need another matrix which I can take the hadamard product B, C. Where C has the values of (xi-xj)/(xi-xj)3 or similarly, 1/xiTxj.

One way I can get the matrix D containing the right (xi-xj) term is by taking D = X*vec{1}T- vec{1}*XT

Where vec{1} is a vector containing all ones.
Now to get the final matrix equation:

F = ((A, MMT), C)

Where C is some combination of matrix D like D/D3 which I am still trying to figure out.

12. Originally Posted by ReMakeIt
The complete graph gives this adjacency matrix, A:

0 1 1 1 1 1 1 1 1 1
-1 0 1 1 1 1 1 1 1 1
-1 -1 0 1 1 1 1 1 1 1
-1 -1 -1 0 1 1 1 1 1 1
-1 -1 -1 -1 0 1 1 1 1 1
-1 -1 -1 -1 -1 0 1 1 1 1
-1 -1 -1 -1 -1 -1 0 1 1 1
-1 -1 -1 -1 -1 -1 -1 0 1 1
-1 -1 -1 -1 -1 -1 -1 -1 0 1
-1 -1 -1 -1 -1 -1 -1 -1 -1 0

which has determinate 1, trace 0 and no real eigenvalues
It has full rank and is invertible.

Now I have a question. The mass of each planet if placed in to a vector notation M = [m1,m2...mn], gives the right mass components to the final equations in the form:

MMT

The problem I have with that is that mass is a scalar not a vector so I don't know if mass can be operated on like this and what it means to do so.

And the hadamard product A, MMT gives the matrix B where bij = mi*mj * sign of force.

If it does make sense to work with the matrix this way I need another matrix which I can take the hadamard product B, C. Where C has the values of (xi-xj)/(xi-xj)3 or similarly, 1/xiTxj.

One way I can get the matrix D containing the right (xi-xj) term is by taking D = X*vec{1}T- vec{1}*XT

Where vec{1} is a vector containing all ones.
Now to get the final matrix equation:

F = ((A, MMT), C)

Where C is some combination of matrix D like D/D3 which I am still trying to figure out.
I think I lost you here now. The differential equations governing the planetary orbits are actually non-linear, so not sure how far you are going to get with these matrices...

13. I also see that this is not the way it is done, something is very strange about the way I am going about this, I will continue until I see where I went wrong.

14. After staring at this for some time today I came up with some ideas:

The adjacency matrix in this case is not represented by the matrix with 1, 0, and -1 in the case where the nodes have mass and definite positions. So,
0 1 1 1 1 1 1 1 1 1
-1 0 1 1 1 1 1 1 1 1
-1 -1 0 1 1 1 1 1 1 1
-1 -1 -1 0 1 1 1 1 1 1
-1 -1 -1 -1 0 1 1 1 1 1
-1 -1 -1 -1 -1 0 1 1 1 1
-1 -1 -1 -1 -1 -1 0 1 1 1
-1 -1 -1 -1 -1 -1 -1 0 1 1
-1 -1 -1 -1 -1 -1 -1 -1 0 1
-1 -1 -1 -1 -1 -1 -1 -1 -1 0

becomes the matrix with the form:

Fmatrix.JPG

which exhibits the same sign behavior as the 1,0,-1 matrix, notice the diagonal terms coming from the force of a mass acting on itself which would be zero, and the anti-symmetrical behavior or the other components.

Notice that the sum of the terms in the first row is the same as F(x1) = Sum (m1mi* (x1-xi)/(x1-xi)3)

What I am trying to do now is see this matrix as the outer product of 2 vectors.

Notice that if I take the outer product of two vectors M and MT

M1 * M1 M2 M3 M4 = M12 M1M2 M1M3 M1M4
M2 |_____________M2M1 M22 M2M3 M2M4
M3
|_________________ M3M1 M3M2 M32 M3M4
M4 |_____________M4M1 M4M2 M4M3 M42

And these are the coefficients I want but since mass at a point is not a vector quantity something else is needed in the vectors used to make the outer product.

15. Also, the Final force vector should not be a matrix but each of those sums should be a member of the vector

So that

F(x1) = Sum (m1mi* (x1-xi)/(x1-xi)3)
F(x2) = Sum (m2mi* (x2-xi)/(x2-xi)3)
F(x3) = Sum (m3mi* (x3-xi)/(x3-xi)3)
F(x4) = Sum (m4mi* (x4-xi)/(x4-xi)3).
.
.
.

Which means that the force vector should be the dot product of 2 matrix, which included the values of the MMT expansion. What I am after here is the outer product of two vectors, U and V, which develops the matrix A which operates on the vector X and gives the force vector F

VUT*X = AX = F

16. Originally Posted by ReMakeIt
Also, the Final force vector should not be a matrix but each of those sums should be a member of the vector

So that

F(x1) = Sum (m1mi* (x1-xi)/(x1-xi)3)
F(x2) = Sum (m2mi* (x2-xi)/(x2-xi)3)
F(x3) = Sum (m3mi* (x3-xi)/(x3-xi)3)
F(x4) = Sum (m4mi* (x4-xi)/(x4-xi)3).
.
.
.

Which means that the force vector should be the dot product of 2 matrix, which included the values of the MMT expansion. What I am after here is the outer product of two vectors, U and V, which develops the matrix A which operates on the vector X and gives the force vector F

VUT*X = AX = F
That's pretty much the idea. Remember though that we you need to get is 10 vectors, one for each of the planets. With these vectors you can then calculate the actual orbits via F=ma.

17. $\large \dpi{150} \fn_cm \vec{A}_\left ( \vec{x} \right ) = G \bullet \sum \frac{m_i} {\vec{X} ^T \vec{X_i}}$

in matrix form

$\large \dpi{150} \fn_cm \vec{A} = \vec{M} \bullet \left( \vec_X^T\vec_X \right )^{-1}$

Mass matrix M and acceleration matrix A:

$\large \dpi{150} \fn_cm \vec{M} = \begin{bmatrix} M_1 & 0 & 0 & .. & 0\\ 0 & M_2 & 0 & & 0\\ :& : & :& & :\\ 0 & 0 & 0 & .. & M_n \end{bmatrix}$ ; $\large \dpi{150} \fn_cm \vec{A} = \begin{bmatrix} A_{11} & A_{12} & .. & A_{1n}\\ A_{21} & A_{22} & & A_{2n}\\ :& : & & :\\ A_{n1} & A_{n2} & .. & A_{nn} \end{bmatrix}$

And
$\large \dpi{150} \fn_cm \begin{bmatrix} X_{11} & X_{12} & X_{13} \\ X_{21} & X_{22} & X_{33} \\ . & . & . \\ X_{n1} & X_{n2} & X_{n3} \end{bmatrix} \bullet \begin{bmatrix} X_{11} & X_{21}& .. & X_{n1}\\ X_{21}& X_{22}& .. & X_{n2}\\ X_{31} & X_{32} & .. & X_{n3} \end{bmatrix} = \begin{bmatrix} \vec{x}_1 ^T\vec{x}_1 & \vec{x}_1 ^T\vec{x}_2 & ...& \vec{x}_1 ^T\vec{x}_n\\ : & : & :& :\\ \vec{x}_n ^T\vec{x}_1 &\vec{x}_n ^T\vec{x}_2 & ..& \vec{x}_n ^T\vec{x}_n \end{bmatrix}$

$\large \dpi{150} \fn_cm \vec{X}^T\vec{X}\bullet \vec{A} = \vec{M}$

18. The A11 term shows the acceleration from object 1 to object 1 and is zero, but since the direction of the acceleration is in the direction if its position it is zero.

The A12 and A21 term show opposite magnitude along the X1 --> X2 line.

Now i need a matrix which will take the contributions along these vectors and normalize them to a standard basis in R3.

19. Originally Posted by ReMakeIt
The A11 term shows the acceleration from object 1 to object 1 and is zero, but since the direction of the acceleration is in the direction if its position it is zero.

The A12 and A21 term show opposite magnitude along the X1 --> X2 line.

Now i need a matrix which will take the contributions along these vectors and normalize them to a standard basis in R3.
Where are the differentials ?

20. $\large \dpi{150} \fn_cm \frac {G\cdot\vec{M}\left (\vec{X}_o\cdot \vec{1}^T-\vec{X}\right )}{ \left( \vec{X}_o\cdot \vec{1}^T-\vec{X}\right ),\left (\vec{X}_o\cdot \vec{1}^T-\vec{X}\right ),\left (\vec{X}_o\cdot \vec{1}^T-\vec{X}\right) }= \vec_A _{\vec_X_o}$

Back to this bleh... still want to find a better form. There has to be some method of simplifying this...

 Bookmarks
##### Bookmarks
 Posting Permissions
 You may not post new threads You may not post replies You may not post attachments You may not edit your posts   BB code is On Smilies are On [IMG] code is On [VIDEO] code is On HTML code is Off Trackbacks are Off Pingbacks are Off Refbacks are On Terms of Use Agreement