Numerical integration of Newtons Second Law

185 Views Asked by At

I am having trouble wrapping my head around this concept. I am trying to numerically solve the following equation in python (using ODEint) for a n-body simulation:

$$ m_2\frac{d^2\textbf{x}}{dt^2} = \frac{Gm_1m_2}{r^2}\hat{r} \ $$

Then I chose the substation:

$$ \textbf{v} = \frac{d \textbf{x}}{dt} \longrightarrow \frac{d\textbf{v}}{dt} = \frac{d^2\textbf{x}}{dt^2}$$

with some basic manipulation this leads to:

$$ \frac{d\textbf{v}}{dt} = \frac{Gm_1}{r^2}\hat{r} \ $$

However I'm stuck as to what todo now.

  1. I am unsure how r hat, and how it is inplamentent when solving this equation
  2. Have I made a mistake in cancelling out both of the smaller masses (m2), is this true only if m2<<m1?
  3. I've seen some answers along the lines of $ \frac{d\textbf{v}}{dt} = - \frac{Gm_1m_2}{r^3}\textbf{x} \ $ and I'm wondering if this is the same as what I have derived?

Any help would be much approached in understanding this topic

1

There are 1 best solutions below

0
On BEST ANSWER

First of all, I believe you have dropped a minus sign from your equation since Newton's law is normally written $$F=-\frac{Gm_1m_2}{r^2}\hat{r}$$ meaning that $F=m_2\frac{d^2\mathbf{r}}{dt^2}$ gives us $$m_2\frac{d^2\mathbf{r}}{dt^2}=-\frac{Gm_1m_2}{r^2}\hat{r}$$

  1. $$\hat{r}:=\frac{1}{\sqrt{x^2+y^2+z^2}}(x\hat{x}+y\hat{y}+z\hat{z}),$$ This is the position unit vector. The way you have your equation set up it makes more sense to have $$m_2 \frac{d^2 \mathbf{x}}{dt^2}=-\frac{Gm_1m_2}{|\mathbf{x}|^2} \hat{\mathbf{x}}$$ with $\mathbf{x}=\mathbf{r}$

  2. Your starting equation is really only correct when $m_1$ is so large that it doesn't move relative to its starting condition. If you want to be more you have to consider how each body might move in relation to each other. To do this you can write out the forces between the two objects relative to a stationary frame (very tedious and difficult) or you can use the Lagrange equation to solve for the equations of motion and remove a couple of the restraints and utilize the symmetries of the problem.

  3. The equation you have written here is quite similar to the one you started with, though I think it might be slightly wrong. We can write $\mathbf{x}=|\mathbf{x}|\hat{\mathbf{x}}$ which we can convert our equation to $$m_2 \frac{d^2 \mathbf{x}}{dt^2}=-\frac{Gm_1m_2}{|\mathbf{x}|^3}\mathbf{x}$$ It doesn't really make much of a difference.