- #1
albatros
- 5
- 0
Hello ppl,
I'm new here.
I'm trying to compute RK4 for N-body problem. But after computing I'm getting strange numbers. So here are the formulas for these problem.
Start from two differential equations of first order:
[1] d[tex]\vec{r}[/tex]/dt = [tex]\vec{v_i}[/tex]
[2] [tex]\frac{d\vec{v_i}}{dt}[/tex] = [tex]\gamma[/tex] [tex]\sum\frac{m_k}{r_i^{3}}[/tex] * [tex]\vec{r_i}[/tex]
So steps are:
[tex]\vec{k1}[/tex] = [tex]\gamma[/tex] [tex]\sum \frac{m}{\left|r_ - r_[j]\right|^2}[/tex] * dt
[tex]\vec{l_{1}}[/tex] = [tex]\vec{v_{i}} * dt[/tex]
[tex]\vec{k_{2}}[/tex] = [tex]\gamma[/tex] * [tex]\sum[/tex] [tex]\frac{m_{}}{\vec{(r_{} + \frac{\vec{l_{1}}}{2}}) - (r_{[j]} + \frac{\vec{l_{1}}}{2})} ^2 [/tex] *dt
[tex]\vec{l_{2}}[/tex] = ( [tex]\vec{v_{i}} *\frac{\vec{k_{1}}}{2}[/tex]) * dt
[tex]\vec{k_{3}}[/tex] = [tex]\gamma[/tex] * [tex]\sum[/tex] [tex]\frac{m_{}}{\vec{(r_{} + \frac{\vec{l_{2}}}{2}}) - (r_{[j]} + \frac{\vec{l_{2}}}{2})} [/tex] * dt
[tex]\vec{l_{3}}[/tex] = ( [tex]\vec{v_{i}} *\frac{\vec{k_{2}}}{2}[/tex]) * dt
[tex]\vec{k_{4}}[/tex] = [tex]\gamma[/tex] * [tex]\frac{m_{}{|(\vec{r_{} + \vec{l_{3}})}) - \vec{r_{} + \vec{l_{3}})} [/tex]
[tex]\vec{l_{4}}[/tex] = ( [tex]\vec{v_{i}} *\vec{k_{3}}[/tex]) * dt
I'm new here.
I'm trying to compute RK4 for N-body problem. But after computing I'm getting strange numbers. So here are the formulas for these problem.
Start from two differential equations of first order:
[1] d[tex]\vec{r}[/tex]/dt = [tex]\vec{v_i}[/tex]
[2] [tex]\frac{d\vec{v_i}}{dt}[/tex] = [tex]\gamma[/tex] [tex]\sum\frac{m_k}{r_i^{3}}[/tex] * [tex]\vec{r_i}[/tex]
So steps are:
[tex]\vec{k1}[/tex] = [tex]\gamma[/tex] [tex]\sum \frac{m}{\left|r_ - r_[j]\right|^2}[/tex] * dt
[tex]\vec{l_{1}}[/tex] = [tex]\vec{v_{i}} * dt[/tex]
[tex]\vec{k_{2}}[/tex] = [tex]\gamma[/tex] * [tex]\sum[/tex] [tex]\frac{m_{}}{\vec{(r_{} + \frac{\vec{l_{1}}}{2}}) - (r_{[j]} + \frac{\vec{l_{1}}}{2})} ^2 [/tex] *dt
[tex]\vec{l_{2}}[/tex] = ( [tex]\vec{v_{i}} *\frac{\vec{k_{1}}}{2}[/tex]) * dt
[tex]\vec{k_{3}}[/tex] = [tex]\gamma[/tex] * [tex]\sum[/tex] [tex]\frac{m_{}}{\vec{(r_{} + \frac{\vec{l_{2}}}{2}}) - (r_{[j]} + \frac{\vec{l_{2}}}{2})} [/tex] * dt
[tex]\vec{l_{3}}[/tex] = ( [tex]\vec{v_{i}} *\frac{\vec{k_{2}}}{2}[/tex]) * dt
[tex]\vec{k_{4}}[/tex] = [tex]\gamma[/tex] * [tex]\frac{m_{}{|(\vec{r_{} + \vec{l_{3}})}) - \vec{r_{} + \vec{l_{3}})} [/tex]
[tex]\vec{l_{4}}[/tex] = ( [tex]\vec{v_{i}} *\vec{k_{3}}[/tex]) * dt