Runge kutta 4 & N-body problem

In summary, a user is asking for help with calculating the RK4 method for an N-body problem, and provides some formulas and steps they are using. They are also experiencing issues with getting strange numbers and are seeking assistance.
  • #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
 
Physics news on Phys.org
  • #2
\vec{r_{}}(t+dt) = \vec{r_{}}(t) + \frac{1}{6}(\vec{k_{1}} + 2*\vec{k_{2}} + 2*\vec{k_{3}} + \vec{k_{4}})\vec{v_{}}(t+dt) = \vec{v_{}}(t) + \frac{1}{6}(\vec{l_{1}} + 2*\vec{l_{2}} + 2*\vec{l_{3}} + \vec{l_{4}})But I'm getting strange numbers when I calculate. Can anyone help me?Hi there! It's difficult to answer your question without understanding the context and the exact problem you are trying to solve. Can you provide more details about the problem, including the equations you are using? It would also help if you could explain what kind of strange numbers you are getting, and why they don't make sense to you. That way, we can have a better idea of how to help you.
 
  • #3


Hello,

Thank you for sharing your equations and steps for computing the Runge-Kutta 4 method for the N-body problem. The N-body problem is a complex problem in which the motion of multiple interacting bodies is calculated. The Runge-Kutta 4 method is a numerical method commonly used to solve differential equations, such as the ones you have provided.

I understand that you are getting strange numbers after computing the equations. This could be due to a few reasons. First, it is important to ensure that the equations are set up correctly and that all variables and constants are properly defined. Additionally, it is important to check for any errors in the coding or implementation of the equations. Another possibility could be that the initial conditions or values used in the equations are not accurate, leading to unexpected results.

I recommend checking your equations and code carefully to ensure that they are correct and properly implemented. You may also want to try using different initial conditions or values to see if that affects the results. If you continue to experience issues, it may be helpful to consult with a colleague or mentor who has experience with the N-body problem and the Runge-Kutta 4 method.

I wish you the best of luck in your computations and hope that you are able to find a solution to the strange numbers you are getting. Keep exploring and experimenting, and you will eventually find the answers you are looking for.
 

1. What is the Runge-Kutta 4 method?

The Runge-Kutta 4 method is a numerical method used to solve ordinary differential equations (ODEs). It is a popular method for solving ODEs because it is relatively simple to implement and provides accurate results.

2. How does the Runge-Kutta 4 method work?

The Runge-Kutta 4 method works by approximating the solution to an ODE at a given point by using the slope of the curve at four different points within a small interval. These four points are then used to calculate a weighted average, which is used to update the solution at the given point. This process is repeated to obtain solutions at subsequent points.

3. What is the N-body problem?

The N-body problem is a mathematical problem that involves predicting the motion of a group of objects, such as planets or stars, that are interacting with each other through gravitational forces. It is a challenging problem because the motion of each object is influenced by the positions and velocities of all other objects in the system.

4. How is the N-body problem solved using the Runge-Kutta 4 method?

The N-body problem can be solved using the Runge-Kutta 4 method by treating each object in the system as a separate ODE. The position and velocity of each object are then updated using the Runge-Kutta 4 method at each time step, taking into account the gravitational forces from all other objects in the system.

5. What are the advantages of using the Runge-Kutta 4 method for the N-body problem?

The Runge-Kutta 4 method is advantageous for solving the N-body problem because it is a highly accurate method, allowing for precise predictions of the motion of the objects in the system. It is also relatively easy to implement and can handle complex systems with multiple interacting objects. Additionally, the Runge-Kutta 4 method can handle variable time steps, making it a versatile method for solving the N-body problem.

Similar threads

  • Advanced Physics Homework Help
Replies
11
Views
1K
  • Introductory Physics Homework Help
Replies
13
Views
1K
  • Advanced Physics Homework Help
Replies
16
Views
969
  • Introductory Physics Homework Help
Replies
3
Views
223
Replies
1
Views
340
  • Calculus and Beyond Homework Help
Replies
9
Views
739
Replies
3
Views
899
  • Advanced Physics Homework Help
Replies
3
Views
355
  • Introductory Physics Homework Help
Replies
17
Views
367
  • Introductory Physics Homework Help
Replies
3
Views
203
Back
Top